use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchShortcut method findExistingLaunchConfiguration.
protected ILaunchConfiguration findExistingLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, WorkflowProject workflowProject, boolean debug) throws CoreException {
String wcWorkflowProj = workingCopy.getAttribute(ProcessLaunchConfiguration.WORKFLOW_PROJECT, "");
String wcProcessName = workingCopy.getAttribute(ProcessLaunchConfiguration.PROCESS_NAME, "");
String wcProcessVersion = workingCopy.getAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, "");
ILaunchConfigurationType configType = workingCopy.getType();
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(configType);
for (ILaunchConfiguration launchConfig : configs) {
String workflowProj = launchConfig.getAttribute(ProcessLaunchConfiguration.WORKFLOW_PROJECT, "");
if (!wcWorkflowProj.equals(workflowProj))
continue;
String processName = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_NAME, "");
if (!wcProcessName.equals(processName))
continue;
String processVersion = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, "");
if (!wcProcessVersion.equals(processVersion)) {
// match without process version; just update version attribute
// if not matching
ILaunchConfigurationWorkingCopy updatedWc = launchConfig.getWorkingCopy();
updatedWc.setAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, wcProcessVersion);
launchConfig = updatedWc.doSave();
}
if (debug) {
// launch config has matched; just update debug attributes if
// blank
String debugProj = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String vmConnector = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, "");
Map<?, ?> connectAttrMap = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, new HashMap<String, String>());
ILaunchConfigurationWorkingCopy updatedWc = null;
if (debugProj.isEmpty()) {
updatedWc = launchConfig.getWorkingCopy();
updatedWc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, workflowProject.getSourceProject().getName());
}
if (vmConnector.isEmpty()) {
if (updatedWc == null)
updatedWc = launchConfig.getWorkingCopy();
updatedWc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, "org.eclipse.jdt.launching.socketAttachConnector");
}
if (connectAttrMap.isEmpty()) {
if (updatedWc == null)
updatedWc = launchConfig.getWorkingCopy();
updatedWc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, getDefaultConnectArgs(workflowProject));
}
if (updatedWc != null)
launchConfig = updatedWc.doSave();
}
return launchConfig;
}
return null;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class ExternalEventLaunchShortcut method createLaunchConfiguration.
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(ExternalEvent externalEvent) throws CoreException {
WorkflowProject workflowProject = externalEvent.getProject();
String launchConfigName = getUniqueLaunchConfigName(externalEvent);
ILaunchConfigurationType configType = getLaunchManager().getLaunchConfigurationType(EXTERNAL_EVENT_LAUNCH_CONFIG_TYPE);
ILaunchConfigurationWorkingCopy wc = configType.newInstance(workflowProject.getSourceProject(), launchConfigName);
wc.setAttribute(ExternalEventLaunchConfiguration.WORKFLOW_PROJECT, workflowProject.getName());
wc.setAttribute(ExternalEventLaunchConfiguration.EVENT_NAME, externalEvent.getName());
return wc;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class ExternalEventLaunchShortcut method getUniqueLaunchConfigName.
protected String getUniqueLaunchConfigName(ExternalEvent externalEvent) throws CoreException {
String name = externalEvent.getName();
ILaunchConfigurationType configType = getLaunchManager().getLaunchConfigurationType(EXTERNAL_EVENT_LAUNCH_CONFIG_TYPE);
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(configType);
for (ILaunchConfiguration launchConfig : configs) {
if (launchConfig.getName().equals(name)) {
name = externalEvent.getName() + " (" + externalEvent.getProject().getName() + ")";
break;
}
}
return getLaunchManager().generateLaunchConfigurationName(name);
}
use of org.eclipse.debug.core.ILaunchConfigurationType 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.ILaunchConfigurationType 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;
}
Aggregations