use of org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException in project erlide_eclipse by erlang.
the class RefactoringRpcMessage method parseRefactoringMessage.
@Override
protected void parseRefactoringMessage(final OtpErlangTuple tuple) throws WranglerRpcParsingException {
resultTuple = tuple;
final OtpErlangObject wranglerResult = tuple.elementAt(1);
if ("ok".equals(tuple.elementAt(0).toString())) {
if (wranglerResult instanceof OtpErlangList) {
changedFiles = parseFileList((OtpErlangList) wranglerResult);
setSuccessful();
return;
}
} else {
final OtpErlangString msg = (OtpErlangString) wranglerResult;
if ("warning".equals(tuple.elementAt(0).toString())) {
setWarning(msg.stringValue());
} else if ("question".equals(tuple.elementAt(0).toString())) {
setQuestion(msg.stringValue());
} else {
setUnsuccessful(msg.stringValue());
}
return;
}
throw new WranglerRpcParsingException(tuple.toString());
}
use of org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException in project erlide_eclipse by erlang.
the class ExpressionSearchAction method callRefactoring.
@Override
protected IResultParser callRefactoring() throws WranglerRpcParsingException {
final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
final WranglerRefactoringBackend backend = WranglerBackendManager.getRefactoringBackend();
final RpcResult result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, "expr_search_eclipse", "sxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), sel.getSelectionRange().getEndPos(), GlobalParameters.getTabWidth());
if (result.isOk()) {
return new ExpressionSearchParser(result.getValue());
}
throw new WranglerRpcParsingException("RPC error");
}
use of org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException in project erlide_eclipse by erlang.
the class GenFunRefactoringMessage method parseRefactoringMessage.
@Override
protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException {
final OtpErlangObject wranglerResult = resultTuple.elementAt(1);
final String state = resultTuple.elementAt(0).toString();
if ("ok".equals(state)) {
if (wranglerResult instanceof OtpErlangList) {
changedFiles = parseFileList((OtpErlangList) wranglerResult);
setSuccessful();
return;
}
} else if ("error".equals(state)) {
final OtpErlangString msg = (OtpErlangString) wranglerResult;
setUnsuccessful(msg.stringValue());
return;
} else if ("multiple_instances".equals(state)) {
parameters = new HashMap<>();
final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult;
setState("", RefactoringState.MULTI_INSTANCES);
parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0));
parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1));
parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2));
parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3));
parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4));
parameters.put(GenFunReturnParameterName.sideEffect, pars.elementAt(5));
parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6));
parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(7));
} else if ("unknown_side_effect".equals(state)) {
parameters = new HashMap<>();
final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult;
setState("", RefactoringState.UNKNOWN_SIDE_EFFECT);
parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0));
parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1));
parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2));
parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3));
parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4));
parameters.put(GenFunReturnParameterName.noOfClauses, pars.elementAt(5));
parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6));
parameters.put(GenFunReturnParameterName.dupsInClause, pars.elementAt(7));
parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(8));
} else if ("more_than_one_clause".equals(state)) {
parameters = new HashMap<>();
final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult;
setState("", RefactoringState.MORE_THAN_ONE_CLAUSE);
parameters.put(GenFunReturnParameterName.parName, pars.elementAt(0));
parameters.put(GenFunReturnParameterName.funName, pars.elementAt(1));
parameters.put(GenFunReturnParameterName.arity, pars.elementAt(2));
parameters.put(GenFunReturnParameterName.funDefPos, pars.elementAt(3));
parameters.put(GenFunReturnParameterName.exp, pars.elementAt(4));
parameters.put(GenFunReturnParameterName.sideEffect, pars.elementAt(5));
parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6));
parameters.put(GenFunReturnParameterName.dupsInClause, pars.elementAt(7));
parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(8));
} else {
throw new WranglerRpcParsingException(resultTuple.toString());
}
}
Aggregations