Community
Participate
Working Groups
I20080427-2000 To reproduce the latest I-Build I20080427-2000 is required! This is on WinXP. 1. Open a CU in Java Editor 2. Enable breadcrumb (toolbar button) 3. Left click on a package in the breadcrumb 4. Press Alt-Shift-R (rename) Is: org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:3773) at org.eclipse.swt.SWT.error(SWT.java:3691) at org.eclipse.swt.SWT.error(SWT.java:3662) at org.eclipse.swt.widgets.Widget.error(Widget.java:462) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:335) at org.eclipse.swt.widgets.Shell.setEnabled(Shell.java:1404) at org.eclipse.ui.internal.progress.ProgressManager.setUserInterfaceActive(ProgressManager.java:1317) at org.eclipse.ui.internal.progress.ProgressManager.access$4(ProgressManager.java:1312) at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:983) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:1012) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:987) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.checkInitialConditions(RefactoringWizardOpenOperation.java:168) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.access$0(RefactoringWizardOpenOperation.java:164) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:127) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:156) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:37) at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:60) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter.activate(RenameUserInterfaceStarter.java:31) at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:160) at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:117) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startRenameRefactoring(RefactoringExecutionStarter.java:436) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:194) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:106) at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:108) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:822) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:511) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1161) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1001) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1026) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1011) at org.eclipse.swt.widgets.Control.traverse(Control.java:3493) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:3337) at org.eclipse.swt.widgets.Composite.translateMnemonic(Composite.java:1064) at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:3355) at org.eclipse.swt.widgets.Display.translateMnemonic(Display.java:4297) at org.eclipse.swt.widgets.Display.filterMessage(Display.java:1175) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3375) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2351) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2315) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2181) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:477) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:472) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:112) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) 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:379) 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:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) The failing code is: Shell[] shells = workbench.getDisplay().getShells(); if (active) { for (int i = 0; i < shells.length; i++) { shells[i].setEnabled(active); } } else { .... But getShells() is spec'd as: * .......all shells which have * not been disposed...... This is a major bug for us, it makes us look bad.
We either need a fix for M7 or add a guard to ProgressManager.setUserInterfaceActive(...).
*** Bug 229021 has been marked as a duplicate of this bug. ***
will look at this with SN
We've investigated this, it's not an swt problem. Display.getShells() answers all non-disposed Shells in this scenario, but 1+ of them becomes disposed by a listener while the list is being held in ProgressManager.setUserInterfaceActive(boolean). If you change this method to the snippet below (some println's added) you'll see that initially none of the shells are disposed but one of them becomes disposed as a result of the shells[i].setEnabled(active) line. Moving to UI. private void setUserInterfaceActive(boolean active) { System.out.println("setUserInterfaceActive called"); IWorkbench workbench = PlatformUI.getWorkbench(); Shell[] shells = workbench.getDisplay().getShells(); for (int i = 0; i < shells.length; i++) { if (shells[i].isDisposed()) { System.out.println("Shell disposed in original list!"); } } if (active) { for (int i = 0; i < shells.length; i++) { if (shells[i].isDisposed()) { System.out.println("shell disposed later on by application code"); } shells[i].setEnabled(active); } } else { // Deactive shells in reverse order for (int i = shells.length - 1; i >= 0; i--) { shells[i].setEnabled(active); } } }
OK. I'll protect the code against that.
Fixed in HEAD. Will be picked up by next Platform UI contribution for M7.
.
Verified in I20080430-0100.