return new RefactoringWorkflowController(shell) {
@Override
public void doRefactoring() {
final IErlSelection sel = GlobalParameters.getWranglerSelection();
IRefactoringRpcMessage message = run(sel);
if (message.isSuccessful()) {
changedFiles = message.getRefactoringChangeset();
status = new RefactoringStatus();
} else if (message.getRefactoringState() == RefactoringState.QUESTION) {
renameTestMod = ask("Question", message.getMessageString());
message = runAlternative(sel);
if (message.getRefactoringState() == RefactoringState.OK) {
changedFiles = message.getRefactoringChangeset();
status = new RefactoringStatus();
} else {
status = RefactoringStatus.createFatalErrorStatus(message
.getMessageString());
}
} else if (message.getRefactoringState() == RefactoringState.WARNING) {
renameTestMod = !ask("Warning", message.getMessageString());
if (!renameTestMod) {
message = runAlternative(sel);
if (message.getRefactoringState() == RefactoringState.OK) {
changedFiles = message.getRefactoringChangeset();
status = new RefactoringStatus();
} else {
status = RefactoringStatus.createFatalErrorStatus(message
.getMessageString());
}
} else {
stop();
}
} else {
status = RefactoringStatus.createFatalErrorStatus(message
.getMessageString());
}
}
};