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

Setting a global action handler

A plug-in contributes a retargetable action for a view or editor part by implementing an IAction and registering it as a global action handler with the part's action bars.  In views, this is usually done at the time that the part creates its actions and controls. For editors see Retargetable editor actions. The name of the retargeted action (as defined in IWorkbenchActionConstants) is used to specify which action the handler is intended for.  The following shows how the workbench task list view registers its handler for the PROPERTIES action.

public void createPartControl(Composite parent) {

	// Add global action handlers.

The properties action is created in the local method makeActions:

void makeActions() {
	// properties
	propertiesAction = new TaskPropertiesAction(this, "properties"); 

That's all that is needed.  Your action will be run when the user chooses the action from the workbench menu bar or tool bar and your view or editor is active.  The workbench handles the details of ensuring that the retargeted action is always associated with the currently active view. The same applies to editor actions supplied through the EditorActionBarContributor.

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