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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

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

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Workbench key bindings

The workbench defines many keyboard accelerators for invoking common actions with the keyboard.  In early versions of the platform, plug-ins could define the accelerator key to be used for their action when the action was defined.  However, this strategy can cause several problems:

  • Different plug-ins may define the same accelerator key for actions that are not related.
  • Plug-ins may define different accelerator keys for actions that are semantically the same.
  • Plug-ins may define accelerator keys that later conflict with the workbench (as the workbench is upgraded).

In order to alleviate these problems, the platform defines a configurable key binding strategy that is extendable by plug-ins.  It solves the problems listed above and introduces new capabilities:

  • The user can control which key bindings should be used.
  • Plug-ins can define key bindings that emulate other tools that may be familiar to users of the plug-in.
  • Plug-ins can define contexts for key bindings so that they are only active in certain situations.

The basic strategy is that plug-ins use commands to define semantic actions.  Commands are simply declarations of an action and its associated category.  These commands can then be associated with key bindings, actions, and handlers.  Commands do not define an implementation for the action.  When a plug-in defines an action for an editor, action set, or view, the action can specify that it is an implementation of one of these commands.  This allows semantically similar actions to be associated with the same command.

Once a command is defined, a key binding may be defined that references the command.  The key binding defines the key sequence that should be used to invoke the command.  A key binding may reference a scheme which is used to group key bindings into different named schemes that the user may activate via the Preferences dialog.

This is all best understood by walking through the workbench and looking at how commands and key bindings are declared.  We'll look at all of this from the point of view of defining key bindings for existing workbench actions. 

See the org.eclipse.ui.bindings section for simple binding scenarios and the Basic workbench extension points using commands section for using the new command framework.


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