How to Open a View Using Command in Eclipse Rcp
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 t...
https://www.czetsuyatech.com/2009/12/java-eclipse-rcp-opening-a-view-using-command.html
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:
1.) By consulting the eclipse-rcp documentation, this is how I done it:
2.) Opening an eclipse-rcp view in code:
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:
1.) By consulting the eclipse-rcp documentation, this is how I done it:
//execute command IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IViewPart view = window.getActivePage().findView("your.view.class.id"); IHandlerService service = (IHandlerService) view.getSite().getService(IHandlerService.class); service.executeCommand("your.application.command.id", null);Please take note of the findView and executeCommand parameters, which are IDs.
2.) Opening an eclipse-rcp view in code:
//open view IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { //any view in your application window.getActivePage().showView(you.view.class.id); } catch (PartInitException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
2 comments
great, that helped, thanks!
The brown Text is difficult to spot on the brown background :P
Post a Comment