use of org.eclipse.debug.core.ILaunchManager in project mdw-designer by CenturyLinkCloud.
the class GherkinTestCaseLaunch method getLaunchConfiguration.
/**
* Actually returns a working copy since we don't save this launch config.
*/
public ILaunchConfiguration getLaunchConfiguration() throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(CUCUMBER_LAUNCH_TYPE);
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "mdwCucumberLaunch_" + getTestCase().getCaseName());
List<String> resPaths = new ArrayList<>();
resPaths.add("/" + workflowProject.getName());
workingCopy.setAttribute(CucumberLaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, resPaths);
List<String> resTypes = new ArrayList<>();
resTypes.add(CucumberLaunchConfiguration.RESOURCE_TYPE_PROJECT);
workingCopy.setAttribute(CucumberLaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, resTypes);
workingCopy.setAttribute(CucumberLaunchConfiguration.ATTR_USE_START_ON_FIRST_THREAD, true);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, workflowProject.getName());
// TODO user-specified arguments (especially glue)
StringBuilder args = new StringBuilder(CucumberLaunchConfiguration.DEFAULT_ARGS);
// glue
if (workflowProject.isFilePersist()) {
for (WorkflowPackage gluePackage : getGluePackages()) args.append(" --glue \"").append(gluePackage.getFolder().getProjectRelativePath()).append("\"");
}
// legacy glue
File oldGlueFile = new File(workflowProject.getOldTestCasesDir() + "/steps.groovy");
if (oldGlueFile.exists())
args.append(" --glue \"").append(oldGlueFile.toString().replace('\\', '/')).append("\"");
// feature
if (getTestCase().isLegacy()) {
String oldTestSuiteLoc = workflowProject.getOldTestCasesDir().toString().replace('\\', '/');
args.append(" \"").append(oldTestSuiteLoc).append("/").append(getTestCase().getCaseName()).append("\"");
} else {
args.append(" \"").append(workflowProject.getAssetFolder().getProjectRelativePath()).append("/").append(getTestCase().getPrefix().replace('.', '/')).append("/").append(getTestCase().getName()).append(RuleSetVO.getFileExtension(RuleSetVO.FEATURE)).append("\"");
}
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args.toString());
String vmArgs = "-Dmdw.test.case=" + getTestCase().getCaseName();
if (getTestCase().isLegacy())
vmArgs += " -Dmdw.test.cases.dir=\"" + workflowProject.getOldTestCasesDir().toString().replace('\\', '/') + "\"";
else
vmArgs += " -Dmdw.test.case.file=\"" + getTestCase().getCaseFile().toString().replace('\\', '/') + "\"";
vmArgs += " -Dmdw.test.case.user=" + workflowProject.getUser().getUsername();
vmArgs += " -Dmdw.test.server.url=" + workflowProject.getServiceUrl();
if (stubbing) {
vmArgs += " -Dmdw.test.server.stub=true";
vmArgs += " -Dmdw.test.server.stubPort=" + workflowProject.getServerSettings().getStubServerPort();
}
if (workflowProject.isOldNamespaces())
vmArgs += " -Dmdw.test.old.namespaces=true";
if (singleServer)
vmArgs += " -Dmdw.test.pin.to.server=true";
if (createReplace)
vmArgs += " -Dmdw.test.create.replace=true";
vmArgs += " -Dmdw.test.results.dir=\"" + getTestCase().getResultDirectory().toString().replace('\\', '/') + "\"";
if (workflowProject.isFilePersist())
vmArgs += " -Dmdw.test.workflow.dir=\"" + workflowProject.getAssetDir().toString().replace('\\', '/') + "\"";
else
vmArgs += " -Dmdw.test.jdbc.url=" + workflowProject.getMdwDataSource().getJdbcUrlWithCredentials();
if (verbose)
vmArgs += " -Dmdw.test.verbose=true";
if (this.getMasterRequestId() != null)
vmArgs += " -Dmdw.test.masterRequestId=" + this.getMasterRequestId();
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs);
return workingCopy;
}
use of org.eclipse.debug.core.ILaunchManager in project bndtools by bndtools.
the class AbstractLaunchShortcut method findLaunchConfig.
protected ILaunchConfiguration findLaunchConfig(IPath targetPath) throws CoreException {
List<ILaunchConfiguration> candidateConfigs = new ArrayList<ILaunchConfiguration>();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId);
ILaunchConfiguration[] configs = manager.getLaunchConfigurations(configType);
for (int i = 0; i < configs.length; i++) {
ILaunchConfiguration config = configs[i];
String configTargetName = config.getAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, (String) null);
if (configTargetName != null && configTargetName.equals(targetPath.toString())) {
candidateConfigs.add(config);
}
}
// Return the latest (last in the list)
return !candidateConfigs.isEmpty() ? candidateConfigs.get(candidateConfigs.size() - 1) : null;
}
use of org.eclipse.debug.core.ILaunchManager in project jop by jop-devel.
the class JOPizer method createJOPizeLaunchConfiguration.
private ILaunchConfiguration createJOPizeLaunchConfiguration(String programArguments) throws CoreException {
String configName = "JOPize";
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
for (ILaunchConfiguration config : configs) {
if (config.getName().equals(configName)) {
config.delete();
break;
}
}
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, configName);
IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
Map attributes = workingCopy.getAttributes();
attributes.put(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "com.jopdesign.build.JOPizer");
attributes.put(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments);
IPreferenceStore prefs = JOPUIPlugin.getDefault().getPreferenceStore();
String jopHome = prefs.getString(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME);
IPath jopTools = new Path(jopHome).append(new Path("java/tools/dist/lib/jop-tools.jar"));
IRuntimeClasspathEntry jopToolsEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(jopTools);
jopToolsEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
IPath jopClasses = new Path(jopHome).append(new Path("java/target/dist/lib/classes.zip"));
IRuntimeClasspathEntry jopClassesEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(jopClasses);
jopClassesEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
// IClasspathEntry jreEntry = JavaRuntime.getDefaultJREContainerEntry();
List<String> classpath = new ArrayList<String>();
classpath.add(jopToolsEntry.getMemento());
classpath.add(jopClassesEntry.getMemento());
// classpath.add(jreEntry.get)
attributes.put(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
attributes.put(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
attributes.put(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dmgci=false");
workingCopy.setAttributes(attributes);
System.err.printf("> %s%n", workingCopy.toString());
return workingCopy;
}
use of org.eclipse.debug.core.ILaunchManager in project arduino-eclipse-plugin by Sloeber.
the class LaunchShortcut method getLaunchConfigurations.
/**
* Searches for all applicable launch configurations for this project.
*
* @return list with the launch configurations.
*/
private ArrayList<ILaunchConfiguration> getLaunchConfigurations() {
ArrayList<ILaunchConfiguration> result = new ArrayList<>();
try {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(LaunchConfiguration.LAUNCH_CONFIGURATION_TYPE_ID);
ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type);
for (int i = 0; i < configurations.length; i++) {
ILaunchConfiguration config = configurations[i];
if (!DebugUITools.isPrivate(config) && isGoodMatch(config)) {
result.add(config);
}
}
} catch (CoreException e) {
// Stupid Exception
}
return result;
}
use of org.eclipse.debug.core.ILaunchManager in project erlide_eclipse by erlang.
the class ConsoleRemoveLaunchAction method run.
@Override
public synchronized void run() {
final ILaunch launch = getLaunch();
if (launch != null) {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
launchManager.removeLaunch(launch);
ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[] { fConsole });
fConsoleView = null;
fLaunch = null;
}
}
Aggregations