Bug 89393 [Undo] - Rename CU scenario - undo becomes disabled in renamed editor
(from Dirk email) - open a compilation unit in the editor - select the type name of the top level type - execute refactoring rename - this correctly opens a triggered operation. However, the operation gets closed by the fact that the editor get set a new input. The stack trace is as follows: Thread [main] (Suspended (breakpoint at line 531 in DefaultOperationHistory)) DefaultOperationHistory.flushUndo(IUndoContext) line: 531 DefaultOperationHistory.dispose(IUndoContext, boolean, boolean, boolean) line: 255 DefaultUndoManager.initializeCommandStack() line: 892 DefaultUndoManager.reset() line: 1178 CompilationUnitEditor$AdaptedSourceViewer(TextViewer).activatePlugins () line: 1508 CompilationUnitEditor$AdaptedSourceViewer(SourceViewer).activatePlugins () line: 414 CompilationUnitEditor$AdaptedSourceViewer(SourceViewer).configure (SourceViewerConfiguration) line: 385 CompilationUnitEditor$AdaptedSourceViewer(JavaSourceViewer).configure (SourceViewerConfiguration) line: 201 CompilationUnitEditor$AdaptedSourceViewer.configure (SourceViewerConfiguration) line: 296 CompilationUnitEditor(JavaEditor).doSetInput(IEditorInput) line: 2229 CompilationUnitEditor.doSetInput(IEditorInput) line: 1501 CompilationUnitEditor(AbstractTextEditor).setInput(IEditorInput) line: 3019 AbstractTextEditor$7.run() line: 402 AbstractTextEditor$ElementStateListener.execute(Runnable, boolean) line: 459 AbstractTextEditor$ElementStateListener.elementMoved(Object, Object) line: 420 TextFileDocumentProvider$FileBufferListener.underlyingFileMoved (IFileBuffer, IPath) line: 305 TextFileBufferManager$6.run() line: 390 InternalPlatform.run(ISafeRunnable) line: 1015 Platform.run(ISafeRunnable) line: 757 TextFileBufferManager.fireUnderlyingFileMoved(IFileBuffer, IPath) line: 388 ResourceTextFileBuffer(ResourceFileBuffer).handleFileMoved(IPath) line: 431 ResourceFileBuffer$3.execute() line: 153 ResourceFileBuffer$3(ResourceFileBuffer$SafeFileChange).run() line: 78 UISynchronizationContext.run(Runnable) line: 34 TextFileBufferManager.execute(Runnable, boolean) line: 334 ResourceFileBuffer$FileSynchronizer.resourceChanged (IResourceChangeEvent) line: 170 NotificationManager$2.run() line: 275 InternalPlatform.run(ISafeRunnable) line: 1015 Platform.run(ISafeRunnable) line: 757 NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 269 NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 143 Workspace.broadcastPostChange() line: 180 Workspace.checkpoint(boolean) line: 243 PerformChangeOperation$1.run(IProgressMonitor) line: 237 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1714 Workspace.run(IWorkspaceRunnable, IProgressMonitor) line: 1734 UIPerformChangeOperation(PerformChangeOperation).executeChange (IProgressMonitor) line: 280 UIPerformChangeOperation.access$1(UIPerformChangeOperation, IProgressMonitor) line: 1 UIPerformChangeOperation$1.run() line: 60 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 118 Display.runAsyncMessages(boolean) line: 2871 Display.readAndDispatch() line: 2530 ModalContext$ModalContextThread.block() line: 151 ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 301 RefactoringWizardDialog2.run(boolean, boolean, IRunnableWithProgress) line: 282 RenameTypeWizard(RefactoringWizard).internalPerformFinish(InternalAPI, PerformChangeOperation) line: 544 RenameRefactoringWizard$1(UserInputWizardPage).performFinish() line: 153 RenameTypeWizard(RefactoringWizard).performFinish() line: 610 RefactoringWizardDialog2.okPressed() line: 406 RefactoringWizardDialog2(Dialog).buttonPressed(int) line: 407 Dialog$2.widgetSelected(SelectionEvent) line: 554 TypedListener.handleEvent(Event) line: 89 EventTable.sendEvent(Event) line: 82 Button(Widget).sendEvent(Event) line: 842 Display.runDeferredEvents() line: 2894 Display.readAndDispatch() line: 2527 RefactoringWizardDialog2(Window).runEventLoop(Shell) line: 801 RefactoringWizardDialog2(Window).open() line: 779 RefactoringWizardOpenOperation$1.run() line: 125 BusyIndicator.showWhile(Display, Runnable) line: 69 RefactoringWizardOpenOperation.run(Shell, String) line: 138 RefactoringStarter.activate(Refactoring, RefactoringWizard, Shell, String, boolean) line: 40 RenameUserInterfaceStarter(UserInterfaceStarter).activate(Refactoring, Shell, boolean) line: 56 RenameUserInterfaceStarter.activate(Refactoring, Shell, boolean) line: 113 RenameSupport.openDialog(Shell) line: 114 RenameJavaElementAction.run(IJavaElement, RenameSupport) line: 180 RenameJavaElementAction.run(ITextSelection) line: 133 RenameAction.run(ITextSelection) line: 116 RenameAction(SelectionDispatchAction).dispatchRun(ISelection) line: 216 RenameAction(SelectionDispatchAction).run() line: 188 RenameAction(Action).runWithEvent(Event) line: 1003 ActionContributionItem.handleWidgetSelection(Event, boolean) line: 557 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 507 ActionContributionItem$6.handleEvent(Event) line: 421 ... This leads to the fact that the undo pushed onto the stack isn't functional. I don't know if this is something the editor, the framework or refactoring has to handle.
bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/operations/DefaultOperationHistory.java
((IOperationHistoryListener) listeners.get(i))
						.historyNotification(event);
			} catch (Exception e) {
				handleNotificationException(e);
			}
	}
	/*
	 * Notify listeners that an operation has been removed from the history.
	 */
	private void notifyRemoved(IUndoableOperation operation) {
		if (DEBUG_OPERATION_HISTORY_NOTIFICATION) {
			System.out.print("OPERATIONHISTORY >>> OPERATION_REMOVED ");  
			System.out.print(operation);
			System.out.println();
		}
		OperationHistoryEvent event = new OperationHistoryEvent(
				OperationHistoryEvent.OPERATION_REMOVED, this, operation);
		preNotifyOperation(operation, event);
		for (int i = 0; i < listeners.size(); i++)
			try {
				((IOperationHistoryListener) listeners.get(i))
						.historyNotification(event);
			} catch (Exception e) {
				handleNotificationException(e);
			}
	}
	/*
	 * Notify listeners that an operation has been undone.
	 */
	private void notifyUndone(IUndoableOperation operation) {