Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Define Key Binding in Fragment(E4 RCP application. Eclipse Keppler)
Define Key Binding in Fragment [message #1709136] Thu, 24 September 2015 12:09 Go to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 38
Registered: July 2015
Member
Hi,

I am trying to define a key binding for an e4 fragment. I tried to add the following model fragment:
Element ID=org.eclipse.e4.ide.application
Featurename=bindingContexts

But unfortunately this produces an exception at application start. If I add the binding context as a child to a binding context of the application plug-in, it works.

What could I be doing wrong? Here is the stack trace:

org.eclipse.core.commands.common.NotDefinedException: Cannot get the parent identifier from an undefined context. my-application.bindingcontext.myKeyBindings
	at org.eclipse.core.commands.contexts.Context.getParentId(Context.java:201)
	at org.eclipse.e4.ui.bindings.internal.ContextSet$CComp.getLevel(ContextSet.java:48)
	at org.eclipse.e4.ui.bindings.internal.ContextSet$CComp.compare(ContextSet.java:37)
	at org.eclipse.e4.ui.bindings.internal.ContextSet$CComp.compare(ContextSet.java:1)
	at java.util.TimSort.countRunAndMakeAscending(Unknown Source)
	at java.util.TimSort.sort(Unknown Source)
	at java.util.Arrays.sort(Unknown Source)
	at java.util.ArrayList.sort(Unknown Source)
	at java.util.Collections.sort(Unknown Source)
	at org.eclipse.e4.ui.bindings.internal.ContextSet.<init>(ContextSet.java:76)
	at org.eclipse.e4.ui.bindings.internal.BindingTableManager.createContextSet(BindingTableManager.java:90)
	at org.eclipse.e4.ui.bindings.internal.BindingTableManager.addTable(BindingTableManager.java:50)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.defineBindingTable(BindingProcessingAddon.java:165)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.defineBindingTables(BindingProcessingAddon.java:151)
	at org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon.init(BindingProcessingAddon.java:100)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:877)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:119)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:333)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:267)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:186)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:49)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:276)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:144)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Re: Define Key Binding in Fragment [message #1722346 is a reply to message #1709136] Thu, 04 February 2016 09:02 Go to previous messageGo to next message
Jani Simomaa is currently offline Jani SimomaaFriend
Messages: 3
Registered: February 2016
Junior Member
I'm having the same issue when defining a BindingContext in fragment.e4xmi. I tried with the following approaches:

Extended Element ID : org.eclipse.e4.legacy.ide.application
Feature Name : bindingContexts 


and

Extended Element ID : org.eclipse.ui.contexts.dialogAndWindow
Feature Name : bindingContexts 


Both of these produce the same stack trace than above. Is it even possible to define a BindingContext in a fragment?
Re: Define Key Binding in Fragment [message #1728882 is a reply to message #1709136] Fri, 08 April 2016 09:01 Go to previous messageGo to next message
Florian Dunz is currently offline Florian DunzFriend
Messages: 4
Registered: August 2014
Junior Member
Hi,

i can see that this thread is already a few month old but i'm having the exact same issue here as well. Are there any answers or new information on this topic yet? Help would be appreciated as i've tried a lot of things already.
Re: Define Key Binding in Fragment [message #1739479 is a reply to message #1709136] Tue, 02 August 2016 09:45 Go to previous messageGo to next message
Daniel Raap is currently offline Daniel RaapFriend
Messages: 2
Registered: July 2016
Junior Member
If you want to define a new BindingContext you have to add it to the rootContext of the application. The feature bindingContext defines the active contexts in that container (defined in MBindings). Took me also some hours to find that field.

[Updated on: Tue, 02 August 2016 09:46]

Report message to a moderator

Re: Define Key Binding in Fragment [message #1760498 is a reply to message #1739479] Thu, 27 April 2017 17:54 Go to previous message
Mike Foxhoven is currently offline Mike FoxhovenFriend
Messages: 1
Registered: April 2017
Junior Member
Here are the steps I took to solve this problem:

First, in the Application.e4xmi file, add a Binding Context as a Subcontext to one of the predefined Binding Contexts. (I created a Subcontext of org.eclipse.ui.context.window (In Windows))

Then, do the following in the fragment.e4xmi file:

  • Add a model fragment with Extended Element ID == <Subcontext ID from Application.e4xmi> and Feature Name == children
  • Under this children model fragment, create a Binding Context
  • Add a model fragment with Extended Element ID == org.eclipse.e4.ide.application and Feature Name == bindingTables
  • Under this bindingTables model fragment, create a Binding Table with the Binding Context ID created in the children model fragment
  • Under this Binding Table, add key bindings

Lastly, in the part descriptor of the fragment.e4xmi file, add the Binding Context from the children model fragment to the Binding Contexts list.
Previous Topic:Word wrap missing in 4.7?
Next Topic:How to use 'BeanProperties' without warnings
Goto Forum:
  


Current Time: Wed Sep 26 14:16:42 GMT 2018

Powered by FUDForum. Page generated in 0.02552 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top