use of org.erlide.wrangler.refactoring.backend.internal.RefactoringRpcMessage in project erlide_eclipse by erlang.
the class IntroduceLetRefactoring method getWorkflowController.
@Override
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
return new RefactoringWorkflowController(shell) {
@Override
public void doRefactoring() {
final IErlSelection sel = GlobalParameters.getWranglerSelection();
RefactoringRpcMessage message = (RefactoringRpcMessage) run(sel);
if (message.isSuccessful()) {
changedFiles = message.getRefactoringChangeset();
status = new RefactoringStatus();
} else if (message.getRefactoringState() == RefactoringState.QUESTION) {
if (ask("Question", message.getMessageString())) {
final OtpErlangTuple res = message.getResultObject();
expr = ((OtpErlangTuple) res.elementAt(2)).elementAt(0);
parentExpr = ((OtpErlangTuple) res.elementAt(2)).elementAt(1);
message = (RefactoringRpcMessage) runAlternative(sel);
if (message.isSuccessful()) {
status = new RefactoringStatus();
changedFiles = message.getRefactoringChangeset();
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
} else {
status = RefactoringStatus.createFatalErrorStatus("Refactoring failed: the expression selected is not a QuickCheck generator.");
}
} else if (message.getRefactoringState() == RefactoringState.ERROR) {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
}
};
}
Aggregations