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

Bug 319961

Summary: Reset perspective fails with parts moved into the editor area
Product: [Eclipse Project] e4 Reporter: Stefan Mücke <s.muecke>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: bokowski, remy.suen
Version: unspecified   
Target Milestone: 1.0 RC2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch
none
updated patch so that it applies cleanly to HEAD none

Description Stefan Mücke CLA 2010-07-15 05:22:12 EDT
1. Start a fresh e4 workbench
2. Move the Javadoc view into the editor area
3. Reset the perspective
4. Open the Javadoc view

Result: The Javadoc view is opened in the editor area. In the bottom stack there still is a tab for the Javadoc view; this tab can be clicked, but it will activate the view in the editor area. The toolbar, however, is shown in the bottom stack.
Comment 1 Remy Suen CLA 2010-07-15 06:28:17 EDT
Moving views into the editor area is known to cause problems. We really need to prevent this operation from being permitted in our DND code.
Comment 2 Stefan Mücke CLA 2010-07-15 08:59:03 EDT
No. The problems should be fixed, because this is a really useful feature.
Comment 3 Paul Webster CLA 2010-07-15 09:07:11 EDT
We've specifically committed to disallow views and editors in mixed stacks in 4.0.

Mixing them won't be looked at until 4.1

PW
Comment 4 Boris Bokowski CLA 2010-07-15 09:13:06 EDT
The problem is that the editor stack is shared
across all perspectives, and individual views are also shared across
perspectives. If you move a view into the editor area in one perspective, you
would have to remove it from all other perspectives so that it will never
appear twice after switching perspectives. There are similar cases that lead to inconsistent states, such as the one described in comment #0.

I am not saying that this is impossible to solve, but unless someone has time
to think through these issues and solve them in a safe way (and it would have
to be done *really soon*), we are going to have to play it safe and disallow
mixing views and editors for 4.0.
Comment 5 Boris Bokowski CLA 2010-07-15 11:14:39 EDT
Eric and I have discussed this and think there is a chance of us fixing the problems. Stefan, would you have time to help us test once we have a patch?
Comment 6 Stefan Mücke CLA 2010-07-15 11:23:18 EDT
Yes, I would help testing this.
Comment 7 Boris Bokowski CLA 2010-07-15 23:27:29 EDT
Created attachment 174466 [details]
patch

Here is something to test with.
Comment 8 Stefan Mücke CLA 2010-07-16 08:14:38 EDT
Here's a first finding:

1. Open a fresh e4 workbench
2. Start dragging the Javadoc view
3. Drop the Javadoc view at the original position

Result: Toolbar and spacer have a wrong styling.
Comment 9 Stefan Mücke CLA 2010-07-16 08:21:58 EDT
(In reply to comment #8)
> Result: Toolbar and spacer have a wrong styling.

This is probably related to the new toolbar wrapping algorithm.
Comment 10 Boris Bokowski CLA 2010-07-16 09:37:03 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > Result: Toolbar and spacer have a wrong styling.
> 
> This is probably related to the new toolbar wrapping algorithm.

Yes. I wouldn't worry about styling problems, especially around view toolbars which have changed yesterday. Things to look for would be NPEs, or if you are no longer able to drag and drop views, or if you can manage to get two different tabs for the same view, etc.
Comment 11 Boris Bokowski CLA 2010-07-16 11:22:51 EDT
Created attachment 174507 [details]
updated patch so that it applies cleanly to HEAD
Comment 12 Boris Bokowski CLA 2010-07-16 11:23:35 EDT
updated patch applied to HEAD.
Comment 13 Boris Bokowski CLA 2010-07-16 11:27:01 EDT
I wanted to get this into the next build so that we can get more testing. We have the patch on this bug should we need to roll back and disallow mixing of views and editors, but at this point I am optimistic that the fix will hold.
Comment 14 Stefan Mücke CLA 2010-07-16 13:18:46 EDT
Here's a bug with CVS HEAD. I don't know exactly how to reproduce, but I saw this exception twice:

2010-07-16 19:17:06.414 Log ErrorException 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@4d66f8
java.lang.NullPointerException
  at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.hideElementRecursive(LazyStackRenderer.java:178)
  at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.access$0(LazyStackRenderer.java:154)
  at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:71)
  at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41)
  at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188)
  at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198)
  at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
  at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
  at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139)
  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:73)
  at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
  at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
  at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:159)
  at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$3.widgetSelected(StackRenderer.java:438)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
  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.Widget.sendEvent(Widget.java:1077)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
  at org.eclipse.e4.ui.widgets.CTabFolder.setSelection(CTabFolder.java:2815)
  at org.eclipse.e4.ui.widgets.CTabFolder.onMouse(CTabFolder.java:1461)
  at org.eclipse.e4.ui.widgets.CTabFolder$1.handleEvent(CTabFolder.java:259)
  ...