Bug 47010 Make refactorings more responsive to cancel [refactoring]
I20031119 Most of our current refactorings only do a sporadic check of IProgressMonitor.isCanceled() resulting in a bad canceling behavior. We should make a path over our existing refactoring and queck the cancel state at least after each compilation unit we have processes in checkInput and createChange. The code pattern to add should look like this: pm.worked(...) if (pm.isCanceled()) { // clean-up state if necessary throw new OperationCancelException(); }
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/refactoring/JUnitRenameParticipant.java
public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) {
		return new RefactoringStatus();
	}
	public Change createChange(IProgressMonitor pm) throws CoreException {
		if (!getArguments().getUpdateReferences()) 
			return null;	
		
		ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
		List launchConfigTypes= JUnitPlugin.getDefault().getJUnitLaunchConfigTypeIDs();
		List changes= new ArrayList();
		for (Iterator types= launchConfigTypes.iterator(); types.hasNext();) {
			String typeId= (String) types.next();
			ILaunchConfigurationType type= manager.getLaunchConfigurationType(typeId);
			ILaunchConfiguration configs[]= manager.getLaunchConfigurations(type);
			createChangeForConfigs(changes, configs);
			
		}
		if (changes.size() > 0)
			return new CompositeChange(getChangeName(), (Change[]) changes.toArray(new Change[changes.size()])); 
		return null; 
	}
	protected String getChangeName() {
		return JUnitMessages.getString("TypeRenameParticipant.change.name");
	}
	protected abstract void createChangeForConfigs(List changes, ILaunchConfiguration[] configs) throws CoreException;
}