How to open a view using the eclipse-rcp's plugin.xml's Extension Tab. Passing the view ID as a command parameter.

1.) Create a new HelloWorld RCP project
2.) Open the plugin.xml file and click the Extension tab
3.) Add the extension org.eclipse.ui.commands
a.) right click and select New->command
b.) set the command's id to command.showView
c.) set the defaultHandler to org.eclipse.ui.handlers.ShowViewHandler
4.) Add a parameter to the command
a.) right click the command.showView
b.) select New->commandParameter
c.) set its id to org.eclipse.ui.views.showView.viewId
d.) name=viewId
e.) values=org.eclipse.ui.internal.registry.ViewParameterValues

5.) Now we need to create the menu
a.) add the extension org.eclipse.ui.menus
b.) right click and select New->menuContribution
c.) sets the locationURI=menu:org.eclipse.ui.main.menu
6.) Attach the command to the menu
a.) right click the menuContribution select New->command
b.) sets the commandId=org.irri.jicis.administration.command.showView
c.) label=Show View
7.) Add a parameter to the menu
a.) right click the "Show View" command, select New->parameter
b.) set the name=org.eclipse.ui.views.showView.viewId
c.) value=an existing view id (I assume you already know how to create a view with a view id)
hint: add an extension org.eclipse.ui.views
How to open a view using the eclipse-rcp's plugin.xml's Extension Tab. Passing the view ID as a command parameter. How to open a view using the eclipse-rcp's plugin.xml's Extension Tab. Passing the view ID as a command parameter. Reviewed by Edward Legaspi on Monday, February 22, 2010 Rating: 5

No comments:

Powered by Blogger.