| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="en"> |
| <HEAD> |
| |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| |
| <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
| <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> |
| |
| <LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"></script> |
| <TITLE> |
| Schemes |
| </TITLE> |
| |
| <link rel="stylesheet" type="text/css" HREF="../book.css"> |
| </HEAD> |
| <BODY BGCOLOR="#ffffff"> |
| <h3>Schemes</h3> |
| |
| |
| <p><b>Schemes</b> are used to represent a general style or theme of |
| bindings. For example, the Workbench provides a "Default" scheme and |
| an "Emacs" scheme. Only one scheme is active at any |
| given time. End users control which one |
| is active using the |
| |
| <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'> |
| <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link"> |
| <b>General > Keys</b> </a> |
| |
| preference page. |
| </p> |
| |
| |
| <p><img src="images/keybindings.png" alt="" border="0"></p> |
| |
| |
| <p>From an implementation point of view, schemes are simply |
| named groupings of bindings. A scheme won't |
| accomplish anything on its own unless there are bindings associated with |
| it. </p> |
| |
| |
| <p>Let's look again at the workbench markup for <b><a href="../reference/extension-points/org_eclipse_ui_bindings.html">org.eclipse.ui.bindings</a> |
| </b>to find the binding definitions and how a scheme gets |
| associated with a binding.</p> |
| |
| |
| <pre>... |
| <key |
| sequence="Ctrl+S" |
| <b>commandId="org.eclipse.ui.file.save"</b> |
| <b>schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"></b> |
| </key> |
| ... |
| <key |
| sequence="Ctrl+X Ctrl+S" |
| <b>commandId="org.eclipse.ui.file.save"</b> |
| <b>schemeId="org.eclipse.ui.emacsAcceleratorConfiguration"></b> |
| </key> |
| ... |
| </pre> |
| |
| |
| <p>There are two different key bindings defined for the "org.eclipse.ui.file.save" |
| command. Note that each one has a different <b>schemeId</b> |
| defined. When the default scheme is active, the "Ctrl+S" |
| key binding will invoke the command. When the emacs scheme is |
| active, the sequence "Ctrl+X Ctrl+S" will invoke the command. </p> |
| |
| |
| <h4>Defining new schemes</h4> |
| |
| |
| <p>When your plug-in defines a binding, it will most likely assign it to an existing |
| scheme. However, your plug-in may want to define a |
| completely new style of scheme. If this is the case, you can define |
| a new type of scheme inside the <b><a href="../reference/extension-points/org_eclipse_ui_bindings.html">org.eclipse.ui.bindings</a></b> |
| definition. The workbench markup that defines the default and emacs key |
| configurations are shown below:</p> |
| |
| |
| <pre>... |
| <scheme |
| name="%keyConfiguration.default.name" |
| description="%keyConfiguration.default.description" |
| <b>id="org.eclipse.ui.defaultAcceleratorConfiguration"></b> |
| </scheme> |
| <scheme |
| name="%keyConfiguration.emacs.name" |
| parentId="org.eclipse.ui.defaultAcceleratorConfiguration" |
| description="%keyConfiguration.emacs.description" |
| <b>id="org.eclipse.ui.emacsAcceleratorConfiguration"></b> |
| </scheme> |
| ...</pre> |
| |
| |
| <p>Note that the <b>name</b> defined here is the one used in the preferences page in the list of |
| schemes.</p> |
| |
| |
| <h4>Activating a scheme </h4> |
| |
| |
| <p>The user controls the active scheme via the preferences page. |
| However, you can define the default active scheme as a part of the |
| "plugin_customization.ini" file. It is a preference:</p> |
| <pre> |
| org.eclipse.ui/KEY_CONFIGURATION_ID=org.eclipse.ui.defaultAcceleratorConfiguration |
| </pre> |
| |
| </BODY> |
| </HTML> |