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.

有帮助吗?

解决方案

RefactorActionGroup is a legacy class (been around since 2.0), org.eclipse.ui.menus was added much later. You should stick to menus extension 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.menus extension point are dynamic - original editor/view doesn't need to know anything about additions.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top