Search in sources :

Example 1 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget 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 IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project erlide_eclipse by erlang.

the class ErlangDebugTarget method addNodesAsDebugTargets.

private void addNodesAsDebugTargets(final ILaunch aLaunch) {
    final OtpErlangList nodes = ErlideDebug.nodes(backend.getOtpRpc());
    if (nodes != null) {
        for (int i = 1, n = nodes.arity(); i < n; ++i) {
            final OtpErlangAtom a = (OtpErlangAtom) nodes.elementAt(i);
            final IDebugTarget edn = new ErlangDebugNode(this, a.atomValue());
            aLaunch.addDebugTarget(edn);
        }
    }
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlangDebugNode(org.erlide.backend.debug.IErlangDebugNode) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) ErlangLineBreakpoint(org.erlide.backend.debug.ErlangLineBreakpoint)

Example 3 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget 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)

Example 4 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project erlide_eclipse by erlang.

the class ConsolePageParticipant method getShowInContext.

@Override
public ShowInContext getShowInContext() {
    final IProcess process = getProcess();
    if (process == null) {
        return null;
    }
    final IDebugTarget target = process.getAdapter(IDebugTarget.class);
    ISelection selection = null;
    if (target == null) {
        selection = new TreeSelection(new TreePath(new Object[] { DebugPlugin.getDefault().getLaunchManager(), process.getLaunch(), process }));
    } else {
        selection = new TreeSelection(new TreePath(new Object[] { DebugPlugin.getDefault().getLaunchManager(), target.getLaunch(), target }));
    }
    return new ShowInContext(null, selection);
}
Also used : TreePath(org.eclipse.jface.viewers.TreePath) ShowInContext(org.eclipse.ui.part.ShowInContext) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ISelection(org.eclipse.jface.viewers.ISelection) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) IProcess(org.eclipse.debug.core.model.IProcess)

Example 5 with IDebugTarget

use of org.eclipse.debug.core.model.IDebugTarget in project liferay-ide by liferay.

the class DebugPortalLaunchParticipant method portalPostLaunch.

public void portalPostLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
    final IServerManagerConnection connection = ServerUtil.getServerManagerConnection(server, monitor);
    if (connection != null) {
        try {
            final String fmDebugPassword = connection.getFMDebugPassword();
            final int fmDebugPort = connection.getFMDebugPort();
            if (fmDebugPassword != null && fmDebugPort != -1) {
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PASSWORD, fmDebugPassword);
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, Integer.toString(fmDebugPort));
                final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
                launch.addDebugTarget(target);
            }
        } catch (APIException e) {
            LiferayServerCore.logError("Unable to determine remote freemarker debugger connection info.", e);
        }
    }
    this.saveLaunchMode = null;
    final String stopServer = configuration.getAttribute(STOP_SERVER, "false");
    if (ILaunchManager.DEBUG_MODE.equals(mode) && "false".equals(stopServer)) {
        if (this.fmDebugPort != null) {
            launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, this.fmDebugPort);
            this.fmDebugPort = null;
            final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
            launch.addDebugTarget(target);
        } else {
            // $NON-NLS-1$
            PortalCore.logError("Launch freemarker port is invalid.");
        }
    }
}
Also used : FMDebugTarget(com.liferay.ide.portal.core.debug.fm.FMDebugTarget) IServer(org.eclipse.wst.server.core.IServer) APIException(com.liferay.ide.core.remote.APIException) IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Aggregations

IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)23 DebugException (org.eclipse.debug.core.DebugException)4 ILaunch (org.eclipse.debug.core.ILaunch)4 EObject (org.eclipse.emf.ecore.EObject)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 IErlangDebugNode (org.erlide.backend.debug.IErlangDebugNode)3 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)2 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 PlatformObject (org.eclipse.core.runtime.PlatformObject)2 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)2 IProcess (org.eclipse.debug.core.model.IProcess)2 IJavaDebugTarget (org.eclipse.jdt.debug.core.IJavaDebugTarget)2 IVMConnector (org.eclipse.jdt.launching.IVMConnector)2 JAXPDebugTarget (org.eclipse.wst.xsl.jaxp.launching.model.JAXPDebugTarget)2 ErlangLineBreakpoint (org.erlide.backend.debug.ErlangLineBreakpoint)2 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)1 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)1