Project: Eclipse_Platform_UI
Bug 79401 [ErrorHandling] Duplicate presentation of error messages
Reported: 2004-11-24 11:07:34 | Status: verified fixed

1) Create a simple project with a simple folder inside it. 2) In Windows Explorer, expand the project and select the folder in the left pane. 3) Back in the Navigator view, try to rename the project. -> Rename fails because it cannot rename because Windows won't let you delete a folder that is being viewed in Windows Explorer. This is expected. Platform core returns a MultiStatus of the following form: MultiStatus ("problems encountered moving resources") MultiStatus ("Copy successful, but problems occurred removing old resources") Status ("Could not delete: d:\eclipse\test2\simple") The UI Error dialog shows the following in the details area: Problems occurred renaming the selected resource. Problems encountered while moving resources. Copy successful, but problems occurred removing old resources Could not delete: d:\eclipse\test2\simple\abc. Copy successful, but problems occurred removing old resources Could not delete: d:\eclipse\test2\simple\abc. Notice that the child MultiStatus from core is displayed twice. The root of this duplication is WorkspaceAction.recordError: private void recordError(CoreException error) { if (errorStatus == null) errorStatus = new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, getProblemsMessage(), error); errorStatus.merge(error.getStatus()); } Observe that it stores the CoreException in the MultiStatus, *and* adds the error's status as a child of the MultiStatus. The JFace ErrorDialog class, when presented with this MultiStatus, recursively prints all MultiStatus objects, and all statuses contained within CoreExceptions. Since this MultiStatus contains both the original MultiStatus and the CoreException that carried it, it will get printed twice. The suggested fix is to not include the CoreException in the MultiStatus in recordError: private void recordError(CoreException error) { if (errorStatus == null) errorStatus = new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, getProblemsMessage(), null); errorStatus.merge(error.getStatus()); } I tested this fix, and it produced an error dialog containing: Problems occurred renaming the selected resource. Copy successful, but problems occurred removing old resources Could not delete: d:\eclipse\test2\simon\abc.

Files changed in fix:
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/WorkspaceAction.java