Search in sources :

Example 11 with OtpErlangAtom

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

the class IndexedErlangValue method checkRecord.

private IErlRecordDef checkRecord(final OtpErlangObject o) {
    if (o instanceof OtpErlangTuple) {
        final OtpErlangTuple t = (OtpErlangTuple) o;
        final OtpErlangObject h = t.elementAt(0);
        if (h instanceof OtpErlangAtom) {
            final OtpErlangAtom a = (OtpErlangAtom) h;
            final ErlangDebugTarget target = getErlangDebugTarget();
            IErlPreprocessorDef pd;
            try {
                pd = ErlangEngine.getInstance().getModelFindService().findPreprocessorDef(getErlProjects(target.getProjects()), moduleName, a.atomValue(), ErlElementKind.RECORD_DEF);
                if (pd instanceof IErlRecordDef) {
                    final IErlRecordDef r = (IErlRecordDef) pd;
                    if (r.hasChildren() && r.getChildCount() + 1 == t.arity()) {
                        return r;
                    }
                }
            } catch (final CoreException e) {
            }
        }
    }
    return null;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IErlRecordDef(org.erlide.engine.model.erlang.IErlRecordDef) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) IErlPreprocessorDef(org.erlide.engine.model.erlang.IErlPreprocessorDef)

Example 12 with OtpErlangAtom

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

the class NewProcessEvent method execute.

@Override
public void execute(final ErlangDebugTarget debugTarget) {
    final OtpErlangTuple t = (OtpErlangTuple) cmds[1];
    final OtpErlangPid pid = (OtpErlangPid) t.elementAt(0);
    final ErlangProcess erlangProcess = debugTarget.getOrCreateErlangProcess(pid);
    final OtpErlangAtom statusA = (OtpErlangAtom) t.elementAt(2);
    final String status = statusA.atomValue();
    erlangProcess.setStatus(status);
    final OtpErlangTuple initialCall = (OtpErlangTuple) t.elementAt(1);
    erlangProcess.setInitialCall(new ErlangFunctionCall(initialCall));
    erlangProcess.fireCreationEvent();
}
Also used : OtpErlangPid(com.ericsson.otp.erlang.OtpErlangPid) ErlangFunctionCall(org.erlide.util.ErlangFunctionCall) ErlangProcess(org.erlide.backend.debug.model.ErlangProcess) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Example 13 with OtpErlangAtom

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

the class NewStatusEvent method execute.

@Override
public void execute(final ErlangDebugTarget debugTarget) {
    final OtpErlangPid pid = (OtpErlangPid) cmds[1];
    final ErlangProcess erlangProcess = debugTarget.getOrCreateErlangProcess(pid);
    final OtpErlangAtom sa = (OtpErlangAtom) cmds[2];
    final String status = sa.atomValue();
    if ("break".equals(status)) {
        handleBreakStatus(erlangProcess, status);
    } else if ("exit".equals(status)) {
        handleExitStatus(erlangProcess, status);
    } else if ("running".equals(status)) {
        handleRunningStatus(erlangProcess, status);
    } else if ("idle".equals(status)) {
        handleIdleStatus(erlangProcess, status);
    } else {
        erlangProcess.setStatus(status);
        erlangProcess.fireChangeEvent(DebugEvent.STATE | DebugEvent.CHANGE);
    }
}
Also used : OtpErlangPid(com.ericsson.otp.erlang.OtpErlangPid) ErlangProcess(org.erlide.backend.debug.model.ErlangProcess) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Example 14 with OtpErlangAtom

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

the class NoInterpretEvent method execute.

@Override
public void execute(final ErlangDebugTarget debugTarget) {
    final OtpErlangAtom m = (OtpErlangAtom) cmds[1];
    debugTarget.getInterpretedModules().remove(m.atomValue());
    debugTarget.fireEvent(new DebugEvent(this, DebugEvent.MODEL_SPECIFIC, ErlangDebugTarget.INTERPRETED_MODULES_CHANGED));
}
Also used : DebugEvent(org.eclipse.debug.core.DebugEvent) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Example 15 with OtpErlangAtom

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

the class ErlangDebugTarget method terminate.

@Override
public void terminate() throws DebugException {
    if (terminated) {
        return;
    }
    terminated = true;
    if (backend != null) {
        if (backend.getOtpRpc() != null) {
            backend.getOtpRpc().send("dbg_mon", new OtpErlangAtom("stop"));
        }
        final DebugPlugin dbgPlugin = DebugPlugin.getDefault();
        if (dbgPlugin != null) {
            dbgPlugin.getBreakpointManager().removeBreakpointListener(this);
        }
        if (debuggerDaemon != null) {
            debuggerDaemon.stop();
        }
        backend.dispose();
    }
    if (launch != null) {
        launch.terminate();
    }
    fireTerminateEvent();
}
Also used : DebugPlugin(org.eclipse.debug.core.DebugPlugin) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Aggregations

OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)87 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)56 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)48 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)32 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)24 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)17 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)14 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)11 RpcException (org.erlide.runtime.rpc.RpcException)11 OtpBindings (org.erlide.util.erlang.OtpBindings)9 IErlElement (org.erlide.engine.model.IErlElement)6 OtpErlangBinary (com.ericsson.otp.erlang.OtpErlangBinary)4 OtpErlangPid (com.ericsson.otp.erlang.OtpErlangPid)4 IErlModule (org.erlide.engine.model.root.IErlModule)4 OtpErlangInt (com.ericsson.otp.erlang.OtpErlangInt)3 OtpErlangMap (com.ericsson.otp.erlang.OtpErlangMap)3 Subscribe (com.google.common.eventbus.Subscribe)3 Collection (java.util.Collection)3 OtpErlangException (com.ericsson.otp.erlang.OtpErlangException)2