Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331126

Summary: [Compatibility] NPE in perspective code when adding standalone view relative to a view
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3    
Version: 1.0   
Target Milestone: 4.1 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
ModeledPageLayout patch v1 none

Description Remy Suen CLA 2010-11-25 09:37:36 EST
public void createInitialLayout(IPageLayout layout) {
  layout.addView(IPageLayout.ID_BOOKMARKS, IPageLayout.RIGHT, 0.25f,
      IPageLayout.ID_EDITOR_AREA);
  layout.addStandaloneView(IPageLayout.ID_OUTLINE, false,
      IPageLayout.TOP, .3f, IPageLayout.ID_BOOKMARKS);
}

Caused by: java.lang.IllegalArgumentException: The added object 'org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl@10641064 (elementId: null, tags: null) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (horizontal: false)' is not assignable to 'org.eclipse.e4.ui.model.application.ui.basic.MStackElement'
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl$1.validate(ElementContainerImpl.java:114)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl$1.validate(ElementContainerImpl.java:1)
	at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:443)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUnique(NotifyingListImpl.java:393)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:377)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:345)
	at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.insert(ModeledPageLayout.java:444)
	at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.insert(ModeledPageLayout.java:523)
	at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.insertView(ModeledPageLayout.java:344)
	at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.addStandaloneView(ModeledPageLayout.java:177)
	at b.perspectives.RelEngPerspective.createInitialLayout(RelEngPerspective.java:11)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:2635)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.openPerspective(ShowPerspectiveHandler.java:146)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.openOther(ShowPerspectiveHandler.java:118)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.execute(ShowPerspectiveHandler.java:57)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
Comment 1 Remy Suen CLA 2010-11-25 09:42:53 EST
Created attachment 183853 [details]
ModeledPageLayout patch v1
Comment 2 Remy Suen CLA 2010-11-25 09:43:31 EST
(In reply to comment #1)
> Created an attachment (id=183853) [details]
> ModeledPageLayout patch v1

Fix released to CVS HEAD.