eclipse-efx / efxclipse-rt

Eclipse Public License 1.0
28 stars 29 forks source link

Not possible to detach a part via drag and drop in e4 JavaFx RCP apps #256

Closed vogella closed 6 years ago

vogella commented 6 years ago

In an e4 JavaFX RCP application it seems currently not possible to detach an editor via drag and drop. This is possible with the SWT Renderer and it would be nice if the fx DndAddon could support the same.

To test:

Create a JavaFX application which support drag and drag DnD a part to a space outside of the application -> nothing happens

tomsontom commented 6 years ago

This is an experimental feature you can launch with -Ddetachdrag.enabled=true in the VM-Properties - I guess we should prompt this with the 4.0 release as the default.

vogella commented 6 years ago

Thanks @tomsontom

In a quick test this works but it creates a InjectionException:

!ENTRY org.eclipse.equinox.event 4 0 2018-11-09 14:09:17.544 !MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET] {ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@502f4c01 (elementId: null, tags: [], contributorURI: null) (widget: org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl@1b3f6cf6, renderer: org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer@1d540ef6, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null), Widget=org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl@1b3f6cf6, org.eclipse.e4.data={ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@502f4c01 (elementId: null, tags: [], contributorURI: null) (widget: org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl@1b3f6cf6, renderer: org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer@1d540ef6, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null), AttName=selectedElement, EventType=SET, Widget=org.eclipse.fx.ui.workbench.renderers.fx.DefStackRenderer$StackWidgetImpl@1b3f6cf6, NewValue=de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart=org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@58a40ea5 (tags: [COMPONENT_EXPLORER], contributorURI: platform:/plugin/de.ituvsoft.mogena.ui.ng.plugin.rcp) (widget: org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer$PartImpl@721a5a51, renderer: org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer@7d7d1e4d, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (contributionURI: bundleclass://de.ituvsoft.mogena.ui.ng.plugin.rcp.ui/de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart, object: de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart@1cf6681c, context: PartImpl (de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart) Context, variables: [], label: Komponenten, iconURI: platform:/plugin/de.ituvsoft.mogena.ui.ng.plugin.rcp/images/assets/explorer.gif, tooltip: null, dirty: false, closeable: false, description: null)}, AttName=selectedElement, NewValue=de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart=org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl@58a40ea5 (tags: [COMPONENT_EXPLORER], contributorURI: platform:/plugin/de.ituvsoft.mogena.ui.ng.plugin.rcp) (widget: org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer$PartImpl@721a5a51, renderer: org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer@7d7d1e4d, toBeRendered: true, onTop: false, visible: true, containerData: , accessibilityPhrase: null) (contributionURI: bundleclass://de.ituvsoft.mogena.ui.ng.plugin.rcp.ui/de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart, object: de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart@1cf6681c, context: PartImpl (de.ituvsoft.mogena.ui.ng.plugin.rcp.parts.MProjectNavigatorPart) Context, variables: [], label: Komponenten, iconURI: platform:/plugin/de.ituvsoft.mogena.ui.ng.plugin.rcp/images/assets/explorer.gif, tooltip: null, dirty: false, closeable: false, description: null), EventType=SET} to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@7cd9d30f !STACK 0 org.eclipse.e4.core.di.InjectionException: Unable to process "PartPopupMenuServiceImpl.part": no actual value was found for the argument "MPart". at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:489) at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:480) at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:126) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:412) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:331) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:190) at org.eclipse.fx.ui.workbench.renderers.fx.internal.PartPopupMenuServiceFunction.compute(PartPopupMenuServiceFunction.java:28) at org.eclipse.e4.core.contexts.ContextFunction.compute(ContextFunction.java:42) at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:62) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:269) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:235) at org.eclipse.e4.core.internal.contexts.EclipseContext.handleReparent(EclipseContext.java:510) at org.eclipse.e4.core.internal.contexts.EclipseContext.setParent(EclipseContext.java:433) at org.eclipse.fx.ui.workbench.renderers.base.Util.setParentContext(Util.java:121) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.fixContextHierarchy(BaseRenderer.java:933) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.handleSelectedElement(BaseStackRenderer.java:430) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer$2.handleEvent(BaseStackRenderer.java:122) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40) at org.eclipse.fx.ui.controls.internal.FXThreadSynchronizeImpl.syncExec(FXThreadSynchronizeImpl.java:109) at org.eclipse.fx.ui.workbench.fx.internal.UISynchronizeImpl.syncExec(UISynchronizeImpl.java:51) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:196) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:174) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:277) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:1) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:725) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:244) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:323) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:631) at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:445) at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:1) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:725) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:244) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:323) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:631) at org.eclipse.fx.ui.workbench.renderers.base.BasePerspectiveRenderer.handleWindowAdd(BasePerspectiveRenderer.java:85) at org.eclipse.fx.ui.workbench.renderers.base.BasePerspectiveRenderer$1.handleEvent(BasePerspectiveRenderer.java:62) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40) at org.eclipse.fx.ui.controls.internal.FXThreadSynchronizeImpl.syncExec(FXThreadSynchronizeImpl.java:109) at org.eclipse.fx.ui.workbench.fx.internal.UISynchronizeImpl.syncExec(UISynchronizeImpl.java:51) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:196) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:305) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.detach(ModelServiceImpl.java:784) at org.eclipse.fx.ui.workbench.renderers.base.addons.DnDAddon.handleDetach(DnDAddon.java:152) at org.eclipse.fx.ui.workbench.renderers.base.addons.DnDAddon.droppedHandler(DnDAddon.java:132) at org.eclipse.fx.ui.workbench.renderers.fx.internal.DnDSupport.handleDropped(DnDSupport.java:151) at org.eclipse.fx.ui.controls.tabpane.skin.DnDTabPaneSkinHookerFullDrag.efx_dropped(DnDTabPaneSkinHookerFullDrag.java:410) at org.eclipse.fx.ui.controls.tabpane.skin.DnDTabPaneSkinHookerFullDrag.handleMouseReleased(DnDTabPaneSkinHookerFullDrag.java:387) at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Scene$MouseHandler.process(Scene.java:3757) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) at com.sun.glass.ui.View.notifyMouse(View.java:937) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748)

tomsontom commented 6 years ago

a simple fix would be to make the MPart a constructor parameter as it would not change for an EMenuService instance ever but I'd first like to understand why this happens when we reparent a IEclipseContext.

vogella commented 6 years ago

Any update on this issue?

tomsontom commented 6 years ago

You can work around by registering a higher ranked IContextFunction who create a fixed version (just make the MPart a constructor parameter) of PartPopupMenuServiceFunction

tomsontom commented 6 years ago

I'm unable to reproduce this problem with the current 3.x head - so i guess i need a reproduceable sample to see why it works for me and fails for you

tomsontom commented 6 years ago

I've now made the injected value a constructor parameter so the exception shown will not happen anymore

vogella commented 6 years ago

Thanks, Tom for the fix. What is the night update site for efclipse-rt component so that I can test the fix?

tomsontom commented 6 years ago

http://download.eclipse.org/efxclipse/runtime-nightly/site/

vogella commented 6 years ago

Switching from 3.4.1 to 3.5 results in the following exception during startup:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2018-11-23 10:42:33.335 !MESSAGE Unable to create class 'org.eclipse.fx.ui.workbench.base.internal.EFX_ResourceHandler' from bundle '590' !STACK 0 org.eclipse.e4.core.di.InjectionException: Unable to process "EFX_ResourceHandler.context": no actual value was found for the argument "IEclipseContext". at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:476) at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:467) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:113) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:56) at org.eclipse.fx.ui.workbench.base.AbstractE4Application.loadApplicationModel(AbstractE4Application.java:420) at org.eclipse.fx.ui.workbench.base.AbstractE4Application.createE4Workbench(AbstractE4Application.java:267) at org.eclipse.fx.ui.workbench.fx.E4Application.initE4Workbench(E4Application.java:358) at org.eclipse.fx.ui.workbench.fx.E4Application$1.run(E4Application.java:215) at org.eclipse.fx.ui.workbench.fx.E4Application.jfxStart(E4Application.java:253) at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.start(DefaultJFXApp.java:57) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748) Exception in Application start method

