Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320097 - Part cannot be activated after detaching it, closing it, and resetting the perspective
Summary: Part cannot be activated after detaching it, closing it, and resetting the pe...
Status: RESOLVED WORKSFORME
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 320096 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-16 08:39 EDT by Stefan Mücke CLA
Modified: 2013-06-06 11:49 EDT (History)
1 user (show)

See Also:


Attachments
Remove the close button from the shell (2.83 KB, patch)
2010-07-16 11:02 EDT, Eric Moffatt CLA
no flags Details | Diff
Patch to explicitly remove the Close button from detached windows (982 bytes, patch)
2011-04-14 10:57 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Mücke CLA 2010-07-16 08:39:57 EDT
1. Open a fresh e4 workbench
2. Detach the Package Explorer view by dragging it off the workbench
3. Close the detached stack
4. Reset the perspective
   RESULT (1): Package Explorer is not activated
5. Try to activate the Package Explorer
   RESULT (2): Not possible.
6. Try to close the Package Explorer
   RESULT (3): Error dialog: Internal Error; NPE

!ENTRY org.eclipse.e4.ui.workbench 4 0 2010-07-16 14:38:56.549
!MESSAGE Internal Error
!STACK 0
java.lang.NullPointerException
  at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$4.close
    (StackRenderer.java:442)
  at org.eclipse.e4.ui.widgets.CTabFolder.onMouse(CTabFolder.java:1620)
  at org.eclipse.e4.ui.widgets.CTabFolder$1.handleEvent(CTabFolder.java:265)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  ...
Comment 1 Eric Moffatt CLA 2010-07-16 09:27:16 EDT
This scenario now seems to work (using HEAD).
Comment 2 Stefan Mücke CLA 2010-07-16 09:36:25 EDT
This time the Package Explorer was activated, but when I tried to activate another view I got an exception:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2010-07-16 15:35:22.061
!MESSAGE Internal Error
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
  at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:54)
  at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:74)
  at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:90)
  at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:333)
  at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:350)
  at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:398)
  at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:105)
  ...
  at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1424)
  at org.eclipse.swt.widgets.Shell.WM_MOUSEACTIVATE(Shell.java:2297)

Caused by: java.lang.NullPointerException
  at org.eclipse.ui.part.PageBookView$4.partDeactivated(PageBookView.java:1047)
  at org.eclipse.ui.internal.WorkbenchPage.firePartDeactivated(WorkbenchPage.java:2802)
  at org.eclipse.ui.internal.WorkbenchPage.access$12(WorkbenchPage.java:2791)
  at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partDeactivated(WorkbenchPage.java:131)
  at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartDeactivated(PartServiceImpl.java:190)
  at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.setPart(PartServiceImpl.java:142)
  at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:47)
  ... 94 more
Comment 3 Boris Bokowski CLA 2010-07-16 09:40:27 EDT
Stefan, did you encounter this during testing with the patch from bug 319961?
Comment 4 Stefan Mücke CLA 2010-07-16 09:44:13 EDT
Yes. I will check if this is caused by the patch from bug 319961.
Comment 5 Boris Bokowski CLA 2010-07-16 09:49:33 EDT
Eric, could you have a look at the patch form bug 319961? One part of that patch is that as the perspective layout is built (ModeledPageLayout etc), I am removing views from the model if I can find them, using code like:

MUIElement existingView = layout.findElement(layout.perspModel, viewId);
if (existingView instanceof MPlaceholder) {
	existingView.getParent().getChildren().remove(existingView);
}

Could it be that layout.findElement(perspModel, viewId) does not find a view if it is detached?
Comment 6 Stefan Mücke CLA 2010-07-16 09:52:02 EDT
In both cases there is a bug; however there are different bugs and exceptions.

Without the patch, the Package Explorer will be activated, but it will not be
possible to activate another view.

With the patch, the Package Explorer will NOT be activated, but trying to
activate it results in the behavior described in comment 0.
Comment 7 Eric Moffatt CLA 2010-07-16 11:02:59 EDT
Created attachment 174504 [details]
Remove the close button from the shell


Many of these issues are the result of closing the *shell* using the red 'x' rather than closing the view itself. For now we'll just wire off the 'x'...

The patch also contains some code to safe up the shared TB story...was getting some widget disposed errors when testing after making the fix.
Comment 8 Eric Moffatt CLA 2010-07-16 11:05:39 EDT
Committed in >20100716. Applied the patch.
Comment 9 Eric Moffatt CLA 2011-04-14 10:07:07 EDT
*** Bug 320096 has been marked as a duplicate of this bug. ***
Comment 10 Eric Moffatt CLA 2011-04-14 10:56:10 EDT
Reopening because the fox for Bug 333496 caused the red 'x' to re-appear...
Comment 11 Eric Moffatt CLA 2011-04-14 10:57:57 EDT
Created attachment 193262 [details]
Patch to explicitly remove the Close button from detached windows
Comment 12 Eric Moffatt CLA 2011-04-14 10:59:47 EDT
Committed in >20110414. Applied the patch.

Note that I'm still getting an odd error when closing a view in a DW:

org.eclipse.core.runtime.AssertionFailedException: assertion failed: The widget should not have been disposed at this point
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$1.handleEvent(CompatibilityPart.java:83)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4678)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:182)

I'm still looking at this but at least you can re-open the part and there are no apparent side-effects...
Comment 13 Dani Megert CLA 2013-06-05 10:57:19 EDT
Removing outdated target milestone.
Comment 14 Eric Moffatt CLA 2013-06-06 11:49:56 EDT
All of these behaviors have been address by subsequent work on the DW management...