use of org.eclipse.debug.core.ILaunchConfiguration in project pivot by apache.
the class PivotApplicationLaunchShortcut method createLaunchConfiguration.
protected ILaunchConfiguration createLaunchConfiguration(IType type) {
ILaunchConfiguration launchConfiguration = null;
try {
String applicationProjectName = type.getJavaProject().getElementName();
String applicationTypeName = type.getFullyQualifiedName();
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
String name = launchManager.generateUniqueLaunchConfigurationNameFrom(type.getElementName());
ILaunchConfigurationWorkingCopy workingLaunchConfiguration = configurationType.newInstance(null, name);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, PivotPlugin.MAIN_TYPE_NAME);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, applicationProjectName);
workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, applicationTypeName);
workingLaunchConfiguration.setMappedResources(new IResource[] { type.getUnderlyingResource() });
launchConfiguration = workingLaunchConfiguration.doSave();
} catch (CoreException exception) {
MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
}
return launchConfiguration;
}
use of org.eclipse.debug.core.ILaunchConfiguration in project pivot by apache.
the class PivotScriptApplicationLaunchShortcut method getExistingLaunchConfiguration.
private ILaunchConfiguration getExistingLaunchConfiguration(IFile file) {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfiguration existingLaunchConfiguration = null;
try {
String fileProjectName = file.getProject().getName();
ILaunchConfiguration[] launchConfigurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigurationType);
for (int i = 0; i < launchConfigurations.length; i++) {
ILaunchConfiguration launchConfiguration = launchConfigurations[i];
String mainTypeName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "");
String projectName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
String programArguments = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
if (mainTypeName.equals(PivotPlugin.MAIN_TYPE_NAME) && projectName.equals(fileProjectName) && programArguments.equals(getProgramArguments(file))) {
existingLaunchConfiguration = launchConfiguration;
break;
}
}
} catch (CoreException exception) {
MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
}
return existingLaunchConfiguration;
}
use of org.eclipse.debug.core.ILaunchConfiguration 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.ILaunchConfiguration in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestLaunchShortcut method performLaunch.
/**
* All test cases must be in the same package or legacy suite.
*/
private void performLaunch(List<AutomatedTestCase> cases, String mode) throws CoreException, JSONException {
AutomatedTestCase firstCase = cases.get(0);
WorkflowProject workflowProject = firstCase.getProject();
WorkflowPackage workflowPackage = firstCase.getPackage();
boolean isLegacyLaunch = firstCase.isLegacy();
String testName;
if (isLegacyLaunch)
testName = workflowProject.getName() + LEGACY;
else
testName = workflowPackage.getName();
List<String> testCases = new ArrayList<>();
for (AutomatedTestCase testCase : cases) {
if (testCase.getItems() != null) {
testCases.addAll(workflowPackage.getTestCaseItems(testCase));
} else if (testCase.isPostman())
testCases.add(testCase.getItemPath());
else
testCases.add(testCase.getPath());
}
ILaunchConfigurationWorkingCopy workingCopy = createLaunchConfiguration(workflowProject, workflowPackage, isLegacyLaunch, testName, testCases, ILaunchManager.DEBUG_MODE.equals(mode));
ILaunchConfiguration config = findExistingLaunchConfiguration(workingCopy);
if (config == null) {
// no existing found - create a new one
config = workingCopy.doSave();
} else {
workingCopy = config.getWorkingCopy();
String prefix;
if (workingCopy.getAttribute(AutomatedTestLaunchConfiguration.IS_LOAD_TEST, false))
prefix = AutomatedTestCase.LOAD_TEST;
else
prefix = AutomatedTestCase.FUNCTION_TEST;
workingCopy.setAttribute(prefix + "_" + AutomatedTestLaunchConfiguration.TEST_CASES, testCases);
config = workingCopy.doSave();
}
IStructuredSelection selection = new StructuredSelection(config);
if (ILaunchManager.DEBUG_MODE.equals(mode)) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), selection, DEBUG_GROUP_ID);
} else {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), selection, GROUP_ID);
}
}
use of org.eclipse.debug.core.ILaunchConfiguration 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);
}
Aggregations