protected final RefactoringStatus performRefactoring(Refactoring ref, boolean providesUndo) throws Exception { performDummySearch(); IUndoManager undoManager= getUndoManager(); CreateChangeOperation create= new CreateChangeOperation( new CheckConditionsOperation(ref, CheckConditionsOperation.ALL_CONDITIONS), RefactoringStatus.FATAL); PerformChangeOperation perform= new PerformChangeOperation(create); perform.setUndoManager(undoManager, ref.getName()); ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor()); RefactoringStatus status= create.getConditionCheckingStatus(); if (!status.isOK()) return status; assertTrue("Change wasn't executed", perform.changeExecuted()); Change undo= perform.getUndoChange(); if (providesUndo) { assertNotNull("Undo doesn't exist", undo); assertTrue("Undo manager is empty", undoManager.anythingToUndo()); } else { assertNull("Undo manager contains undo but shouldn't", undo); } return null;
protected final RefactoringStatus performRefactoring(Refactoring ref) throws Exception { return performRefactoring(ref, true);
	protected final RefactoringStatus performRefactoring(Refactoring ref, boolean providesUndo) throws Exception {		performDummySearch();		IUndoManager undoManager= getUndoManager();		CreateChangeOperation create= new CreateChangeOperation(			new CheckConditionsOperation(ref, CheckConditionsOperation.ALL_CONDITIONS),			RefactoringStatus.FATAL);		PerformChangeOperation perform= new PerformChangeOperation(create);		perform.setUndoManager(undoManager, ref.getName());		ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());		RefactoringStatus status= create.getConditionCheckingStatus();		if (!status.isOK())			return status;		assertTrue("Change wasn't executed", perform.changeExecuted());		Change undo= perform.getUndoChange();		if (providesUndo) {			assertNotNull("Undo doesn't exist", undo);			assertTrue("Undo manager is empty", undoManager.anythingToUndo());		} else {			assertNull("Undo manager contains undo but shouldn't", undo);		}		return null;	}