Learn Dynamic Command in Eclipse Rcp Menu
1.) Using the HelloWorld project template, add org.eclipse.core.expressions in your application's plugin.xml's Dependencies tab. 2.)...
https://www.czetsuyatech.com/2021/07/java-eclipse-rcp-dynamic-command-in-menu-item.html
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
 
 

 



 
 
 
2 comments
Thank you so much!!!! You're such a big help :)
Thanks!!! :D
Post a Comment