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

Bug 359556

Summary: Dropping views in the editor area causes undesired behaviour
Product: [Eclipse Project] Platform Reporter: Dean Roberts <dean.t.roberts>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: emoffatt, remy.suen
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Dean Roberts CLA 2011-09-30 08:56:05 EDT
Steps to reproduce

1) Open Java perspective
2) Detach outline view
3) Open Debug perspective
4) Detach outline view
5) Re-attach outline view

Notice NPE.

If you detach different views in the two perspectives the re-attach works fine.  The problem only seems to happen when you detach the same view in each perspective.

Here is the stack trace I see:


!ENTRY org.eclipse.equinox.event 4 0 2011-09-30 08:51:08.026
!MESSAGE Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/children/ADD] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@5d7c5d7c
!STACK 0
java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.setStackVisibility(ModelServiceImpl.java:942)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.setStackVisibility(ModelServiceImpl.java:951)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.setStackVisibility(ModelServiceImpl.java:951)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.hideLocalPlaceholders(ModelServiceImpl.java:931)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.handleEvent(PartRenderingEngine.java:278)
	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.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4683)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:182)
	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:81)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:55)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:362)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:345)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.combine(ModelServiceImpl.java:512)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.insert(ModelServiceImpl.java:550)
	at org.eclipse.e4.ui.workbench.addons.dndaddon.SplitDropAgent.dock(SplitDropAgent.java:331)
	at org.eclipse.e4.ui.workbench.addons.dndaddon.SplitDropAgent.drop(SplitDropAgent.java:161)
	at org.eclipse.e4.ui.workbench.addons.dndaddon.DnDManager.finishDrag(DnDManager.java:222)
	at org.eclipse.e4.ui.workbench.addons.dndaddon.DnDManager.startDrag(DnDManager.java:200)
	at org.eclipse.e4.ui.workbench.addons.dndaddon.DnDManager$1$1.dragDetected(DnDManager.java:109)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:127)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:972)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:888)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:90)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:565)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:520)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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(NativeMethodAccessorImpl.java:79)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1407)
Comment 1 Dean Roberts CLA 2011-09-30 09:12:47 EDT
It looks like this might be some kind of parenting problem.  Here are different steps that do not produce the NPE but cause the reattached view to be reattached in both perspectives ... which is bogus.

If this problem has a different cause we should create a new defect, but I'm guessing the cause of the two behaviors is the same.

1) Open Java perspective
2) Detach outline view
3) Open Debug perspective
4) Detach outline view
5) Reattach outline view in Debug perspective
6) Switch to Java perspective

Notice that the outline view is now showing up as attached in the Java perspective.
Comment 2 Dean Roberts CLA 2011-09-30 09:19:02 EDT
Actually detaching the view is not a requirement to see some bogus behaviour.  Try this.

1) Open Java perspective
2) Open Debug perspective
3) Move the Outline view to somewhere new in the Debug perspective
4) Open the java perspective

Notice the Outline view has moved.

Also I can get even stranger behavoiur if I go back to the debug perspective and move the outline view again.  I've even gotten the outline view to disappear from the Java perspective by manipulating it in the debug perspective.

I'm not entirely sure this problem would have the same cause as the steps in comment 1 and 2.  But new bugs can be created as needed I guess.
Comment 3 Dean Roberts CLA 2011-09-30 10:55:05 EDT
For comment #2, the problem only seems to happen if the drop area is the shared editor area.
Comment 4 Dean Roberts CLA 2011-09-30 11:07:21 EDT
Same is true for comment 1.  The NPE only happens if you try to re-attach the the view in the shared MArea.  Which makes sense.

Is the solution simply that the MArea should not be a valid drop target for views?
Comment 5 Remy Suen CLA 2011-09-30 11:10:05 EDT
(In reply to comment #4)
> Is the solution simply that the MArea should not be a valid drop target for
> views?

This is one of the features we provide for Eclipse 4 so this would be a no-go.
Comment 6 Dean Roberts CLA 2011-09-30 11:49:32 EDT
I have confused this defect with some reports of problems that are designed behaviour.

To clean things up I'm going to close it as invalid and open a new defect.
Comment 7 Dean Roberts CLA 2011-09-30 14:48:40 EDT
The new defect is https://bugs.eclipse.org/bugs/show_bug.cgi?id=359583