use of org.eclipse.debug.core.ILaunchConfigurationType in project pivot by apache.
the class PivotScriptApplicationLaunchShortcut method createLaunchConfiguration.
protected ILaunchConfiguration createLaunchConfiguration(IFile file) {
ILaunchConfiguration launchConfiguration = null;
try {
String fileProjectName = file.getProject().getName();
String fileName = file.getName();
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
String name = launchManager.generateUniqueLaunchConfigurationNameFrom(fileName);
ILaunchConfigurationWorkingCopy workingLaunchConfiguration = configurationType.newInstance(null, name);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, PivotPlugin.MAIN_TYPE_NAME);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fileProjectName);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getProgramArguments(file));
workingLaunchConfiguration.setMappedResources(new IResource[] { file });
launchConfiguration = workingLaunchConfiguration.doSave();
} catch (CoreException exception) {
MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
}
return launchConfiguration;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestLaunchShortcut method createLaunchConfiguration.
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(WorkflowProject workflowProject, WorkflowPackage workflowPackage, boolean isLegacyLaunch, String testName, List<String> testCases, boolean debug) throws CoreException {
ILaunchConfigurationType configType;
if (debug) {
configType = getLaunchManager().getLaunchConfigurationType(DEBUG_TYPE_ID);
} else {
configType = getLaunchManager().getLaunchConfigurationType(TYPE_ID);
}
ILaunchConfigurationWorkingCopy wc = configType.newInstance(workflowProject.getSourceProject(), getLaunchManager().generateLaunchConfigurationName(testName));
wc.setAttribute(AutomatedTestLaunchConfiguration.WORKFLOW_PROJECT, workflowProject.getName());
if (workflowPackage == null || workflowPackage.equals(workflowProject.getDefaultPackage()))
wc.removeAttribute(AutomatedTestLaunchConfiguration.WORKFLOW_PACKAGE);
else
wc.setAttribute(AutomatedTestLaunchConfiguration.WORKFLOW_PACKAGE, workflowPackage.getName());
wc.setAttribute(AutomatedTestLaunchConfiguration.IS_LEGACY_LAUNCH, isLegacyLaunch);
wc.setAttribute(AutomatedTestCase.FUNCTION_TEST + "_" + AutomatedTestLaunchConfiguration.RESULTS_PATH, workflowProject.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST));
wc.setAttribute(AutomatedTestCase.LOAD_TEST + "_" + AutomatedTestLaunchConfiguration.RESULTS_PATH, workflowProject.getTestResultsPath(AutomatedTestCase.LOAD_TEST));
wc.setAttribute(AutomatedTestCase.FUNCTION_TEST + "_" + AutomatedTestLaunchConfiguration.TEST_CASES, testCases);
wc.setAttribute(AutomatedTestCase.LOAD_TEST + "_" + AutomatedTestLaunchConfiguration.TEST_CASES, testCases);
return wc;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class CucumberLaunchShortcut method performLaunch.
private void performLaunch(List<CucumberTest> tests, IFolder folder) throws CoreException {
IProject project = tests.get(0).getProject();
String launchName;
if (folder == null)
launchName = project.getName();
else
launchName = folder.getName();
List<String> testCases = new ArrayList<>();
for (CucumberTest test : tests) {
String testPath = test.getPath();
if (folder != null)
testPath = testPath.substring(folder.getProjectRelativePath().toString().length() + 1);
testCases.add(testPath);
}
ILaunchConfigurationWorkingCopy workingCopy = createLaunchConfiguration(project, folder, launchName, testCases);
ILaunchConfiguration config = null;
ILaunchConfigurationType configType = workingCopy.getType();
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(configType);
for (ILaunchConfiguration launchConfig : configs) {
String projectAttr = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String folderMatch = (folder == null) ? "" : folder.getProjectRelativePath().toString();
String folderAttr = launchConfig.getAttribute(CucumberLaunchConfiguration.FOLDER, "");
if (!project.getName().equals(projectAttr) || !folderMatch.equals(folderAttr))
continue;
config = launchConfig;
}
if (config == null) {
// no existing found - create a new one
config = workingCopy.doSave();
} else {
workingCopy = config.getWorkingCopy();
workingCopy.setAttribute(CucumberLaunchConfiguration.FEATURES, testCases);
config = workingCopy.doSave();
}
IStructuredSelection selection = new StructuredSelection(config);
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), selection, GROUP_ID);
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchConfiguration method findExistingDebugLaunchConfig.
private ILaunchConfiguration findExistingDebugLaunchConfig(ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = workingCopy.getType();
ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(configType);
String wcDebugProj = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String wcVmConnector = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, "");
Map<?, ?> wcConnectAttrMap = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, new HashMap<String, String>());
for (ILaunchConfiguration launchConfig : configs) {
String debugProj = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
if (!debugProj.equals(wcDebugProj))
continue;
String vmConnector = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, "");
if (!vmConnector.equals(wcVmConnector))
continue;
Map<?, ?> connectAttrMap = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, new HashMap<String, String>());
boolean mapMatches = true;
for (Map.Entry<?, ?> connectAttr : connectAttrMap.entrySet()) {
if (!"timeout".equals(connectAttr.getKey()) && !connectAttr.getValue().equals(wcConnectAttrMap.get(connectAttr.getKey()))) {
mapMatches = false;
continue;
}
}
if (!mapMatches)
continue;
return launchConfig;
}
return null;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchConfiguration method createDebugLaunchConfig.
private ILaunchConfigurationWorkingCopy createDebugLaunchConfig(WorkflowProject workflowProject, ILaunchConfiguration launchConfig) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType("com.centurylink.mdw.plugin.launch.JavaDebug");
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, launchManager.generateLaunchConfigurationName(workflowProject.getLabel()));
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, workflowProject.getSourceProject().getName()));
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, "org.eclipse.jdt.launching.socketAttachConnector"));
Map<String, String> argDefaults = new HashMap<>();
argDefaults.put("hostname", workflowProject.isRemote() ? workflowProject.getServerSettings().getHome() : "localhost");
argDefaults.put("port", ProcessLaunchConfiguration.DEFAULT_DEBUG_PORT);
argDefaults.put("timeout", "20000");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, argDefaults));
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false);
return wc;
}
Aggregations