Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » [E4AP] NPE during loading of workbench.xmi
[E4AP] NPE during loading of workbench.xmi [message #911441] Tue, 11 September 2012 11:51 Go to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 347
Registered: December 2010
Location: Germany
Senior Member
After resolving my problem described in this thread, I stumbled on a new issue:

When the workbenach.xmi is loaded, an NPE is thrown:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-09-11 17:33:18.756
!MESSAGE Exception occurred while rendering: org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@1a4c5b4 (elementId: testapp.stack.right, tags: [], contributorURI: platform:/plugin/de.emsw.gosa.product.testapp) (widget: CTabFolder {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer@1e2161d, toBeRendered: true, onTop: false, visible: true, containerData: 10000, accessibilityPhrase: null)
!STACK 0
java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showTab(LazyStackRenderer.java:156)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1024)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:98)

Debugging the code reveals, that the NPE is caused, because the element (the Part that is to be shown) does not have a parent (eContainer), so element.getParent() returns null.

This seems to be the case for all parts that are added through a fragment. I have created a simple testcase to confirm the issue.

1) Start the application with the testapp.product in de.emsw.gosa.product.testapp.
2) Close the application
3) Start the application again and DO NOT clean the configuration, so workbench.xmi gets loaded

I will also create a bug report for this shortly. For now, I would be most gratefull, if someone could give me hints to find a workaround. I have a demo coming up, and it would be great if I could show how the application model is persisted and restored.

Greetings
Christoph

P.S. I am using org.eclipse.e4.ui.workbench.renderers.swt_0.10.1.v20120523-1955.jar, but I also confirmed the bug with the current sources on git://git.eclipse.org/gitroot/platform/eclipse.platform.ui: 0.10.2
Re: [E4AP] NPE during loading of workbench.xmi [message #911447 is a reply to message #911441] Tue, 11 September 2012 11:59 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 347
Registered: December 2010
Location: Germany
Senior Member
Bug 389282
Re: [E4AP] NPE during loading of workbench.xmi [message #913006 is a reply to message #911447] Fri, 14 September 2012 11:27 Go to previous message
Christoph Keimel is currently offline Christoph Keimel
Messages: 347
Registered: December 2010
Location: Germany
Senior Member
I suprisingly had some extra time today, so I could do some debugging. I found that the problem arrises when elements are replaced with elements from fragments. If the objectToBeReplaced is also the selectedElement of an MElementContainer, the call to EcoreUtil.replace will leave the selectedElement without a parent (because it is still a reference to the objectToBeReplaced which has been removed from the container).

I have created a new Bug in "Platform" (rather than e4) and added a proposed fix (in case anybody has the same issue):
Bug 389624
Previous Topic:Where to find E4Designer(E4 Workbench Designer
Next Topic:Wizard "Eclipse 4 Application Project" possible new options
Goto Forum:
  


Current Time: Tue Sep 02 10:04:22 EDT 2014

Powered by FUDForum. Page generated in 0.02683 seconds