Search in sources :

Example 11 with RpcException

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

the class ErlideContextAssist method getVariables.

public Collection<String> getVariables(final String src, final String prefix) {
    final SortedSet<String> result = new TreeSet<>();
    try {
        final OtpErlangObject res = backend.call("erlide_content_assist", "get_variables", "ss", src, prefix);
        if (Util.isOk(res)) {
            final OtpErlangTuple t = (OtpErlangTuple) res;
            final OtpErlangList l = (OtpErlangList) t.elementAt(1);
            for (final OtpErlangObject i : l) {
                result.add(Util.stringValue(i));
            }
        }
    } catch (final RpcException e) {
        ErlLogger.error(e);
    }
    return result;
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) TreeSet(java.util.TreeSet) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple)

Example 12 with RpcException

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

the class ErlideDoc method getModules.

@Override
public OtpErlangObject getModules(final IOtpRpc b, final String prefix, final List<String> projectModules, final boolean includes) {
    OtpErlangObject res = null;
    try {
        final String what = includes ? "includes" : "modules";
        res = b.call(ErlideDoc.ERLIDE_OTP_DOC, "get_modules", "slsa", prefix, projectModules, what);
    } catch (final RpcException e) {
        ErlLogger.warn(e);
    }
    return res;
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 13 with RpcException

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

the class ErlideDoc method getOtpDoc.

@Override
public OtpErlangObject getOtpDoc(final IOtpRpc b, final ErlangFunctionCall functionCall) {
    OtpErlangObject res = null;
    final OtpErlangTuple input = new OtpErlangTuple(new OtpErlangObject[] { new OtpErlangAtom("external"), new OtpErlangAtom(functionCall.getModule()), new OtpErlangAtom(functionCall.getName()), new OtpErlangInt(functionCall.getArity()), new OtpErlangString("") });
    try {
        res = b.call(ErlideDoc.ERLIDE_OTP_DOC, "get_doc", "sxs", functionCall.getModule(), input, stateDir);
    } catch (final RpcException e) {
        ErlLogger.warn(e);
    }
    return res;
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 14 with RpcException

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

the class ErlideOpen method getLibFiles.

@Override
public List<String> getLibFiles(final String entry) {
    try {
        final OtpErlangObject res = ideBackend.call(ErlideOpen.ERLIDE_OPEN, "get_lib_files", "ss", entry, stateDir);
        if (Util.isOk(res)) {
            final OtpErlangTuple t = (OtpErlangTuple) res;
            final OtpErlangList l = (OtpErlangList) t.elementAt(1);
            final List<String> result = Lists.newArrayListWithCapacity(l.arity());
            for (final OtpErlangObject o : l) {
                result.add(Util.stringValue(o));
            }
            return result;
        }
    } catch (final RpcException e) {
        ErlLogger.error(e);
    }
    return null;
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 15 with RpcException

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

the class ErlideXref method modules.

public static List<String> modules(final IOtpRpc backend) {
    final List<String> result = new ArrayList<>();
    try {
        final OtpErlangObject res = backend.call(ErlideXref.ERLIDE_XREF, "modules", "");
        if (Util.isOk(res)) {
            final OtpErlangTuple t = (OtpErlangTuple) res;
            final OtpErlangList l = (OtpErlangList) t.elementAt(1);
            for (final OtpErlangObject i : l) {
                if (i instanceof OtpErlangAtom) {
                    final OtpErlangAtom m = (OtpErlangAtom) i;
                    result.add(m.atomValue());
                }
            }
        }
    } catch (final RpcException e) {
        ErlLogger.error(e);
    }
    return result;
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) ArrayList(java.util.ArrayList) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Aggregations

RpcException (org.erlide.runtime.rpc.RpcException)37 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)30 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)15 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)12 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)8 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)7 ArrayList (java.util.ArrayList)7 IOtpRpc (org.erlide.runtime.rpc.IOtpRpc)6 RpcFuture (org.erlide.runtime.rpc.RpcFuture)5 OtpErlangPid (com.ericsson.otp.erlang.OtpErlangPid)4 TimeoutException (java.util.concurrent.TimeoutException)4 CoverException (org.erlide.cover.api.CoverException)4 IErlModule (org.erlide.engine.model.root.IErlModule)4 RpcTimeoutException (org.erlide.runtime.rpc.RpcTimeoutException)4 Test (org.junit.Test)4 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)3 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)3 IPath (org.eclipse.core.runtime.IPath)3 IStatus (org.eclipse.core.runtime.IStatus)3 Status (org.eclipse.core.runtime.Status)3