private String newMethodName;
private String newMethodSignature;
private MoveMethodRefactoringTargetFinder targetFinder;
- private RefactoringPerformer refactoringExecutor;
+ private RefactoringPerformer refactoringPerformer;
public ExtractAndMoveMethodExecutor(CompilationUnitTextSelection compilationUnitTextSelection, String newMethodName) {
this.compilationUnitTextSelection = compilationUnitTextSelection;
@Override
public void executeChange(IProgressMonitor monitor, UndoResources undoResources) throws CoreException {
- createRefactoringExecutor(monitor, undoResources);
- checkConditionsAndPerformExtractMethodRefactoring();
- checkConditionsAndPerformMoveMethodRefactoring();
+ createRefactoringPerformer(monitor, undoResources);
+ performExtractMethodRefactoring();
+ performMoveMethodRefactoring();
}
- private void checkConditionsAndPerformExtractMethodRefactoring() throws CoreException {
+ private void performExtractMethodRefactoring() throws CoreException {
ExtractMethodRefactoring extractMethodRefactoring = createExtractMethodRefactoring();
- refactoringExecutor.performRefactoring(extractMethodRefactoring);
+ refactoringPerformer.performRefactoring(extractMethodRefactoring);
assertThatNewMethodNameWasUsedWhenPerformingRefactoring(extractMethodRefactoring);
setNewMethodSignature(extractMethodRefactoring);
createMoveMethodRefactoringTargetFinder(extractMethodRefactoring);
}
- private void checkConditionsAndPerformMoveMethodRefactoring() throws JavaModelException, CoreException {
+ private void performMoveMethodRefactoring() throws JavaModelException, CoreException {
// Here, the method we'd like to move must already exist since we need to look up an IMethod handle:
- refactoringExecutor.performRefactoring(createMoveRefactoring());
+ refactoringPerformer.performRefactoring(createMoveRefactoring());
}
private ExtractMethodRefactoring createExtractMethodRefactoring() throws CoreException {
return method;
}
- private void createRefactoringExecutor(IProgressMonitor monitor, UndoResources undoResources) {
- refactoringExecutor = new SimpleRefactoringPerformer(monitor, undoResources);
+ private void createRefactoringPerformer(IProgressMonitor monitor, UndoResources undoResources) {
+ refactoringPerformer = new SimpleRefactoringPerformer(monitor, undoResources);
}
}
\ No newline at end of file