Adding "standard" menu items to Eclipse RCP application? [message #1113603] |
Sat, 21 September 2013 07:25  |
Eclipse User |
|
|
|
Hello,
I'm currently working on my first real (3.x) RCP application (only worked on plug-ins before) and I struggle with a problem in my main menu bar. The menu bar in my application is currently empty, but I want almost all of the more general menu commands which are offered by Eclipse itself, for example "File -> New", "File -> Save", "Edit -> Copy", "Window -> Open Perspective" and so on.
What is the recommended way of adding these commands to an RCP application? Do I really have to go to my plugin.xml and add them all manually one-by-one?
Thanks,
Alan
|
|
|
Re: Adding "standard" menu items to Eclipse RCP application? [message #1113633 is a reply to message #1113603] |
Sat, 21 September 2013 08:33  |
Eclipse User |
|
|
|
Hi,
I just figured it out. Basically all one has to do to get all default IDE actions is to:
- Create a custom WorkbenchAdvisor
- Create a custom WorkbenchWindowAdvisor and return it in WorkbenchAdvisor#createWorkbenchWindowAdvisor
- In the custom WorkbenchWindowAdvisor, use this:
@Override
public ActionBarAdvisor createActionBarAdvisor(final IActionBarConfigurer configurer) {
return new WorkbenchActionBuilder(configurer);
}
I know, the WorkbenchActionBuilder is actually an internal class with discouraged access, but it works and does *exactly* what I want.
If someone knows of a better way to accomplish this without referring to an internal class, plase let me know.
Alan
|
|
|
Powered by
FUDForum. Page generated in 0.03338 seconds