Search in sources :

Example 11 with RpcResult

use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.

the class RefactoringHandler method checkWarningMessages.

/**
 * Checks whether there is any warning messages, if yes displays a view,
 * containg all of them.
 */
protected void checkWarningMessages() {
    try {
        final RpcResult res = WranglerBackendManager.getRefactoringBackend().getLoggedInfo();
        if (res.isOk()) {
            final OtpErlangObject resobj = res.getValue();
            if (!resobj.equals(new OtpErlangList())) {
                final OtpErlangList reslist = (OtpErlangList) resobj;
                for (int i = 0; i < reslist.arity(); ++i) {
                    final OtpErlangTuple restuple = (OtpErlangTuple) reslist.elementAt(i);
                    final String formattedString = formatWarningString(OtpErlang.asString(restuple.elementAt(1)));
                    WarningViewManager.addWarningMessage(formattedString);
                }
            }
        } else {
            ErlLogger.error("Wrangler logging error:" + res);
        }
    } catch (final Exception e) {
        ErlLogger.error(e);
    }
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) ExecutionException(org.eclipse.core.commands.ExecutionException) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException)

Example 12 with RpcResult

use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.

the class GlobalParameters method hasQuickCheck.

/**
 * Checks if QuickCheck is installed in the current machine.
 *
 * @return true if QC is installed, else false
 */
public static boolean hasQuickCheck() {
    if (GlobalParameters.isQCchecked) {
        return GlobalParameters.hasQuickCheck;
    }
    final RpcResult res = Activator.getDefault().getBackend().call_noexception("code", "which", "a", "eqc");
    if (!res.isOk()) {
        return false;
    }
    if (res.getValue() instanceof OtpErlangString) {
        GlobalParameters.hasQuickCheck = true;
        GlobalParameters.isQCchecked = true;
    } else {
        GlobalParameters.isQCchecked = true;
        GlobalParameters.hasQuickCheck = false;
    }
    return GlobalParameters.hasQuickCheck;
}
Also used : RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 13 with RpcResult

use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.

the class RenameFunctionRefactoring method getDefaultValue.

@Override
public String getDefaultValue() {
    final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
    if (sel == null) {
        return "";
    }
    final RpcResult res = WranglerBackendManager.getRefactoringBackend().callWithoutParser("get_fun_name_eclipse", "siixi", sel.getFilePath(), sel.getSelectionRange().getStartLine(), sel.getSelectionRange().getStartCol(), sel.getSearchPath(), GlobalParameters.getTabWidth());
    if (res.getValue().getClass().equals(OtpErlangString.class)) {
        return ((OtpErlangString) res.getValue()).stringValue();
    }
    return "";
}
Also used : IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 14 with RpcResult

use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.

the class UserRefactoring method fetchParPrompts.

/**
 * Fetch parameter prompts from the right callback module
 *
 * @param module
 */
public boolean fetchParPrompts() {
    if (fetched) {
        return true;
    }
    final RpcResult res = WranglerBackendManager.getRefactoringBackend().callWithoutParser("input_par_prompts_eclipse", "s", callbackModule);
    final OtpErlangList params = (OtpErlangList) ((OtpErlangTuple) res.getValue()).elementAt(1);
    parPrompts.clear();
    for (final OtpErlangObject obj : params.elements()) {
        parPrompts.add(obj.toString().replace("\"", ""));
    }
    fetched = true;
    return true;
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcResult(org.erlide.runtime.rpc.RpcResult)

Example 15 with RpcResult

use of org.erlide.runtime.rpc.RpcResult in project erlide_eclipse by erlang.

the class WranglerRefactoringBackend method callInspection.

/**
 * Call an inspection function
 *
 * @param functionName
 *            function name
 * @param signature
 *            signature
 * @param parameters
 *            function parameters
 * @return RpcResultImpl wrapped result
 */
public RpcResult callInspection(final String functionName, final String signature, final Object... parameters) {
    ErlLogger.info("Wrangler inspection call: " + makeLogStr(functionName, parameters));
    RpcResult res;
    res = backend.call_noexception(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, WranglerRefactoringBackend.INSPECTION_MODULE, functionName, signature, parameters);
    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