Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page


We've just seen how editors can contribute their own actions to the workbench menus and tool bar when they become active.  The org.eclipse.ui.editorActions extension point allows a plug-in to add to the workbench menus and tool bar when another plug-in's editor becomes active.

In the readme example, the plug-in uses the editorActions extension point to contribute additional actions to the menu contributed by the readme editor. The definition in our plugin.xml should look pretty familiar by now.

    point = "org.eclipse.ui.editorActions">
	   <action id="org.eclipse.ui.examples.readmetool.ea1" 

Similar to a view action, the extension must specify the targetID of the editor to which it is contributing actions.  The action itself is very similar to a view action (id, label, icon, toolbarPath, ...), except that the specified class must implement IEditorActionDelegate and a definitionId can be specified to link this action to a Command specified by the org.eclipse.ui.commands extension, which is important for keybinding. See Associating actions to commands and org.eclipse.ui.commands for defining commands.

Note that a menu bar path is not specified in this markup.  Therefore, the action will appear in the workbench tool bar when the editor is active, but not in the workbench menu bar.  (See Menu and toolbar paths for a discussion of toolbar and menu paths.)

Sure enough, when the editor is active, we see our editor action on the tool bar next to the actions that were contributed by the editor itself.

Editor action appears next to original editor contributions in workbench toolbar

The readme tool supplies EditorActionDelegate to implement the action.  This class is very similar to the view action delegate we saw earlier.

public void run(IAction action) {

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire