use of org.eclipse.jdt.launching.VMRunnerConfiguration in project ow by vtst.
the class EasyJavaProgramLaunchConfigurationDelegate method launch.
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;
try {
monitor.subTask(messages.getString("verifying_launch_attributes"));
String mainTypeName = verifyMainTypeName(config);
IVMRunner runner = getVMRunner(config, mode);
File workingDir = verifyWorkingDirectory(config);
String workingDirName = null;
if (workingDir != null) {
workingDirName = workingDir.getAbsolutePath();
}
// Environment variables
String[] envp = getEnvironment(config);
// VM-specific attributes
@SuppressWarnings("unchecked") Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(config);
// Classpath
String[] classpath = getClasspath(config);
// Create VM config
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
runConfig.setProgramArguments(getProgramArgumentsArray(config, fixture));
runConfig.setEnvironment(envp);
runConfig.setVMArguments(getVMArgumentsArray(config, fixture));
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
// Bootpath
runConfig.setBootClassPath(getBootpath(config));
// check for cancellation
if (monitor.isCanceled()) {
return;
}
// stop in main
prepareStopInMain(config);
// done the verification phase
monitor.worked(1);
monitor.subTask(messages.getString("creating_source_locator"));
// set the source locator if required
setDefaultSourceLocator(launch, config);
monitor.worked(1);
// Launch the configuration - 1 unit of work
monitor.subTask(messages.getString("run_external_program"));
runner.run(runConfig, launch, monitor);
for (IProcess process : launch.getProcesses()) {
addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(process));
}
// check for cancellation
if (monitor.isCanceled())
return;
} finally {
monitor.done();
}
}
use of org.eclipse.jdt.launching.VMRunnerConfiguration in project ow by vtst.
the class EasyJavaProgramLaunchConfigurationDelegate method launch.
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;
try {
monitor.subTask(messages.getString("verifying_launch_attributes"));
String mainTypeName = verifyMainTypeName(config);
IVMRunner runner = getVMRunner(config, mode);
File workingDir = verifyWorkingDirectory(config);
String workingDirName = null;
if (workingDir != null) {
workingDirName = workingDir.getAbsolutePath();
}
// Environment variables
String[] envp = getEnvironment(config);
// VM-specific attributes
@SuppressWarnings("unchecked") Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(config);
// Classpath
String[] classpath = getClasspath(config);
// Create VM config
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
runConfig.setProgramArguments(getProgramArgumentsArray(config, fixture));
runConfig.setEnvironment(envp);
runConfig.setVMArguments(getVMArgumentsArray(config, fixture));
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
// Bootpath
runConfig.setBootClassPath(getBootpath(config));
// check for cancellation
if (monitor.isCanceled()) {
return;
}
// stop in main
prepareStopInMain(config);
// done the verification phase
monitor.worked(1);
monitor.subTask(messages.getString("creating_source_locator"));
// set the source locator if required
setDefaultSourceLocator(launch, config);
monitor.worked(1);
// Launch the configuration - 1 unit of work
monitor.subTask(messages.getString("run_external_program"));
runner.run(runConfig, launch, monitor);
for (IProcess process : launch.getProcesses()) {
addProcessListeners(config, fixture, new EasyLaunchConfigurationDelegateUtils.ProcessListernerAcceptorImpl(process));
}
// check for cancellation
if (monitor.isCanceled())
return;
} finally {
monitor.done();
}
}
Aggregations