Tech-Today
Open a view in the eclipse-rcp's Extension tab using the ShowViewHandler class
Let's do this quick.
1.) Create a new HelloWorld Plug-in Project and name it CommandParameter.
2.) Open the plugin.xml and click the Extensions tab.
3.) In the All Extensions tab click the Add button and under the Extension Point Filter: search "view".
4.) Select org.eclipse.ui.views and click Finish.
5.) Repeat steps 3 and 4 and search for "command"->org.eclipse.ui.commands, "menu"->org.eclipse.ui.menu
Note: you should have the same screen as the attached: rcp_extnsion.jpg
6.) Create a new Command, by right clicking org.eclipse.ui.commands->New->command
a.) update the id to "showView"
b.) name to "Show View"
c.) click the "Browse" button in the defaultHandler textbox
d.) select "ShowViewHandler" (org.eclipse.ui.handlers.ShowViewHandler)
e.) right click the command "Show View" select New->commandParameter
e1.) update the id to "org.eclipse.ui.views.showView.viewId"
e2.) values to "org.eclipse.ui.internal.registry.ViewParameterValues"
7.) Create a view, right click org.eclipse.ui.views->New->view
a.) update the id to "showView"
b.) name to "Show View"
c.) click the class link, a popup will appear "New Java Class"
d.) don't change anything just hit the finish
Now you have a view
8.) Create a new menu, right click org.eclipse.ui.menus->New->menuContribution
a.) update the locationURI to "menu:org.eclipse.ui.main.menu"
b.) right click "menu:org.eclipse.ui.main.menu"->New->menu, set the label to "Show View"
c.) add command to menu by right clicking "Show View"->New->command, set the commandId to "showView"
c.) update the label to "Show View"
d.) add parameter to the command:
d1.) right click "Show View"->New->parameter
d2.) update the name to "org.eclipse.ui.views.showView.viewId"
d3.) value to our view id "showView"
-
Add Eclipse-rcp's Views Short List, Perspective Short List In The Org.eclipse.ui.menus Plugin Via Dynamic Compoundcontributionitem Class
Recently, I've encountered a problem wherein I wanted to display the eclipse-rcp's list of view, perspective etc using the extension org.eclipse.ui.menus. The problem can easily solved by the ApplicationActionBarAdvisor, see the code below: private...
-
How To Show Dynamic Command Based On Perspective In Eclipse-rcp, Does Not Work On Toolbar And Main Menu
1.) Using the HelloWorld project template, add org.eclipse.core.expressions in your application's plugin.xml's Dependencies tab. 2.) In the extension tab do the following: a.) add org.eclipse.core.expressions.definition, set its id to onValidationPerspective...
-
Menu Contribution Location In Eclipse-rcp
There are 3 main location where a menu can be added (Menu Codes): 1.) menu - menu:org.eclipse.ui.main.menu 2.) toolbar - toolbar:org.eclipse.ui.main.toolbar 3.) popup - popup:org.eclipse.ui.popup.any To add a menu: 1.) open plugin.xml 2.) go to extension...
-
Execute An Eclipse-rcp Command And Open An Eclipse-rcp View In Code
Objective: 1.) To execute an eclipse rcp command in code 2.) To open an eclipse rcp view in command Most of the time you will just use the extension tab in the plugin.xml but for those who chose to implement in code here's how they're done: Solution:...
-
How To Add And Enable A Menu Button Using The Eclipse Rcp Extension (by Code And Using The Plugin Ui Interface)
How to add and enable a menu button using the eclipse rcp extension (by code and using the plugin UI Interface) To learn eclipse-rcp, I keep on reading, try some tutorials available on the net. My favorite is this one: http://www.vogella.de/articles/RichClientPlatform/article.html,...
Tech-Today