Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Fragment/Perspective/Placeholder problem
Fragment/Perspective/Placeholder problem [message #1065848] Thu, 27 June 2013 14:49 Go to next message
G. Smith is currently offline G. Smith
Messages: 12
Registered: August 2012
Junior Member
Hello all. I have three projects in my workspace:
- MainApp (contains Application.e4xmi with a TrimmedWindow [id="MainAppWindow"] and PerspectiveStack [id="MainPerspectiveStack"])
- PartFragment (contributes a Part [id="MySharedPartFromFragment"] to the Shared Elements of MainAppWindow)
- PerspectiveFragment (imports MySharedPartFromFragment and contributes a Perspective [id="SnippetPerspectiveFromFragment"] to the Snippets section of the MainApp with a PlaceHolder that references MySharedPartFromFragment)

In MainApp I have a processor that copies all Perspective Snippets into the MainPerspectiveStack (via modelService.cloneSnippet).

After MainApp starts SnippetPerspectiveFromFragment does exist in the model as a child of MainPerspectiveStack. The problem I'm having is that when I switch to the SnippetPerspectiveFromFragment perspective I see a blank MPart where MySharedPartFromFragment should be.

index.php/fa/15396/0/

Here's the xmi of SnippetPerspectiveFromFragment:
      <children xsi:type="advanced:Perspective" xmi:id="_eQH4lN9WEeKrsvusXvNxVg" elementId="SnippetPerspectiveFromFragment" contributorURI="platform:/plugin/PerspectiveFragment" label="SnippetPerspectiveFromFragment">
        <tags>PerspectiveTemplate</tags>
        <children xsi:type="basic:PartSashContainer" xmi:id="_eQH4ld9WEeKrsvusXvNxVg" elementId="perspectivefragment.partsashcontainer.0" contributorURI="platform:/plugin/PerspectiveFragment">
          <children xsi:type="basic:PartStack" xmi:id="_eQH4lt9WEeKrsvusXvNxVg" elementId="perspectivefragment.partstack.0" contributorURI="platform:/plugin/PerspectiveFragment" containerData="10000" selectedElement="_eQH4l99WEeKrsvusXvNxVg">
            <children xsi:type="advanced:Placeholder" xmi:id="_eQH4l99WEeKrsvusXvNxVg" elementId="perspectivefragment.placeholder.0" contributorURI="platform:/plugin/PerspectiveFragment">
              <ref xsi:type="basic:Part" href="platform:/plugin/PerspectiveFragment/PerspectiveFragment.e4xmi#_7qsI4N9FEeKti89ripk2GQ"/>
            </children>
          </children>
        </children>
      </children>


And what it looks like in the live editor:
index.php/fa/15397/0/

Any help is appreciated. I have attached the three projects.
  • Attachment: MainApp.PNG
    (Size: 19.68KB, Downloaded 575 times)
  • Attachment: appModel1.PNG
    (Size: 5.26KB, Downloaded 562 times)
  • Attachment: MainApp.zip
    (Size: 30.06KB, Downloaded 40 times)
Re: Fragment/Perspective/Placeholder problem [message #1066567 is a reply to message #1065848] Wed, 03 July 2013 04:11 Go to previous messageGo to next message
Daniel Rolka is currently offline Daniel Rolka
Messages: 4
Registered: March 2013
Junior Member
Probably the issue is connected to the "empty" perspective in the "MainApp/Application.e4xmi/Application/Windows/Trimmed Window/Controls/Perspective Stack" perspective stack. After removing it from model it works for me. I attach the fixed version of the MainApp project

Daniel
Re: Fragment/Perspective/Placeholder problem [message #1067377 is a reply to message #1066567] Mon, 08 July 2013 09:14 Go to previous messageGo to next message
G. Smith is currently offline G. Smith
Messages: 12
Registered: August 2012
Junior Member
Thanks for taking the time to look at this, Daniel.

I downloaded your modified MainApp, but I still see the blank MPart after setting the SelectedElement of MainPerspectiveStack to SnippetPerspectiveFromFragment:
index.php/fa/15505/0/

I also see an exception in the console when switching to SnippetPerspectiveFromFragment:
!ENTRY org.eclipse.equinox.event 4 0 2013-07-08 08:25:11.520
!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@4c56666d
!STACK 0
java.lang.IllegalArgumentException: 
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:47)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElementsRecursive(ModelServiceImpl.java:286)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findPerspectiveElements(ModelServiceImpl.java:385)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findPlaceholderFor(ModelServiceImpl.java:591)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:551)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:543)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.switchPerspective(PartServiceImpl.java:504)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:124)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:66)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4688)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	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:80)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:135)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.eSet(PerspectiveStackImpl.java:198)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1071)
	at org.eclipse.emf.edit.command.SetCommand.doExecute(SetCommand.java:722)
	at org.eclipse.emf.edit.command.AbstractOverrideableCommand.execute(AbstractOverrideableCommand.java:125)
	at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
	at org.eclipse.emf.databinding.edit.internal.EMFEditValueProperty.doSetValue(EMFEditValueProperty.java:45)
	at org.eclipse.core.databinding.property.value.ValueProperty.setValue(ValueProperty.java:86)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.doSetValue(SimplePropertyObservableValue.java:108)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:60)
	at org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue.doSetValue(DetailObservableValue.java:138)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:60)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.setValue(DecoratingObservableValue.java:105)
	at org.eclipse.core.databinding.UpdateValueStrategy.doSet(UpdateValueStrategy.java:500)
	at org.eclipse.core.databinding.ValueBinding$3$1.run(ValueBinding.java:199)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:147)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:151)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:169)
	at org.eclipse.core.databinding.ValueBinding$3.run(ValueBinding.java:190)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:147)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:151)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:169)
	at org.eclipse.core.databinding.ValueBinding.doUpdate(ValueBinding.java:154)
	at org.eclipse.core.databinding.ValueBinding.access$4(ValueBinding.java:143)
	at org.eclipse.core.databinding.ValueBinding$1.handleValueChange(ValueBinding.java:46)
	at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:71)
	at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:127)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.fireValueChange(DecoratingObservableValue.java:57)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.handleValueChange(DecoratingObservableValue.java:95)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue$1.handleValueChange(DecoratingObservableValue.java:69)
	at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:71)
	at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:127)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:76)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.notifyIfChanged(SimplePropertyObservableValue.java:124)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.access$2(SimplePropertyObservableValue.java:116)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$1$1.run(SimplePropertyObservableValue.java:70)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:147)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:151)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:169)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$1.handleEvent(SimplePropertyObservableValue.java:67)
	at org.eclipse.core.databinding.property.NativePropertyListener.fireChange(NativePropertyListener.java:68)
	at org.eclipse.jface.internal.databinding.viewers.SelectionChangedListener.selectionChanged(SelectionChangedListener.java:37)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
	at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:128)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1241)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:239)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:233)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:403)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
	at org.eclipse.e4.tools.emf.liveeditor.OpenLiveDialogHandler.run(OpenLiveDialogHandler.java:60)
	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.invokeUsingClass(InjectorImpl.java:243)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:285)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:504)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:555)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:376)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:322)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:84)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
	at org.eclipse.swt.widgets.Widget.wmSysKeyDown(Widget.java:2576)
	at org.eclipse.swt.widgets.Control.WM_SYSKEYDOWN(Control.java:5385)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4690)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:331)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
	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)


