Jump to: navigation, search

Difference between revisions of "FAQ Where can I find a list of existing action group names?"

 
(See Also:)
 
Line 29: Line 29:
 
[[FAQ_How_do_I_add_actions_to_the_main_menu%3F]]
 
[[FAQ_How_do_I_add_actions_to_the_main_menu%3F]]
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
{{Template:FAQ_Tagline}}

Latest revision as of 14:01, 30 May 2013

Eclipse menus and toolbars are divided into groups to ensure that related actions appear together. These group names need to be clearly specified to allow plug-ins to contribute their actions to menus defined by other plug-ins. Group names can be specified either programmatically or declaratively in a plugin.xml file. For groups that are defined programmatically, the convention is to create an interface called I*ActionConstants containing constants for all the plug-in’s group names. This serves to cement the group names as API, ensuring that they will stay consistent across releases of Eclipse. The base platform defines all its groups in IWorkbenchActionConstants, and the text infrastructure defines ITextEditorActionConstants. A similar pattern is used for other plug-ins, such as IJavaEditorActionConstants for the Java editor.


The other way to specify group names is in plugin.xml. Most plug-ins use this approach, making it fairly easy to track down the group names. Simply open the plugin.xml of the plug-in you want to contribute your action to and look for the definition of the menu element under an actionSet extension. These IDs are also treated as API, so they generally won’t change from release to release.


See Also:

FAQ_What_is_an_action_set?

FAQ_How_do_I_add_actions_to_the_main_menu?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.