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;
}
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);
}
}
}
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);
}
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);
}
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.");
}
}
}
Aggregations