Opening a View Using Showviewhandler in Eclipse Rcp
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 Ex...
https://www.czetsuyatech.com/2021/07/java-eclipse-rcp-open-a-view-using-showviewhandler.html
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"
Post a Comment