Package org.eclipse.e4.ui.bindings.keys
Class KeyBindingDispatcher
java.lang.Object
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher
Controls the keyboard input into the workbench key binding architecture. This allows key events
to be programmatically pushed into the key binding architecture -- potentially triggering the
execution of commands. It is used by the e4 Workbench
to listen for events on the
Display
.
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
A display filter for handling key bindings. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
executeCommand
(ParameterizedCommand parameterizedCommand, Event trigger) Performs the actual execution of the command by looking up the current handler from the command manager.generatePossibleKeyStrokes
(Event event) Generates any key strokes that are near matches to the given event.final KeySequence
An accessor for the filter that processes key down and traverse events on the display.boolean
void
void
setContext
(IEclipseContext context)
-
Constructor Details
-
KeyBindingDispatcher
public KeyBindingDispatcher()
-
-
Method Details
-
generatePossibleKeyStrokes
Generates any key strokes that are near matches to the given event. The first such key stroke is always the exactly matching key stroke.- Parameters:
event
- The event from which the key strokes should be generated; must not benull
.- Returns:
- The set of nearly matching key strokes. It is never
null
, but may be empty.
-
executeCommand
public final boolean executeCommand(ParameterizedCommand parameterizedCommand, Event trigger) throws CommandException Performs the actual execution of the command by looking up the current handler from the command manager. If there is a handler and it is enabled, then it tries the actual execution. Execution failures are logged. When this method completes, the key binding state is reset.- Parameters:
parameterizedCommand
- The command that should be executed; should not benull
.trigger
- The triggering event; may benull
.- Returns:
true
if there was a handler;false
otherwise.- Throws:
CommandException
- if the handler does not complete execution for some reason. It is up to the caller of this method to decide whether to log the message, display a dialog, or ignore this exception entirely.
-
getKeyDownFilter
An accessor for the filter that processes key down and traverse events on the display.- Returns:
- The global key down and traverse filter; never
null
.
-
press
-
resetState
public void resetState() -
getBuffer
-
setContext
-