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.ltk.core.refactoring/src/org/eclipse/ltk/core/refactoring/participants/ProcessorBasedRefactoring.java
RefactoringCorePlugin.logRemovedParticipant(descriptor, e);
			}
			if (pm.isCanceled())
				throw new OperationCanceledException();
		}
		Change postChange= getProcessor().postCreateChange(
			(Change[])changes.toArray(new Change[changes.size()]), 
			new SubProgressMonitor(pm, 1));
		
		ProcessorChange result= new ProcessorChange(getName());
		result.add(processorChange);
		result.addAll((Change[]) changes.toArray(new Change[changes.size()]));
		result.setParticipantMap(participantMap);
		if (postChange != null)
			result.add(postChange);
		return result;
	}
	
	/**
	 * Adapts the refactoring to the given type. The adapter is resolved
	 * as follows:
	 * <ol>
	 *   <li>the refactoring itself is checked whether it is an instance
	 *       of the requested type.</li>
	 *   <li>its processor is checked whether it is an instance of the
	 *       requested type.</li>
	 *   <li>the request is delegated to the super class.</li>
	 * </ol>
	 * 
	 * @param clazz the adapter class to look up