0

I have an eclipse RCP application (already built). I need to integrate it with eclipse UI itself. What I mean is -- I want to add a menu option in eclipse User Interface and a command in the menu which when clicked runs the application. It is similar to find and replace option in the eclipse menu

Any idea how this can be done?

I also want the application to be bundled with eclipse

clearb
  • 43
  • 1
  • 6
  • So you write an Eclipse plugin which is installed in Eclipse and adds the menu item to run the app. What part of this is a problem? – greg-449 Apr 07 '15 at 09:12
  • the menu item needs to be added to the eclipse menu itself not the applcation's menu bar – clearb Apr 07 '15 at 10:01
  • Yes so you write a plugin which is installed in Eclipse not your RCP. – greg-449 Apr 07 '15 at 10:02
  • I mean every time eclipse is opened -- that menu option should appear along with other usual menu options like file, edit , navigate etc – clearb Apr 07 '15 at 10:05
  • sorry i am new to this... can you please explain how to write a plugin that would do this when installed or any link that would help me? – clearb Apr 07 '15 at 10:11

1 Answers1

0

Write a plugin that you install in to Eclipse (rather than your RCP).

The plugin can use the org.eclipse.ui.menus extension point to add to the File menu. For example:

 <extension
     point="org.eclipse.ui.menus">
   <menuContribution
        locationURI="menu:file?after=open.ext">
     <command
           commandId="my.command.id"
           id="my.menu.id"
           style="push">
     </command>
  </menuContribution>

Use the org.eclipse.ui.commands extension point to define the command

<extension
   point="org.eclipse.ui.commands">
  <command
        id="my.commnd.id"
        description="Description text"
        name="Name">
  </command>

Use the org.eclipse.ui.handlers extension point to define a handler for the command

<extension
     point="org.eclipse.ui.handlers">
  <handler
        class="package.CommandHandler"
        commandId="my.command.id">
  </handler>

The handler contains the code to run your RCP:

public class CommandHandler extends AbstractHandler
{
  public Object execute(ExecutionEvent event) throws ExecutionException
  {
    // TODO launch your RCP

    return null;
  }
}
greg-449
  • 109,219
  • 232
  • 102
  • 145