Question: Regarding Eclipse plug-in development, what is the distinction between actions bars vs. menus, toolbars… when adding actions (in particular, to a Java Editor)?
I would like to add actions to a Java editor in Eclipse. I’m modeling the action after the ‘Change Method Signature’ action found in org.eclipse.jdt.ui . At first, I thought I would simply do the usual org.eclipse.ui.menus to add a menu item and that would be sufficient for my purposes. After perusing org.eclipse.jdt.ui.actions.RefactorActionGroup , I see that that the RefactorActionGroup class makes a point of placing the action in Actions Bars at method
public void fillActionBars(IActionBars)
The only discussion I found on the subject is in a 2006 article referencing Eclipse 3.1:
In Eclipse jargon, “action bar” is a catch-all term for menus,
toolbars, and status bars. The ActionBar Advisor handles creating
Actions within these locations. A plug-in can also contribute actions
dynamically with its plugin.xml file. See Listing 7 for the
implementation provided by the plug-in wizard and Table 7 for the
methods.
I’m confused though. Why does a code sample like org.eclipse.jdt.ui.actions.RefactorActionGroup deal with action bars if you’re going to explicitly add the actions as menus in any event? What is the relationship between Action Bars and other means of adding actions….
Thanks.
RefactorActionGroupis a legacy class (been around since 2.0),org.eclipse.ui.menuswas added much later. You should stick tomenusextension point.The usage of Action Groups is direct – each editor knows which actions it needs and asks corresponding action groups to create those. Whereas command and menu contributions through
org.eclipse.ui.menusextension point are dynamic – original editor/view doesn’t need to know anything about additions.