tomsontom commented 6 years ago

well this means something is completely messed up how could this Injection ever fail?

public class EFX_ResourceHandler implements IModelResourceHandler {
  @Inject
  private IEclipseContext context;

Make sure you clear all caches PDE thinks it has to create - the switch from 3.4 to 3.5 involves an the base platform hence maybe your cache holds invalid bundles, ...

vogella commented 6 years ago

Cleaning the bundle did indeed help.

The new stack trace I get it the following:_

org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in org.eclipse.fx.ui.workbench.renderers.fx.internal.PartPopupMenuServiceImpl at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:421) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:331) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:190) at org.eclipse.fx.ui.workbench.renderers.fx.internal.PartPopupMenuServiceFunction.compute(PartPopupMenuServiceFunction.java:28) at org.eclipse.e4.core.contexts.ContextFunction.compute(ContextFunction.java:42) at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:62) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:269) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:280) at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:235) at org.eclipse.e4.core.internal.contexts.EclipseContext.handleReparent(EclipseContext.java:510) at org.eclipse.e4.core.internal.contexts.EclipseContext.setParent(EclipseContext.java:433) at org.eclipse.fx.ui.workbench.renderers.base.Util.setParentContext(Util.java:121) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.fixContextHierarchy(BaseRenderer.java:933) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.handleSelectedElement(BaseStackRenderer.java:430) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer$2.handleEvent(BaseStackRenderer.java:122) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40) at org.eclipse.fx.ui.controls.internal.FXThreadSynchronizeImpl.syncExec(FXThreadSynchronizeImpl.java:109) at org.eclipse.fx.ui.workbench.fx.internal.UISynchronizeImpl.syncExec(UISynchronizeImpl.java:51) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:196) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:174) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:277) at org.eclipse.fx.ui.workbench.renderers.base.BaseStackRenderer.doProcessContent(BaseStackRenderer.java:1) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:725) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:244) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:323) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:631) at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:445) at org.eclipse.fx.ui.workbench.renderers.base.BaseWindowRenderer.doProcessContent(BaseWindowRenderer.java:1) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.processContent(BaseRenderer.java:725) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:244) at org.eclipse.fx.ui.workbench.fx.PartRenderingEngine.createGui(PartRenderingEngine.java:323) at org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer.engineCreateWidget(BaseRenderer.java:631) at org.eclipse.fx.ui.workbench.renderers.base.BasePerspectiveRenderer.handleWindowAdd(BasePerspectiveRenderer.java:85) at org.eclipse.fx.ui.workbench.renderers.base.BasePerspectiveRenderer$1.handleEvent(BasePerspectiveRenderer.java:62) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40) at org.eclipse.fx.ui.controls.internal.FXThreadSynchronizeImpl.syncExec(FXThreadSynchronizeImpl.java:109) at org.eclipse.fx.ui.workbench.fx.internal.UISynchronizeImpl.syncExec(UISynchronizeImpl.java:51) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:196) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424) at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:304) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.detach(ModelServiceImpl.java:784) at org.eclipse.fx.ui.workbench.renderers.base.addons.DnDAddon.handleDetach(DnDAddon.java:152) at org.eclipse.fx.ui.workbench.renderers.base.addons.DnDAddon.droppedHandler(DnDAddon.java:132) at org.eclipse.fx.ui.workbench.renderers.fx.internal.DnDSupport.handleDropped(DnDSupport.java:151) at org.eclipse.fx.ui.controls.tabpane.skin.DnDTabPaneSkinHookerFullDrag.efx_dropped(DnDTabPaneSkinHookerFullDrag.java:410) at org.eclipse.fx.ui.controls.tabpane.skin.DnDTabPaneSkinHookerFullDrag.handleMouseReleased(DnDTabPaneSkinHookerFullDrag.java:387) at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Scene$MouseHandler.process(Scene.java:3757) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) at com.sun.glass.ui.View.notifyMouse(View.java:937) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748)

