Search in sources :

Example 21 with RpcResult

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);
    }
}
Also used : IErlElement(org.erlide.engine.model.IErlElement) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) ErlModelException(org.erlide.engine.model.ErlModelException) ExecutionException(org.eclipse.core.commands.ExecutionException) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException)

Example 22 with RpcResult

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");
}
Also used : WranglerRefactoringBackend(org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) WranglerRpcParsingException(org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)

Example 23 with RpcResult

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());
}
Also used : RpcResult(org.erlide.runtime.rpc.RpcResult)

Example 24 with RpcResult

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;
}
Also used : RpcResult(org.erlide.runtime.rpc.RpcResult)

Example 25 with RpcResult

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;
}
Also used : RpcResult(org.erlide.runtime.rpc.RpcResult)

Aggregations

RpcResult (org.erlide.runtime.rpc.RpcResult)26 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)10 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)8 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)7 ExecutionException (org.eclipse.core.commands.ExecutionException)7 ErlModelException (org.erlide.engine.model.ErlModelException)7 WranglerException (org.erlide.wrangler.refactoring.exception.WranglerException)7 IErlElement (org.erlide.engine.model.IErlElement)6 IErlMemberSelection (org.erlide.wrangler.refactoring.selection.IErlMemberSelection)6 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)5 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)4 WranglerRefactoringBackend (org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend)4 WranglerRpcParsingException (org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)4 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)3 ArrayList (java.util.ArrayList)2 InputDialogWithCheckbox (org.erlide.wrangler.refactoring.codeinspection.ui.InputDialogWithCheckbox)2 OtpErlangFloat (com.ericsson.otp.erlang.OtpErlangFloat)1 OtpErlangInt (com.ericsson.otp.erlang.OtpErlangInt)1 Enumeration (java.util.Enumeration)1 LinkedList (java.util.LinkedList)1