I'm using Eclipse 4.2 with compatibility layer to reuse existing part for my RCP application.
I want to reuse New from File menu and Run menu in my RCP application, so for that I opens EMF editor for Eclipse and its look like this:
But for New menu its showing something like this: org.eclipse.e4.model.application....
My application is look-like this (it is just the Java Script debugger with some extra features):
So how I can reuse those menus in my RCP application?
I think I understand what you are saying. You opened the E4 Live Editor on your Eclipse Juno, to get the commands for New and Run menu items so that you can reuse it in your own code?
If I am correct, then in E4 you can no longer use the default commands provided by Eclipse. You need to define your own commands. See here for details.
So if you try to add these commands via the .e4xmi file, then you must define your own commands with its own handlers.
There is a way out if you still wish to use the commands given by Eclipse and that will have to be done via the plugin.xml file. Since you said you are using the compatibility layer, you probably still have a lot of legacy code, and it might be ok to add these menu items via the plugin.xml. Although, once you do a hard migration, I believe Eclipse is trying to reduce the use of extensions in plugin.xml and in that case you will have to define your own commands.
So if you want to add these commands then you must do it via the extensions in the plugin.xml.
To add the New menu item, go to your
plugin.xml
, in the Extensions tab, addorg.eclipse.ui.menus
. Create a menucontribution with a locationURI ofmenu:org.eclipse.ui.main.menu
. Then you must add a menu and give it the labelFile
.This will add the menu
File
to your RCP. Then to this you must add theNew
command. In order to do this, you add a command to the File menu you just created. Once you add a command, in commandID you select Browse and look fororg.eclipse.ui.file.newQuickMenu
.So your plugin.xml will have the following code.