I'm in the middle of converting a Eclipse 2.x based
application to Eclipse 3.1. We have a number
of places where we are making dynamic contributions to menus programmatically
instead of defining things in plugin.xml files. I wasn't on the project
when this was designed so don't ask me for the exact reasoning behind the
code. The best I've gotten when asked was that the functionality to
determine contributions based on selected objects, etc was not enough in
2.1. Anyway...It seems that the isVisible() method of
ActionContributionItem has changed to:
return super.isVisible() &&
isCommandActive();
Our code
doesn't take into account defining a Command object for each action. This causes and error to be
logged the first time isVisible() is called. What is the proper way to define
command for dynamically created actions?
It seems when I attempt to lookup a command a CommandWrapper object is returned
which does not have public access. Therefore I can't get access to the
underlying Command object to define it. All other places that have such access
seem to be related to creating commands based off of plugin.xml which isn't what I
want.
Finally if
anyone could point out any examples in other parts of Eclipse (the
jdt possibly?) where actions are
being dynamically created it would be
appreciated. I'd like to rewrite the mess I've inherited in a more correct
manner.
Scott