use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method handleNonTailRecursiveCall.
private void handleNonTailRecursiveCall(final IErlSelection wranglerSelection, final Shell shell) {
CodeInspectionViewsManager.hideView(SimpleCodeInspectionHandler.NON_TAIL_RECURSIVE_VIEW_ID);
try {
final String inFile = "non_tail_recursive_servers_in_file_eclipse";
final String inProject = "non_tail_recursive_servers_in_dirs_eclipse";
final Boolean answer = MessageDialog.openQuestion(shell, "Find non tail recursive servers", "Would you like to run the scan in the whole project?");
String function = "";
RpcResult res = null;
if (!answer) {
function = inFile;
res = WranglerBackendManager.getRefactoringBackend().callInspection(function, "sxi", wranglerSelection.getFilePath(), wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
} else {
function = inProject;
res = WranglerBackendManager.getRefactoringBackend().callInspection(function, "xi", wranglerSelection.getSearchPath(), GlobalParameters.getTabWidth());
}
final ArrayList<IErlElement> elements = processFunctionResult(shell, res);
if (elements == null) {
return;
}
if (!elements.isEmpty()) {
CodeInspectionViewsManager.showErlElements("Non tail recursive servers", elements, SimpleCodeInspectionHandler.NON_TAIL_RECURSIVE_VIEW_ID);
} else {
MessageDialog.openInformation(shell, "No result", "Could not found any non tail recursive server!");
}
} catch (final Exception e) {
ErlLogger.error(e);
}
}
use of org.erlide.runtime.rpc.RpcResult 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.runtime.rpc.RpcResult in project erlide_eclipse by erlang.
the class WranglerSyntaxBackend method parseFile.
protected OtpErlangTuple parseFile(final IFile f) {
final String filePath = f.getLocation().toOSString();
final RpcResult res = backend.call_noexception(WranglerSyntaxBackend.MODULE, WranglerSyntaxBackend.PARSE_FUNCTION, "sax", filePath, "true", GlobalParameters.getWranglerSelection().getSearchPath());
return parseParserResult(res.getValue());
}
use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.
the class WranglerRefactoringBackend method callWithoutParser.
/**
* Send an RPC without using any RpcResultImpl parser
*
* @param timeout
* timeout for the RPC
* @param functionName
* function name
* @param signature
* signature for the parameters
* @param parameters
* parameters
* @return RpcResultImpl object
*/
public RpcResult callWithoutParser(final int timeout, final String functionName, final String signature, final Object... parameters) {
ErlLogger.info("Wrangler call: " + makeLogStr(functionName, parameters));
RpcResult res;
if (timeout < 0) {
res = backend.call_noexception(WranglerRefactoringBackend.MODULE, functionName, signature, parameters);
} else {
res = backend.call_noexception(timeout, WranglerRefactoringBackend.MODULE, functionName, signature, parameters);
}
// ErlLogger.info("Warning: " + err);
return res;
}
use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.
the class WranglerRefactoringBackend method getLoggedInfo.
/**
* Gets logged info (warnings, errors) from Wrangler
*
* @return log list
*/
public RpcResult getLoggedInfo() {
final RpcResult res = backend.call_noexception("wrangler_error_logger", "get_logged_info", "");
@SuppressWarnings("unused") final RpcResult res2 = backend.call_noexception("wrangler_error_logger", "remove_all_from_logger", "");
return res;
}
Aggregations