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

Key bindings

The association between a command and the key combinations that should invoke the command is called a key binding Plug-ins can define key bindings along with commands in the org.eclipse.ui.bindings extension point. From our InfoView example:


The sequence attribute for a key binding defines the key combination that is used to invoke a command. As long as our InfoView context is active, we will try and execute the InfoView edit command when the user chooses CTRL+O and the scheme is set to org.eclipse.ui.examples.contributions.scheme. The mapping of M1 to CTRL is described in the extension point description for org.eclipse.ui.bindings.

The contextId indicates what active context this key binding will be active in. More information on defining contexts declaratively and activating them programmatically can be found in Contexts. In this case, this key binding will be active when the org.eclipse.ui.examples.contributions.view.context context is active.

In our InfoView we have code called from the end of createPartControl(Composite):

	private static final String VIEW_CONTEXT_ID = "org.eclipse.ui.examples.contributions.view.context"; //$NON-NLS-1$
	 * Activate a context that this view uses. It will be tied to this view
	 * activation events and will be removed when the view is disposed.
	private void activateContext() {
		IContextService contextService = (IContextService) getSite()

As mentioned in org.eclipse.ui.handlers this context will be active only when the InfoView part is active. It will also be deactivated when the InfoView part is disposed.

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