I I build a eclipse RCP application via the new plug-in project wizard(with perspective). Then I run the application, and only some of the default menus showed, see the screenshot below. I want them all. Can anyone he me? enter image description here
I especially want the "Open projects from file system" item. I browsed the internet and found one possible solution, but I cannot achieve my goal. The solution is, add Action in ApplicationWorkbenchWindowAdvisor.java
, using ActionFactory.*
. But I counldn't find ActionFactory.OPEN_PROJECT
or anything like that. Thanks in advance.
There is no ActionFactory for this. "Open projects from file system" is contributed to the File menu by the org.eclipse.ui.ide
plug-in using the org.eclipse.ui.menus
extension point:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="menu:file?after=new.ext">
<command
commandId="org.eclipse.e4.ui.importer.openDirectory"
id="org.eclipse.e4.ui.importer.openDirectory.menu"
mnemonic="%importProjectsFromFolder_mnemonic"
style="push">
</command>
</menuContribution>
That says that the menu item is added to the file menu after a placeholder called new.ext
(and will not be added if that is not there).
You can added the correct placeholder in the ActionBarAdvisor class using
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
where menu
is the menu manager for the File menu.