Bug 72024 UndoManager creates potential memory leak [refactoring]
3.0 The refactoring undo manager doesn't call dispose in all cases where a undo/redo object is no longer needed. This can result in a memory leak since the undo/redo object could register for listeners and therefore relies on the fact the dispose is called correctly. Cases where dispose isn't called: - if the undo stack reaches it maximum number of change objects and the last one is removed from the stack. - if the undo/redo stack gests flushed and one of the change objects causes an exception during sending dispose. - if the undo/redo object isn't valid anymore and can therefore not be executed.
org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/RefactoringWizardDialog2.java
fStatusContainer.showPage(fMessageBox);
			Map state = (Map)savedState;
			restoreUIState(state);
	
			setDisplayCursor(shell.getDisplay(), null);	
			cancelButton.setCursor(null);
			fWaitCursor.dispose();
			fWaitCursor = null;
			fArrowCursor.dispose();
			fArrowCursor = null;
			Control focusControl = (Control)state.get("focus"); 
			if (focusControl != null)
				focusControl.setFocus();
		}
	}
	
	private void restoreUIState(Map state) {
		restoreEnableState(getButton(PREVIEW_ID), state, "preview");
		restoreEnableState(getButton(IDialogConstants.OK_ID), state, "ok");
		restoreEnableState(getButton(IDialogConstants.CANCEL_ID), state, "cancel");
		ControlEnableState pageState = (ControlEnableState) state.get("page");
		pageState.restore();
	}
	
	private void restoreEnableState(Control w, Map h, String key) {
		if (w != null) {
			Boolean b = (Boolean) h.get(key);
			if (b != null)
				w.setEnabled(b.booleanValue());