How to show dynamic Command based on perspective in eclipse-rcp, does not work on toolbar and main menu
Tech-Today

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
b.) add new definition name it: onOpenPerspective
c.) right click definition and select "with", variable = activeWorkbenchWindow.activePerspective
d.) right click with and select "equals", value = perspective id
3.) Now for example you want to show a Command on your toolbar when you open a perspective x
a.) in the plugin.xml's Extension tab add org.eclipse.ui.menu
b.) select new->toolbar, set the location URI to toolbar:org.eclipse.ui.main.toolbar
c.) right click the toolbar and select new->toolbar again, id should be unique
d.) right click the second toolbar select new->command
e.) under command select visibleWhen
f.) under visibleWhen select reference and set the definitionId=onValidationPerspective
Note: onValidationPerspective is the one we have defined in the org.eclipse.core.expressions.definition





- How To Install Eclipse Plugin Using Available Sites And Eclipse Marketplace
This tutorial will teach us how to install eclipse plugins such as svn, egit, etc using available sites and eclipse marketplace. Note that I've done this on windows using eclipse-jee-juno. Installing eclipse plugins using available sites: 1.) To install...

- 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 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...

- 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"....

- Eclipse-rcp Shows A Blank Perspective When Adding View Dynamically And Overriding The Applicationworkbenchadvisor's Initialize Method
How to recreate the problem: 1.) create a new Hello World plugin project in eclipse rcp 2.) add extension org.eclipse.ui.views in plugin.xml->Extensions 3.) right click the extension and select New->view 4.) enter an id and a class name 5.) right...



Tech-Today








.