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
Answertopia.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

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.

...
<key
      sequence="Ctrl+S"
      commandId="org.eclipse.ui.file.save"
      schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
...

There is our friend org.eclipse.ui.file.save.  Recall our hypothetical action definition:

<extension point = "org.eclipse.ui.actionSets">
	   <actionSet id="com.example.actions.actionSet"
		   label="Example Actions"
		   visible="true">
		   <action id="com.example.actions.action1"
			   menubarPath="additions"
			   label="Example Save Action"
			   class="org.example.actions.ExampleActionDelegate"
			   definitionId="org.eclipse.ui.file.save">
		   </action>
		   ...
	   </actionSet>
</extension>

The sequence attribute for a key binding defines the key combination that is used to invoke a command.  So, it follows that when our example action set is active, our save action will be invoked when the user chooses Ctrl+S.

Likewise, when the workbench SaveAction is active, the same key combination will invoke it instead, since the workbench uses the same command id for its SaveAction.

To complete the example, we need to understand what the configuration is all about.


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