Search in sources :

Example 21 with OtpErlangRangeException

use of com.ericsson.otp.erlang.OtpErlangRangeException in project erlide_eclipse by erlang.

the class StateDataToRecordRpcMessage method parseRefactoringMessage.

@Override
protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException {
    final OtpErlangObject wranglerResult = resultTuple.elementAt(1);
    if (!"ok".equals(resultTuple.elementAt(0).toString())) {
        final OtpErlangString msg = (OtpErlangString) wranglerResult;
        setUnsuccessful(msg.stringValue());
    } else {
        if ("non_tuple".equals(wranglerResult.toString())) {
            fieldCount = 1;
        } else {
            try {
                fieldCount = ((OtpErlangLong) ((OtpErlangTuple) wranglerResult).elementAt(1)).intValue();
            } catch (final OtpErlangRangeException e) {
                throw new WranglerException(e.getMessage());
            }
        }
        stateFuns = resultTuple.elementAt(2);
        setSuccessful();
    }
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) WranglerException(org.erlide.wrangler.refactoring.exception.WranglerException) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 22 with OtpErlangRangeException

use of com.ericsson.otp.erlang.OtpErlangRangeException in project erlide_eclipse by erlang.

the class ErlangCompletionService method addOffsetsAndLengths.

void addOffsetsAndLengths(final OtpErlangList parOffsets, final int replacementOffset, final List<Location> result) {
    for (final OtpErlangObject i : parOffsets) {
        final OtpErlangTuple t = (OtpErlangTuple) i;
        final OtpErlangLong offset = (OtpErlangLong) t.elementAt(0);
        final OtpErlangLong length = (OtpErlangLong) t.elementAt(1);
        try {
            result.add(new Location(offset.intValue() + replacementOffset, length.intValue()));
        } catch (final OtpErlangRangeException e) {
        }
    }
}
Also used : OtpErlangLong(com.ericsson.otp.erlang.OtpErlangLong) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) Location(org.erlide.engine.services.codeassist.Location)

Example 23 with OtpErlangRangeException

use of com.ericsson.otp.erlang.OtpErlangRangeException in project erlide_eclipse by erlang.

the class ErlideContextAssist method checkRecordCompletion.

public RecordCompletion checkRecordCompletion(final IOtpRpc buildBackend, final String prefix) {
    try {
        final OtpErlangObject res = buildBackend.call("erlide_content_assist", "check_record", "s", prefix);
        if (Util.isOk(res)) {
            final OtpErlangTuple t = (OtpErlangTuple) res;
            final OtpErlangTuple r = (OtpErlangTuple) t.elementAt(1);
            return new RecordCompletion(r);
        }
    } catch (final RpcException e) {
        ErlLogger.error(e);
    } catch (final OtpErlangRangeException e) {
        ErlLogger.error(e);
    }
    return null;
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple)

Aggregations

OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)23 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)18 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)18 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)16 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)8 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)7 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)4 ArrayList (java.util.ArrayList)3 RpcException (org.erlide.runtime.rpc.RpcException)3 WranglerException (org.erlide.wrangler.refactoring.exception.WranglerException)3 OtpErlangBinary (com.ericsson.otp.erlang.OtpErlangBinary)1 OtpErlangException (com.ericsson.otp.erlang.OtpErlangException)1 OtpErlangInt (com.ericsson.otp.erlang.OtpErlangInt)1 OtpErlangPid (com.ericsson.otp.erlang.OtpErlangPid)1 TreeElement (com.intellij.ide.util.treeView.smartTree.TreeElement)1 Date (java.util.Date)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IMarker (org.eclipse.core.resources.IMarker)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1