Skip to content

Commit 92c270e

Browse files
committed
Restructure Help Page for Keys Preference Page
Move a big portion of the text into a new concept document
1 parent a182a3d commit 92c270e

File tree

4 files changed

+128
-120
lines changed

4 files changed

+128
-120
lines changed

eclipse.platform.common/bundles/org.eclipse.platform.doc.user/concepts/accessibility/keyboardshortcuts.htm

Lines changed: 13 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -14,127 +14,20 @@ <h1>Keys</h1>
1414
'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
1515
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="command link"> <strong>General &gt; Keys</strong></a>
1616
preference page. Within Eclipse, key strokes and key sequences are assigned to invoke particular commands.</p>
17-
<h2>Key Strokes, Key Sequences, and Key Bindings</h2>
18-
<p>A 'key stroke' is the pressing of a key on the keyboard, while optionally holding down one or more of these
19-
modifier keys: <code>Ctrl</code>, <code>Alt</code> (<code></code> on macOS), <code>Shift</code>, or <code></code>
20-
(only on macOS.) For example, holding down <code>Ctrl</code> then pressing <code>A</code> produces the key stroke
21-
<code>Ctrl+A</code>. The pressing of the modifier keys themselves do not constitute key strokes.</p>
22-
<p>A 'key sequence' is one or more key strokes. Traditionally, Emacs assigned two or three key stroke key sequences
23-
to particular commands. For example, the normal key sequence assigned to <code>Close All</code> in emacs is
24-
<code>Ctrl+X Ctrl+C</code>. To enter this key sequence, one presses the key stroke <code>Ctrl+X</code> followed by
25-
the key stroke <code>Ctrl+C</code>. While Eclipse supports key sequences of arbitrary lengths, it is recommended that
26-
keyboard shortcuts be four key strokes in length (or less).</p>
27-
<p>A 'key binding' is the assignment of a key sequence to a command.</p>
28-
<h2>Schemes</h2>
29-
<p>A 'scheme' is a set of bindings. Eclipse includes two schemes:</p>
30-
<ul>
31-
<li>Default</li>
32-
<li>Emacs (extends Default)</li>
33-
</ul>
34-
<p>The <em>Default</em> scheme contains a general set of bindings, in many cases recognizable as traditional key
35-
sequences for well known commands. For instance, <code>Ctrl+A</code> is assigned to <code>Select All</code>, and
36-
<code>Ctrl+S</code> is assigned to <code>Save</code>.</p>
37-
<p>The <em>Emacs</em> scheme contains a set of key bindings familiar to users of Emacs. For instance, <code>Ctrl+X
38-
H</code> is assigned to <code>Select All</code>, and <code>Ctrl+X S</code> is assigned to <code>Save</code>.</p>
39-
<p>It is important to understand why the <em>Emacs</em> scheme says that it 'extends Default'. The <em>Emacs</em>
40-
scheme is not a complete set of bindings like the <em>Default</em> scheme. Rather, it borrows from the
41-
<em>Default</em> scheme where possible, only defining explicit Emacs-style bindings where they vary from the
42-
<em>Default</em> scheme. Generally, only well known commands like <code>Select All</code>, <code>Save</code>, etc.
43-
have specific Emacs key sequences associated with them.</p>
44-
<p>Choose the scheme you are most comfortable with by changing the 'Scheme' setting on the keys preference page. If
45-
you choose the <em>Default</em> scheme, all <em>Emacs</em> bindings are ignored. If you choose the <em>Emacs</em>
46-
scheme, explicit Emacs-style key sequence assignments take precedence over any conflicting assignments in the
47-
<em>Default</em> scheme.</p>
48-
<h2>Contexts</h2>
49-
<p>Key bindings can vary based on the current context of Eclipse.</p>
50-
<p>Sometimes the active part might be a Java file editor, for instance, where a different set of key sequence
51-
assignments may be more appropriate than if the active part was an html file editor. As a specific example, typically
52-
<code>Ctrl+B</code> is assigned to <code>Build</code> in a context such as Java file editing, while
53-
<code>Ctrl+B</code> is assigned to <code>Make Text Bold</code> in a context such as HTML file editing. This context
54-
is usually determined by the active part, but it can be influenced by the active window or dialog as well. If the
55-
active part does not choose a particular context, the workbench will set the active context to <em>In
56-
Windows</em>.</p>
57-
<p>Eclipse includes a number of different contexts. Some examples are:</p>
58-
<ul>
59-
<li>In Dialogs and Windows</li>
60-
<li>In Windows (extends In Dialogs and Windows)</li>
61-
<li>In Dialogs (extends In Dialogs and Windows)</li>
62-
<li>Editing Text (extends In Windows)</li>
63-
<li>Editing Java Source (extends Editing Text)</li>
64-
<li>Debugging (extends In Windows)</li>
65-
<li>Debugging Java (extends Debugging)</li>
66-
<li>In Console</li>
67-
<li>Editing Ant buildfiles<br>
68-
<br></li>
69-
</ul>
70-
<p>Much like configurations, contexts can extend other contexts. For example, the <em>Editing Java Source</em>
71-
context borrows key bindings from the <em>Editing Text</em> context, which in turn borrows key bindings from the
72-
<em>In Windows</em> context.</p>
73-
<p>Note: It is not recommended to promote a key binding to a context which it extends. For example, it is not
74-
recommended to move an <em>Editing Text</em> key binding to the <em>In Dialogs and Windows</em> context. This may
75-
have unexpected results.</p>
76-
<p>It is possible for some key bindings to work in dialogs. Those key bindings are assigned to the <em>In Dialogs and
77-
Windows</em> context. One example of such a key binding is the key binding for "cut". It is possible to change these
78-
key bindings. For example, it is possible to have Ctrl+X as cut in dialogs, but Ctrl+W as cut in windows.</p>
79-
<h2>Platform and Locale</h2>
80-
<p>Key bindings also vary by platform and locale. On the macOS platform, <code>⌘+S</code> is assigned to
81-
<code>Save</code>, instead of the usual <code>Ctrl+S</code>. On Chinese locales (zh), <code>Alt+/</code> is assigned
82-
to <code>Content Assist</code>, instead of the usual <code>Ctrl+Space</code>.</p>
83-
<p>The current platform and locale is determined when Eclipse starts, and does not vary over the course of an Eclipse
84-
instance.</p>
8517
<h2>Customizing Key Bindings</h2>
86-
<p>With multi-stroke key sequences, schemes, and contexts, there are a lot of things to keep in mind when customizing
87-
key bindings. To make things easier, all key customization is done on the <a class="command-link" href=
18+
<p>All key customization is done on the <a class="command-link" href=
8819
'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
8920
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="command link"> <b>General &gt; Keys</b></a> preference
9021
page.</p>
91-
<p>For example we want to bind <b>CTRL+5</b> to the About command. By default the keys preference page will show
92-
you all possible keybindings. You can see the About command listed in the Help category. You can bind the command by
93-
putting focus in the Binding text box and pressing CTRL and 5 like you would if you were executing the command.</p>
94-
<p>When you type CTRL+5 you have created a binding for About. The right-most column will indicate that this is a user
95-
binding by displaying a <b>U</b>. If there was a conflict with another key, this column would also display a
96-
<b>C</b>. The binding will be in the default context, "In Windows". You can now use the When combo box to change the
97-
key binding context (for example, to move this binding to "Editing Text").</p>
98-
<p>If you wanted to add a second key binding to About, you can use the <b>Copy Command</b> button to create a second
99-
command entry for you to bind another key to. If you want to delete a binding, you can either use the <b>Remove
100-
Binding</b> button or simply give focus to the Binding text box and hit <b>Backspace</b>.</p>
101-
<h2>The Dynamic Nature of Key Bindings</h2>
102-
<p>Key bindings are provided by plug-ins, and in Eclipse, plug-ins can be added or removed. This can cause key
103-
bindings declared by these plug-ins to be added or removed. Eclipse stores custom key bindings in a way to compensate
104-
for this. Consider the example above where <code>CTRL+6</code> was assigned to <code>About</code> in the
105-
<em>Default</em> scheme. Say you install a new plug-in that assigns <code>CTRL+6</code> to a particular command.
106-
Eclipse will preserve your assignment to <code>About</code>.</p>
107-
<h2>Conflict Resolution</h2>
108-
<p>There are only a finite number of simple, common key strokes available to assign to a multitude of commands. We
109-
have seen that scheme, context, platform, and locale all partition key sequence assignments into domains where they
110-
don't conflict with one another. Consider the case for <code>Ctrl+B</code> above if contexts did not exist. One
111-
plug-in would assign <code>Ctrl+B</code> to <code>Build</code>, the other plug-in would assign <code>Ctrl+B</code> to
112-
<code>Make Bold Text</code>. How would Eclipse properly resolve this conflict?</p>
113-
<p>Though conflicts are drastically reduced by employing the above mechanisms, they can still occur. Two plug-ins,
114-
independent of one another, could assign the same key sequence to different commands with the same context, scheme,
115-
platform, and locale. Consider if a plug-in assigned <code>Ctrl+F4</code> in the <em>In Windows</em> context and
116-
<em>Default</em> scheme to one of its commands. This directly conflicts with Eclipse assigning <code>Ctrl+F4</code>
117-
to the close command in the same context and scheme.</p>
118-
<p>This is a conflict. It wouldn't be proper to invoke both commands, nor would it be proper to simply choose one of
119-
the two commands to receive the key stroke. We pop up the Key Assist Dialog with the conflicting commands and allow
120-
the user to select one. The Key Assist Dialog is the same dialog that displays command choices for multiple key
121-
stroke key bindings.</p>
122-
<p>If the user sets a keybinding and creates a conflict, the conflicting bindings will be displayed in the conflicts
123-
list. This can be used to navigate between conflicting keybindings so that they can be changed.</p>
124-
<p>These types of conflicts can be resolved by explicitly assigning the key sequence to one of the commands, or
125-
remove it from the other.</p>
126-
<p>Another type of conflict can be caused by multiple-key stroke key sequences. For example, in the <em>Emacs</em>
127-
scheme, there are many multiple-key stroke key sequences beginning with the key stroke <code>Ctrl+X</code>.
128-
<code>Ctrl+X K</code> is assigned to <code>Close</code>. <code>Ctrl+X H</code> is assigned to <code>Select
129-
All</code>.</p>
130-
<p>As previously mentioned, the <em>Emacs</em> scheme borrows key bindings from the <em>Default</em> scheme. In the
131-
default scheme, <code>Ctrl+X</code> is assigned to <code>Cut</code>. Though the <em>Emacs</em> scheme doesn't
132-
explicitly redefine <code>Ctrl+X</code>, pressing <code>Ctrl+X</code> is required as part of many of its key
133-
bindings. In the <em>Emacs</em> scheme, when one presses <code>Ctrl+X</code>, one is half way to entering one of many
134-
possible assigned key sequences. One would not expect the <code>Cut</code> action to be invoked at this time.</p>
135-
<p>For this type of conflict, the rule is that the <code>Ctrl+X</code> key sequence assigned to <code>Cut</code>
136-
would be ignored. Otherwise, it would not be possible to complete many of the key bindings in the <em>Emacs</em>
137-
configuration.</p>
22+
<p>For example we want to bind <code>CTRL+5</code> to the <em>About</em> command. By default the keys preference page will show
23+
you all possible keybindings. You can see the <em>About</em> command listed in the <em>Help</em> category. You can bind the command by
24+
putting focus in the Binding text box and pressing <code>CTRL</code> and <code>5</code> like you would if you were executing the command.</p>
25+
<p>When you type <code>CTRL+5</code> you have created a binding for the <em>About</em> command. The right-most column will indicate that this is a user
26+
binding by displaying a <em>U</em>. If there was a conflict with another key, this column would also display a
27+
<em>C</em>. The binding will be in the default context <em>In Windows</em>. You can now use the <em>When</em> combo box to change the
28+
key binding context.</p>
29+
<p>You can use the <em>Copy Command</em> button to create a second command entry for you to bind another key to. To remove a binding use
30+
the <em>Unbind Command</em> button, or simply give focus to the <em>Binding</em> text box and hit <code>Backspace</code>.</p>
13831
<h2>Export Key Bindings</h2>
13932
<p>The bindings can be exported to a CSV file. For this purpose, press the button <strong>Export CSV ...</strong>.
14033
This will launch a file dialog, where you can specify the location of the export file. Note: The export file is for
@@ -143,15 +36,15 @@ <h2>Show Key Bindings When Command Is Invoked</h2>
14336
<p>For learning purposes, presentations or screen casts it is very helpful to show the corresponding key binding when
14437
a command is invoked. Whenever the command is invoked (via the keyboard or via menu clicks), the key binding, the
14538
command's name and description are shown on the screen.</p>
146-
<p><img src="../../images/show_key_bindings.png" alt="Key binding of triggered command shown on screen" style=
147-
"width: 40%"></p>
14839
<p>This can be activated via the check boxes in the <em>Show key binding when command is invoked</em> group on the
14940
<a class="command-link" href=
15041
'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
15142
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="command link"> <strong>General &gt; Keys</strong></a>
15243
preference page. To toggle this setting quickly, the command 'Toggle Show Key Bindings' can be used (e.g. via the
15344
Find Actions dialog).</p>
154-
<h3 class="related">Related Concepts</h3><a href="accessmain.htm">Accessibility features in Eclipse</a><br>
45+
<h3 class="related">Related Concepts</h3>
46+
<a href="../concepts-keys.htm">Keys</a><br>
47+
<a href="accessmain.htm">Accessibility features in Eclipse</a><br>
15548
<a href="../../tasks/tkeybindings.htm">Changing the key bindings</a><br>
15649
<a href="../help.htm">Help</a>
15750
<h3 class="related">Related Reference</h3><a href="fontsandcolors.htm">Font and color settings in Eclipse</a>

0 commit comments

Comments
 (0)