This exception seems to be caused by PartServiceImpl.switchPerspective(...) because it is calling ModelServiceImpl.bringToTop(MPart[elementID="MySharedPartFromFragment"]). Since MySharedPartFromFragment's eContainer is a ModelFragmentsImpl we get a null MWindow from the getTopLevelWindowFor(MPart[elementID="MySharedPartFromFragment"]) call from bringToTop(...). I'm guessing this is a bug, but maybe it is by design???
  • Attachment: MainApp1.png
    (Size: 18.05KB, Downloaded 377 times)
Re: Fragment/Perspective/Placeholder problem [message #1067780 is a reply to message #1067377] Wed, 10 July 2013 10:41 Go to previous messageGo to next message
Daniel Rolka is currently offline Daniel Rolka
Messages: 4
Registered: March 2013
Junior Member
Do you use the latest Kepler release or other version? I'am asking since I have double checked it with Kepler and it works for me. So after removing the empty perspective from the model (see the 'snapshot2.png' attachment) and running the application I get the valid part (see the 'snapshot.png' attachment)

Daniel
  • Attachment: snapshot.png
    (Size: 35.80KB, Downloaded 47 times)
  • Attachment: snapshot2.png
    (Size: 38.94KB, Downloaded 41 times)
Re: Fragment/Perspective/Placeholder problem [message #1067786 is a reply to message #1065848] Wed, 10 July 2013 10:55 Go to previous messageGo to next message
G. Smith is currently offline G. Smith
Messages: 12
Registered: August 2012
Junior Member
Thanks for the response, Daniel. I am using Kepler Release build id 20130614-0229. I also see the problem in Juno SR2.

Your attached screenshot (snapshot.png) is exactly what I see when I first run the application. I've been seeing that exact screenshot all along- even with a non-empty Perspective stack (as attached in my first post). The issue happens when I run the application, open the live editor, and switch the Selected Element of MainPerspectiveStack to the SnippetPerspectiveFromFragment Perspective.

This screenshot is the initial state (same as yours):
index.php/fa/15557/0/

This screenshot is the bad state after I switch perspectives to SnippetPerspectiveFromFragment:
index.php/fa/15558/0/
Re: Fragment/Perspective/Placeholder problem [message #1097342 is a reply to message #1067786] Thu, 29 August 2013 11:21 Go to previous messageGo to next message
seymour yee is currently offline seymour yee
Messages: 1
Registered: August 2013
Junior Member
Hi Smith,

How about the status of this problem?

I have the same problem and googled your post. My result is the same as yours. It looks like the DI is not working. But no any further clue.

Seymour

Re: Fragment/Perspective/Placeholder problem [message #1097413 is a reply to message #1097342] Thu, 29 August 2013 13:28 Go to previous messageGo to next message
G. Smith is currently offline G. Smith
Messages: 12
Registered: August 2012
Junior Member
seymour yee wrote on Thu, 29 August 2013 11:21
Hi Smith,

How about the status of this problem?

I have the same problem and googled your post. My result is the same as yours. It looks like the DI is not working. But no any further clue.

Seymour



Nope, no solution as of yet. As a workaround I just removed all my Placeholders from the Perspective defined in a Snippet. I still don't understand why it isn't working correctly. If you figure it out please let me know!
Re: Fragment/Perspective/Placeholder problem [message #1102394 is a reply to message #1067786] Thu, 05 September 2013 14:20 Go to previous message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

It sounds like there is a potential issue with the live model editor. Have you tried these steps with a different application (say the IDE)? (Outcome?)

JD
Previous Topic:Compatibility with JSR-107 caching annotations?
Next Topic:e4 application Compilation impossible with tycho
Goto Forum:
  


Current Time: Thu Jul 24 09:01:08 EDT 2014

Powered by FUDForum. Page generated in 0.01831 seconds