Eclipse RCP Tutorial: Commonly-used Eclipse Workbench Extension Points

1. What is a Workbench?

The following diagram is from eclipse official site. In brief, when you open your eclipse, what you see is a workbench. It consists of a menu bar, a tool bar, a page which is composed by one or more views/editors.

2. Commonly Used Extension Points

The following are commonly or frequently used extension points of Workbench and their purposes.

  • org.eclipse.ui.views - add a view
  • org.eclipse.ui.viewActions - add an action under a view
  • org.eclipse.ui.editors - allows a user to edit an object(e.g. file), it is like a view, but can be opened multiple times.
  • org.eclipse.ui.editorActions - add action under an editor
  • org.eclipse.ui.popupMenus - add a popup menu. A popup menu is a memu shown by right-clicking. There are two types, one is popup for an object, the other is for popup in editor.
  • org.eclipse.ui.actionSets - use for adding menus, menu items, and tool bar items to the workbench menus and toolbar.
  • org.eclipse.ui.commands - declaration of a behaviour by id, then other plugins can use the command. It allows "define once, use everywhere".
  • org.eclipse.ui.menus - can associate with a command and place the command in the main menu, view dropdown menus, context menus, main toolbar, view toolbars, and various trim locations.
  • org.eclipse.ui.handlers - define handler for a command
  • org.eclipse.ui.bindings - bind shortcut key for a command

3. IActionDelegate interface

IActionDelegate is the interface for actions which are contributed via an extension point.

From its official Java doc:

This interface should be implemented by clients who need to contribute actions via an extension point. The workbench will generate a proxy action object on behalf of the plug-in to avoid having to activate the plug-in until the user needs it. If the action is performed the workbench will load the class that implements this interface and create what is called an action delegate object. Then the request, and all subsequent ones, are forwarded through the proxy action to the action delegate, which does the real work.

The following sub-interfaces are frequently used with the extension points above. Their purpose are summarized as follows:

org.eclipse.ui.IActionDelegate
++ IActionDelegate2
++ IEditorActionDelegate
-------- an editor-activated menu or tool bar
++ IObjectActionDelegate
-------- an object action that is contributed into a popup menu for a view or editor
++ IViewActionDelegate
-------- an action that is contributed into a view's local tool bar, pulldown menu, or popup menu
++ IWorkbenchWindowActionDelegate
-------- an action that is contributed into the workbench window menu or tool bar
++ IWorkbenchWindowPulldownDelegate
-------- a pulldown action that is contributed into the workbench window tool bar
++ IWorkbenchWindowPulldownDelegate2

With those extension points summary, and the resource on Eclipse Documentation, add an extension to a workbench is straightforward.

4. Reference reading

1. Basic Workbench Extension Points: eclipse official documentation site.
2. IActionDelegate Java Doc.
3. Contribute actions to workbench: corner article

Category >> Rich Client Platform(RCP)  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>

Leave a comment

*