There are lot of good blogs explaining how to add a menu item in one of the menus of Eclipse. What I will focus on is how to enable/disable them according to specific editors. I explained in my previous blog, how to enable/disable context on editor switching. On that understanding if we enable/disable menu items on active contexts then our work is done.
This is how a typical menu item is coded in plugin.xml
Use enableWhen tag to enable it on a particular condition. Use with tag to specify the variable on which it should be dependent. For our case variable will be 'activeContexts'. We will iterate all the activeContexts and specify what context to match.This is how a typical menu item is coded in plugin.xml
Take a look at complete exmaple below:
We also have to define command like this:
And a handler for our command
0 comments:
Post a Comment