Search in sources :

Example 1 with IErlangDebugNode

use of org.erlide.backend.debug.IErlangDebugNode in project erlide_eclipse by erlang.

the class ErlangDebugTarget method createErlangProcess.

private ErlangProcess createErlangProcess(final OtpErlangPid pid) {
    final String theNodeName = pid.node();
    final IDebugTarget[] targets = getLaunch().getDebugTargets();
    for (final IDebugTarget debugTarget : targets) {
        try {
            if (debugTarget.getName().equals(theNodeName)) {
                if (debugTarget instanceof IErlangDebugNode) {
                    final IErlangDebugNode edn = (IErlangDebugNode) debugTarget;
                    final ErlangProcess p = new ErlangProcess(debugTarget, getBackend(), pid);
                    edn.addErlangProcess(p);
                    allProcesses.add(p);
                    return p;
                }
            }
        } catch (final DebugException e) {
            ErlLogger.error(e);
        }
    }
    final ErlangProcess p = new ErlangProcess(this, getBackend(), pid);
    addErlangProcess(p);
    allProcesses.add(p);
    return p;
}
Also used : IErlangDebugNode(org.erlide.backend.debug.IErlangDebugNode) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) DebugException(org.eclipse.debug.core.DebugException)

Example 2 with IErlangDebugNode

use of org.erlide.backend.debug.IErlangDebugNode in project erlide_eclipse by erlang.

the class InterpretedModulesView method contextActivated.

private void contextActivated(final ISelection selection) {
    if (!isAvailable() || !isVisible()) {
        return;
    }
    erlangDebugTarget = null;
    if (selection instanceof IStructuredSelection) {
        final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        final Object o = structuredSelection.getFirstElement();
        if (o instanceof ErlangDebugElement) {
            final ErlangDebugElement e = (ErlangDebugElement) o;
            erlangDebugTarget = e.getErlangDebugTarget();
        } else if (o instanceof ILaunch) {
            final ILaunch launch = (ILaunch) o;
            final IDebugTarget target = launch.getDebugTarget();
            if (target instanceof IErlangDebugNode) {
                final IErlangDebugNode edn = (IErlangDebugNode) target;
                erlangDebugTarget = edn.getErlangDebugTarget();
            }
        } else if (o instanceof RuntimeProcess) {
            final RuntimeProcess ep = (RuntimeProcess) o;
            final ILaunch launch = ep.getLaunch();
            final IDebugTarget target = launch.getDebugTarget();
            if (target instanceof IErlangDebugNode) {
                final IErlangDebugNode edn = (IErlangDebugNode) target;
                erlangDebugTarget = edn.getErlangDebugTarget();
            }
        }
        if (erlangDebugTarget == null) {
            ErlLogger.debug("no debug target found for " + selection);
            return;
        }
        final ILaunchConfiguration launchConfiguration = erlangDebugTarget.getLaunch().getLaunchConfiguration();
        setViewerInput(launchConfiguration);
        try {
            final EnumSet<ErlDebugFlags> debugFlags = ErlDebugFlags.makeSet(launchConfiguration.getAttribute(ErlRuntimeAttributes.DEBUG_FLAGS, ErlDebugFlags.getFlag(ErlDebugFlags.DEFAULT_DEBUG_FLAGS)));
            distributed = debugFlags.contains(ErlDebugFlags.DISTRIBUTED_DEBUG);
        } catch (final CoreException e1) {
            distributed = false;
        }
    }
    listViewer.refresh();
    showViewer();
// updateAction(VARIABLES_FIND_ELEMENT_ACTION);
// updateAction(FIND_ACTION);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IErlangDebugNode(org.erlide.backend.debug.IErlangDebugNode) CoreException(org.eclipse.core.runtime.CoreException) ErlDebugFlags(org.erlide.runtime.api.ErlDebugFlags) RuntimeProcess(org.eclipse.debug.core.model.RuntimeProcess) ILaunch(org.eclipse.debug.core.ILaunch) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ErlangDebugElement(org.erlide.backend.debug.model.ErlangDebugElement)

Aggregations

IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)2 IErlangDebugNode (org.erlide.backend.debug.IErlangDebugNode)2 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)1 CoreException (org.eclipse.core.runtime.CoreException)1 DebugException (org.eclipse.debug.core.DebugException)1 ILaunch (org.eclipse.debug.core.ILaunch)1 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 RuntimeProcess (org.eclipse.debug.core.model.RuntimeProcess)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 ErlangDebugElement (org.erlide.backend.debug.model.ErlangDebugElement)1 ErlDebugFlags (org.erlide.runtime.api.ErlDebugFlags)1