use of org.eclipse.debug.core.model.RuntimeProcess 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.RuntimeProcess in project ow by vtst.
the class EasyExtProgramLaunchConfigurationDelegate method launch.
@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
Fixture fixture = getFixture(config);
if (monitor == null)
monitor = new NullProgressMonitor();
monitor.beginTask(config.getName() + "...", 3);
if (monitor.isCanceled())
return;
ProcessBuilder pb = this.getProcessBuilder(config, fixture);
try {
Process process;
try {
// We do not catch NullPointerException or IndexOutOfBoundsException, because it would mean
// the command of the process is null or empty.
process = pb.start();
} catch (SecurityException exn) {
throw createCoreException(messages.getString("process_security_exception"), exn);
} catch (IOException exn) {
throw createCoreException(messages.getString("process_io_exception"), exn);
}
launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "true");
RuntimeProcess runtimeProcess = new RuntimeProcess(launch, process, "External program", Collections.EMPTY_MAP);
runtimeProcess.setAttribute(IProcess.ATTR_CMDLINE, MiscUi.renderCommandLine(pb.command()));
addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(runtimeProcess));
} finally {
monitor.done();
}
}
use of org.eclipse.debug.core.model.RuntimeProcess in project webtools.servertools by eclipse.
the class ExternalLaunchConfigurationDelegate method launch.
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
IServer server = ServerUtil.getServer(configuration);
if (server == null) {
abort(GenericServerCoreMessages.missingServer, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
@SuppressWarnings("null") ExternalServerBehaviour serverBehavior = (ExternalServerBehaviour) server.loadAdapter(ServerBehaviourDelegate.class, null);
// initialize the server, check the ports and start the PingThread that will check
// server state
serverBehavior.setupLaunch(launch, mode, monitor);
// get the "external" command
String commandline = configuration.getAttribute(COMMANDLINE, (String) null);
if (commandline == null || commandline.length() == 0) {
abort(GenericServerCoreMessages.commandlineUnspecified, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
// parse the "external" command into multiple args
String[] cmdArgs = DebugPlugin.parseArguments(commandline);
// get the "programArguments", parsed into multiple args
String[] pgmArgs = DebugPlugin.parseArguments(getProgramArguments(configuration));
// Create the full array of cmds
String[] cmds = new String[cmdArgs.length + pgmArgs.length];
System.arraycopy(cmdArgs, 0, cmds, 0, cmdArgs.length);
System.arraycopy(pgmArgs, 0, cmds, cmdArgs.length, pgmArgs.length);
// get a descriptive name for the executable
String executableName = configuration.getAttribute(EXECUTABLE_NAME, DEFAULT_EXECUTABLE_NAME);
// get the executable environment
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
String[] env = manager.getEnvironment(configuration);
// get the working directory
File workingDir = verifyWorkingDirectory(configuration);
if (workingDir == null) {
abort(GenericServerCoreMessages.workingdirUnspecified, null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
// Launch the executable for the configuration using the Ant Execute class
try {
Process process = Execute.launch(null, cmds, env, workingDir, true);
serverBehavior.startPingThread();
IProcess runtimeProcess = new RuntimeProcess(launch, process, executableName, null);
launch.addProcess(runtimeProcess);
serverBehavior.setProcess(runtimeProcess);
} catch (IOException ioe) {
abort(GenericServerCoreMessages.errorLaunchingExecutable, ioe, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
if (mode.equals("debug")) {
// $NON-NLS-1$
ILaunchConfigurationWorkingCopy wc = createDebuggingConfig(configuration);
// if we're launching the debugging we need to wait for the config to start
// before launching the debugging session
serverBehavior.setDebuggingConfig(wc, mode, launch, monitor);
}
}
use of org.eclipse.debug.core.model.RuntimeProcess in project ow by vtst.
the class EasyExtProgramLaunchConfigurationDelegate method launch.
@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
Fixture fixture = getFixture(config);
if (monitor == null)
monitor = new NullProgressMonitor();
monitor.beginTask(config.getName() + "...", 3);
if (monitor.isCanceled())
return;
ProcessBuilder pb = this.getProcessBuilder(config, fixture);
try {
Process process;
try {
// We do not catch NullPointerException or IndexOutOfBoundsException, because it would mean
// the command of the process is null or empty.
process = pb.start();
} catch (SecurityException exn) {
throw createCoreException(messages.getString("process_security_exception"), exn);
} catch (IOException exn) {
throw createCoreException(messages.getString("process_io_exception"), exn);
}
launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "true");
RuntimeProcess runtimeProcess = new RuntimeProcess(launch, process, "External program", Collections.EMPTY_MAP);
runtimeProcess.setAttribute(IProcess.ATTR_CMDLINE, Utils.renderCommandLine(pb.command()));
addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(runtimeProcess));
} finally {
monitor.done();
}
}
Aggregations