Bug 23146 - [Perspectives] Prompt when deleting an open Perspective
Summary: [Perspectives] Prompt when deleting an open Perspective
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P5 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 26720 85501 213738 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-09-04 05:10 EDT by Markus Keller CLA
Modified: 2008-07-21 09:32 EDT (History)
5 users (show)

See Also:


Attachments
Patch to implement the suggested behaviour. (4.79 KB, patch)
2007-09-22 17:25 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2002-09-04 05:10:50 EDT
Deleting an open perspective should close it prior to deletion. As exemplified
below, strange effects can occur if the perspective is not closed first.

BTW: Deleting a perspective in the preferences is far from intuitive. I'd rather
rename Window > Open Perspective > Other... to Manage... and add a Delete button
in the Select Perspective dialog.
(see also http://bugs.eclipse.org/bugs/show_bug.cgi?id=6018 )

Eclipse Version: 2.0.1
Build id: 200208291828


Steps to Reproduce:
- Open Java Perspective
- Window > Save Perspective As ... : enter "Java2"
- Window > Preferences
  - go to Workbench, Perspectives
  - select "Java2" from list
  - click Delete button
  - click OK
Java2 Perspective is still active, but doesn't
appear in Window > Open Perspective

- Window > Open Perspective > Java
- Switch back to Java2 Perspective (by using the Shortcut Bar)
Note: Java2 reappears in Open Perspective submenu!

- Window > Close Perspective
- Window > Open Perspective > Java2
Bang! NPE because of invalid (deleted) perspective.
Workbench Window Toolbar gets cleared, etc.
Eclipse restart required.

!ENTRY org.eclipse.ui 4 4 Sep 04, 2002 10:54:23.737
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Sep 04, 2002 10:54:23.757
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
at org.eclipse.ui.internal.Perspective.loadPredefinedPersp(Perspective.java:616)
at org.eclipse.ui.internal.Perspective.createPresentation(Perspective.java:233)
at org.eclipse.ui.internal.Perspective.<init>(Perspective.java:133)
at org.eclipse.ui.internal.WorkbenchPage.createPerspective(WorkbenchPage.java:840)
at org.eclipse.ui.internal.WorkbenchPage.busySetPerspective(WorkbenchPage.java:527)
at org.eclipse.ui.internal.WorkbenchPage.access$6(WorkbenchPage.java:522)
at org.eclipse.ui.internal.WorkbenchPage$11.run(WorkbenchPage.java:2234)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:2232)
at
org.eclipse.ui.internal.ChangeToPerspectiveMenu.run(ChangeToPerspectiveMenu.java:57)
at org.eclipse.ui.actions.PerspectiveMenu.run(PerspectiveMenu.java:305)
at org.eclipse.ui.actions.PerspectiveMenu$2.widgetSelected(PerspectiveMenu.java:93)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:87)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1256)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1239)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:775)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
at org.eclipse.core.launcher.Main.run(Main.java:703)
at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 1 Eduardo Pereira CLA 2002-09-17 17:07:00 EDT
Released fix in the HEAD stream.
Fix is in PerspectivesPreferencePage
Comment 2 Nick Edgar CLA 2002-10-18 11:44:37 EDT
Reopening PR.  Following the original steps below, when I hit the Delete 
button, it disappears from the list, but then complains when I try to close the 
preferences dialog.  The error dialog may be confusing at this time, because 
the user may have switched to another page.  Having to cancel may lose other 
changes they've made.

Recommend complaining that the perspective cannot be deleted immediately, and 
leaving it in the list.  This is preferable to simply disabling the delete 
button, since this way you get an explanation.

Comment 3 Markus Keller CLA 2002-10-18 12:03:48 EDT
I agree completely with Nick's statement.

The complaining dialog could also ask whether Eclipse should simply close the 
perspective and then delete it.
Comment 4 Eduardo Pereira CLA 2002-11-26 12:03:33 EST
*** Bug 26720 has been marked as a duplicate of this bug. ***
Comment 5 Nick Edgar CLA 2006-03-15 11:21:43 EST
Reassigning bugs in component areas that are changing ownership.
Comment 6 Paul Webster CLA 2006-09-28 15:12:37 EDT
Is this still a problem in 3.3?

PW
Comment 7 Markus Keller CLA 2006-09-29 05:49:13 EDT
The delete button now shows an "Unable to delete perspective" dialog when the perspective is still in use. This forces the user to leave the preference dialog, close the perspective(s) manually, reopen the dialog, select the perspective again, delete the perspective again.

The original request was to close the perspective before deleting it. Best would be if the dialog asked "Are you sure you want to delete Perspective 'Java2'? It has open instances." and then closes the perspective before deleting it.
Comment 8 Nick Edgar CLA 2006-10-10 13:14:27 EDT
+1 for the suggested behaviour.
Comment 9 Remy Suen CLA 2007-09-22 17:25:56 EDT
Created attachment 79030 [details]
Patch to implement the suggested behaviour.
Comment 10 Remy Suen CLA 2007-09-24 15:30:00 EDT
Paul, you mentioned to me that I should wait for bug 203631 to be closed before providing a patch, as you can see, I didn't. Do you want me to respin a patch using the handler or are you fine with me using IWorkbenchPage's closePerspective method?
Comment 11 Paul Webster CLA 2007-11-30 09:45:40 EST
Released to HEAD >20071130
PW
Comment 12 Paul Webster CLA 2007-12-11 10:36:56 EST
In I20071211-0010
PW
Comment 13 Paul Webster CLA 2007-12-22 06:28:01 EST
*** Bug 213738 has been marked as a duplicate of this bug. ***
Comment 14 Paul Webster CLA 2008-07-21 09:32:29 EDT
*** Bug 85501 has been marked as a duplicate of this bug. ***