Bug 97764 [refactoring] [rename] Exception attempting to rename linked binary project resources --> provide details to user
I was attempting to rename a file in a binary project and the operation fails with details. A big scary stack trace is dumped to the log with a very nice description of the problem. I would propose to present the details to the user so that the (dumb) user can remember that the plugin is linked :-) Caused by: org.eclipse.core.internal.resources.ResourceException: Problems encountered while moving resources. at org.eclipse.core.internal.resources.Resource.move (Resource.java:1215) at org.eclipse.jdt.internal.corext.refactoring.changes.RenameResourceChange.perfor m(RenameResourceChange.java:82) at org.eclipse.ltk.core.refactoring.CompositeChange.perform (CompositeChange.java:279) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChang e.access$0(DynamicValidationStateChange.java:1) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChang e$1.run(DynamicValidationStateChange.java:92) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation (BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:718) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1719) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3709) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:3666) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChang e.perform(DynamicValidationStateChange.java:95) at org.eclipse.ltk.core.refactoring.CompositeChange.perform (CompositeChange.java:279) at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.run (PerformChangeOperation.java:232) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1719) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1739) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.executeChange (PerformChangeOperation.java:280) at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation.access$1 (UIPerformChangeOperation.java:1) at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation$1.run (UIPerformChangeOperation.java:63) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1038) at org.eclipse.core.runtime.Platform.run(Platform.java:775) at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation$2.run (UIPerformChangeOperation.java:81) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:118) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2906) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2565) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block (ModalContext.java:153) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:303) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:293) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish (RefactoringWizard.java:547) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:153) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:613) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:417) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:409) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2929) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562) at org.eclipse.jface.window.Window.runEventLoop(Window.java:809) at org.eclipse.jface.window.Window.open(Window.java:787) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run (RefactoringWizardOpenOperation.java:125) at org.eclipse.swt.custom.BusyIndicator.showWhile (BusyIndicator.java:69) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run (RefactoringWizardOpenOperation.java:138) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:40) at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate (UserInterfaceStarter.java:56) at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter.activa te(RenameUserInterfaceStarter.java:113) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startRe nameResourceRefactoring(RefactoringExecutionStarter.java:330) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameResourceAction.run (RenameResourceAction.java:54) at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:110) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:222) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:198) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2 (ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent (ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2929) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:366) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:375) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:162) 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.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948) !SUBENTRY 1 org.eclipse.core.resources 4 4 2005-05-31 16:17:34.253 !MESSAGE Problems encountered while moving resources. !SUBENTRY 2 org.eclipse.pde.core 4 0 2005-05-31 16:17:34.253 !MESSAGE Operation cannot be performed because one or more resources belong to a binary plug-in project that contains linked resources. To be able to modify binary project resources, re-import it by copying the content into the workspace.
org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/UIPerformChangeOperation.java
throw new CoreException(new Status(
						IStatus.ERROR, status.getPlugin(), status.getCode(), 
						status.getMessage(), exception[0]));
				} else {
					String message= exception[0].getMessage();
					throw new CoreException(new Status(
						IStatus.ERROR, RefactoringUIPlugin.getPluginId(),IStatus.ERROR,
						message == null
							? RefactoringUIMessages.ChangeExceptionHandler_no_details
							: message,
						exception[0]));
				}
			}
		} else {
			super.executeChange(pm);
		}
	}
	private Button getCancelButton() {
		if (fWizardContainer instanceof RefactoringWizardDialog2) {
			return ((RefactoringWizardDialog2)fWizardContainer).getCancelButton();
		} else if (fWizardContainer instanceof RefactoringWizardDialog) {
			return ((RefactoringWizardDialog)fWizardContainer).getCancelButton();
		}
		return null;
	}
}