use of org.erlide.wrangler.refactoring.core.RefactoringWorkflowController 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());
}
}
};
}
use of org.erlide.wrangler.refactoring.core.RefactoringWorkflowController in project erlide_eclipse by erlang.
the class ExtractFunctionRefactoring method getWorkflowController.
@Override
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
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.WARNING) {
final boolean answer = !ask("Warning", message.getMessageString());
if (answer) {
message = runAlternative(sel);
if (message.getRefactoringState() == RefactoringState.OK) {
status = new RefactoringStatus();
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
} else {
stop();
}
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
}
};
}
use of org.erlide.wrangler.refactoring.core.RefactoringWorkflowController in project erlide_eclipse by erlang.
the class RenameModuleRefactoring method getWorkflowController.
@Override
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
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());
}
}
};
}
use of org.erlide.wrangler.refactoring.core.RefactoringWorkflowController in project erlide_eclipse by erlang.
the class UserRefactoring method getWorkflowController.
/**
* Defines workflow of the refactoring, sets changed files and status
*
* @param shell
* @return
*/
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
return new RefactoringWorkflowController(shell) {
@Override
public void doRefactoring() {
final IErlSelection sel = GlobalParameters.getWranglerSelection();
final IRefactoringRpcMessage message = run(sel);
if (message.isSuccessful()) {
changedFiles = message.getRefactoringChangeset();
status = new RefactoringStatus();
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
}
};
}
use of org.erlide.wrangler.refactoring.core.RefactoringWorkflowController in project erlide_eclipse by erlang.
the class RenameFunctionRefactoring method getWorkflowController.
@Override
public RefactoringWorkflowController getWorkflowController(final Shell shell) {
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.WARNING) {
if (ask("Warning", message.getMessageString())) {
message = runAlternative(sel);
if (message.getRefactoringState() == RefactoringState.OK) {
status = new RefactoringStatus();
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
} else {
stop();
}
} else {
status = RefactoringStatus.createFatalErrorStatus(message.getMessageString());
}
}
};
}
Aggregations