Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-dev] Problem With Editor Keybindings

Hello folks,

I'm hoping someone can shed some light on an issue I am having with
keybinding sequences in a custom editor we provide in our product.

The situation is as follows:
We have a custom editor that extends o.e.ui.part.EditorPart. The
editor, when created, activates a context and instantiates an Action.
The action, in turn, sets it's definition id at creation. We also
define the commandId in the plugin.xml and a keybind 'Shift+S' when the
editor's context is active. 

I have created a simple plugin that provides an editor for .foo file
extensions and is intended to print a message to the workspace log when
the editor is active and Shift+S is pressed as a generic example: 
https://github.com/jcrwilliams/brokenKeybindPlugin

To my understanding, when 'Shift+S' is pressed, the active contexts
should be consulted for whether the command is handled by any of them
and delegate accordingly. I do not see my action triggering - a
breakpoint in the run() function is not hit and the expected behavior
does not occur. When I enable tracing in the UI, I see the following:

| main | 2021-03-31 13:33:23.506 | org.eclipse.e4.ui.workbench | /trace
| org.eclipse.e4.ui.internal.workbench.WorkbenchLogger | trace | 162 |
Command
ParameterizedCommand(Command(com.example.testproject.myKeybindAction,My
Keybind Action,
		Do an action when a keybind is activated,
		Category(com.example.testproject.myCategory,My Test
Category,null,true),
		
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@515576b0,
		,,true),null), defined: true, handled: false in 
	context chain: WorkbenchContext -> TrimmedWindowImpl
(IDEWindow) Context -> PerspectiveImpl
(org.eclipse.jdt.ui.JavaPerspective) Context -> PartImpl
(org.eclipse.e4.ui.compatibility.editor)  removeOnHide
com.example.testproject.ui.editor (My Test Editor) Context |
| main | 2021-03-31 13:33:33.625 | org.eclipse.e4.ui.workbench | /trace
| org.eclipse.e4.ui.internal.workbench.WorkbenchLogger | trace | 162 |
Command exception for:
ParameterizedCommand(Command(com.example.testproject.myKeybindAction,My
Keybind Action,
		Do an action when a keybind is activated,
		Category(com.example.testproject.myCategory,My Test
Category,null,true),
		
org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@515576b0,
		,,true),null) in 
	context chain: WorkbenchContext -> TrimmedWindowImpl
(IDEWindow) Context -> PerspectiveImpl
(org.eclipse.jdt.ui.JavaPerspective) Context -> PartImpl
(org.eclipse.e4.ui.compatibility.editor)  removeOnHide
com.example.testproject.ui.editor (My Test Editor) Context |
org.eclipse.core.commands.NotHandledException: There is no handler to
execute for command com.example.testproject.myKeybindAction
	at
org.eclipse.core.commands.Command.executeWithChecks(Command.java:501)
	at
org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(Parame
terizedCommand.java:487)
	at
org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler
(HandlerServiceImpl.java:213)
	at
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(Key
BindingDispatcher.java:308)
	at
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDi
spatcher.java:584)
	at
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(Ke
yBindingDispatcher.java:653)
	at
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceB
indings(KeyBindingDispatcher.java:443)
	at
org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.hand
leEvent(KeyBindingDispatcher.java:96)
	at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at
org.eclipse.swt.widgets.Display.filterEvent(Display.java:1890)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1426)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1453)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1436)
	at
org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1475)
	at
org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:838)
	at
org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3943)
	at
org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:88
9)
	at
org.eclipse.swt.widgets.Tree.gtk_key_press_event(Tree.java:2351)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2293)
	at
org.eclipse.swt.widgets.Control.windowProc(Control.java:6760)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:4267)
	at
org.eclipse.swt.widgets.Display.windowProc(Display.java:6031)
	at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native
Method)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1527)
	at
org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method)
	at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4524)
	at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(Part
RenderingEngine.java:1157)
	at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java
:338)
	at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRe
nderingEngine.java:1046)
	at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workb
ench.java:155)
	at
org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java
:338)
	at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
551)
	at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplica
tion.java:152)
	at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.
java:203)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplica
tion(EclipseAppLauncher.java:134)
	at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ecli
pseAppLauncher.java:104)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java
:401)
	at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java
:255)
	at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMe
thodAccessorImpl.java:62)
	at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Dele
gatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
 |
| main | 2021-03-31 13:33:33.629 | org.eclipse.e4.ui.workbench | /trace
| org.eclipse.e4.ui.internal.workbench.WorkbenchLogger | trace | 162 | 
	Execution context: 
	context chain: WorkbenchContext -> TrimmedWindowImpl
(IDEWindow) Context -> PerspectiveImpl
(org.eclipse.jdt.ui.JavaPerspective) Context -> PartImpl
(org.eclipse.e4.ui.compatibility.editor)  removeOnHide
com.example.testproject.ui.editor (My Test Editor) Context
	Handler: null |
| main | 2021-03-31 13:33:33.629 | org.eclipse.e4.ui.workbench | /trace
| org.eclipse.e4.ui.internal.workbench.WorkbenchLogger | trace | 162 | 
	All active contexts: [org.eclipse.ui.contexts.window,
org.eclipse.jdt.ui.JavaActionSet,
org.eclipse.jdt.ui.JavaElementCreationActionSet,
org.eclipse.ui.contexts.dialogAndWindow,
org.eclipse.ui.cheatsheets.actionSet,
org.eclipse.ui.edit.text.actionSet.navigation,
org.eclipse.ui.actionSet.openFiles,
org.eclipse.ui.externaltools.ExternalToolsSet,
org.eclipse.mylyn.tasks.ui.navigation,
org.eclipse.ui.actionSet.keyBindings,
org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo,
org.eclipse.debug.ui.launchActionSet,
org.eclipse.eclemma.ui.CoverageActionSet,
org.eclipse.jdt.junit.JUnitActionSet, org.eclipse.ui.NavigateActionSet,
org.eclipse.ui.edit.text.actionSet.annotationNavigation,
com.example.testproject.editor.myContext,
org.eclipse.search.searchActionSet,
org.eclipse.text.quicksearch.actionSet,
org.eclipse.jdt.debug.ui.JDTDebugActionSet,
org.eclipse.debug.ui.breakpointActionSet] |


I see the context I defined in the list of active contexts, but it
doesn't appear in the context chain when the keybinding is looking for
a handler.

Have I configured something incorrectly? I was under the impression I
didn't need a handler explicitly defined if I associated the command
with a context.

Thanks, 

Jonathan



----------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

Back to the top