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

Bug 339994

Summary: [Compatibility] Cannot add view with visible=false to the shared area
Product: [Eclipse Project] e4 Reporter: Thomas Kratz <eiswind>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3 CC: remy.suen
Version: unspecified   
Target Milestone: 4.1 M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
ModeledPageLayout patch v1 none

Description Thomas Kratz CLA 2011-03-15 06:31:32 EDT
Build Identifier: e4.1 M6

If I try to add a view with visible=false to my perspective 
<perspectiveExtension
         targetID="de.eiswind.mango.client.search.ui.SearchPerspective">
      <view
            closeable="true"
            id="de.eiswind.paris.client.core.ui.user.UserView"
            minimized="false"
            moveable="true"
            ratio="1.0"
            relationship="stack"
            relative="org.eclipse.ui.editorss"
            showTitle="true"
            standalone="false"
            visible="false">
      </view>

I get always 

org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException: The selected element org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl@4f7a95c6 (elementId: de.eiswind.paris.client.core.ui.user.UserView, tags: null, contributorURI: null, transientData: null) (widget: null, renderer: null, toBeRendered: false, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (closeable: false) must be visible in the UI presentation
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:828)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:108)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:78)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.inject(ContextInjectionFactory.java:72)
	at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1177)
	at org.eclipse.ui.internal.Workbench.getActiveWorkbenchWindow(Workbench.java:1151)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.updateActiveShell(WorkbenchSourceProvider.java:932)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider.getCurrentState(WorkbenchSourceProvider.java:133)
	at org.eclipse.ui.internal.services.WorkbenchSourceProvider$6.handleEvent(WorkbenchSourceProvider.java:692)
	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:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1058)
	at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1647)
	at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2134)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4508)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1610)
	at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2058)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4957)
	at org.eclipse.swt.internal.win32.OS.BringWindowToTop(Native Method)
	at org.eclipse.swt.widgets.Decorations.bringToTop(Decorations.java:230)
	at org.eclipse.swt.widgets.Shell.open(Shell.java:1214)
	at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.postProcess(WBWRenderer.java:591)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:536)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:597)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:809)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:768)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:87)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:542)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:524)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at de.eiswind.paris.client.core.Application.start(Application.java:45)
	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:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.IllegalArgumentException: The selected element org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl@4f7a95c6 (elementId: de.eiswind.paris.client.core.ui.user.UserView, tags: null, contributorURI: null, transientData: null) (widget: null, renderer: null, toBeRendered: false, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (closeable: false) must be visible in the UI presentation
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:164)
	at org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout.stackView(ModeledPageLayout.java:591)
	at org.eclipse.ui.internal.PerspectiveExtensionReader.processView(PerspectiveExtensionReader.java:256)
	at org.eclipse.ui.internal.PerspectiveExtensionReader.processExtension(PerspectiveExtensionReader.java:102)
	at org.eclipse.ui.internal.PerspectiveExtensionReader.readElement(PerspectiveExtensionReader.java:339)
	at org.eclipse.ui.internal.registry.RegistryReader.readElements(RegistryReader.java:144)
	at org.eclipse.ui.internal.registry.RegistryReader.readExtension(RegistryReader.java:155)
	at org.eclipse.ui.internal.registry.RegistryReader.readRegistry(RegistryReader.java:176)
	at org.eclipse.ui.internal.PerspectiveExtensionReader.extendLayout(PerspectiveExtensionReader.java:66)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3104)
	at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:526)
	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)
	... 49 more




Reproducible: Always

Steps to Reproduce:
1. see bug
2.
3.
Comment 1 Remy Suen CLA 2011-03-15 08:06:52 EDT
Created attachment 191204 [details]
ModeledPageLayout patch v1

We were arbitrarily setting the stack's selected element as the view that was being contributed to the stack. This is not a valid operation if the view isn't supposed to be rendered on the window. The fix is to check for this and not change the stack if the element being added isn't visible.
Comment 2 Remy Suen CLA 2011-03-15 08:07:54 EDT
(In reply to comment #1)
> Created attachment 191204 [details]
> ModeledPageLayout patch v1

Fix released to CVS HEAD.

Thanks as always for the bug reports, Thomas!