tomsontom commented 6 years ago

without a reproduceable sample I'm unabel to fix this problem.

tomsontom commented 6 years ago

ok now I can the important part is that the EMenuService is a field/method injection

public class Sample {

    @Inject
    private EMenuService menuService;

    public Sample() {

    }

Can you confirm that you use field injection? A workaround for now would be to use Constructor-Injection

vogella commented 6 years ago

Example part:

package app.app.themes;

import javax.annotation.PostConstruct; import javax.inject.Inject;

import org.eclipse.e4.ui.services.EMenuService;

import javafx.stage.Stage;

public class OverviewPart { @Inject EMenuService menuService;

@Inject
public OverviewPart() {

}

@PostConstruct
public void postConstruct(Stage parent) {
    System.out.println("hllo");
}

}

vogella commented 6 years ago

Ah, didn't see your reply before posting the example. Yes, I use field injection.

tomsontom commented 6 years ago

The same problem with EMenuService happens in an e4-swt application so this is a bug in the IEclipseContext-reparent code of org.eclipse.e4.core.contexts

vogella commented 6 years ago

@tomsontom can you please post the link to the platform bug?

tomsontom commented 6 years ago

there is no platform bug yet as I just discovered this myself

tomsontom commented 6 years ago

https://bugs.eclipse.org/bugs/show_bug.cgi?id=541498