use of org.eclipse.debug.core.ILaunchConfigurationType in project generator by mybatis.
the class GeneratorLaunchShortcut method findOrCreateLaunchConfiguration.
private ILaunchConfiguration findOrCreateLaunchConfiguration(IFile file) throws CoreException {
ILaunchConfigurationType ctype = getLaunchConfigurationType();
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(ctype);
List<ILaunchConfiguration> candidateConfigs = new ArrayList<>(configs.length);
for (ILaunchConfiguration config : configs) {
String configFile = config.getAttribute(GeneratorLaunchConstants.ATTR_CONFIGURATION_FILE_NAME, (String) null);
try {
configFile = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(configFile);
} catch (CoreException e) {
continue;
}
Path path = new Path(configFile);
if (path.equals(file.getLocation())) {
candidateConfigs.add(config);
}
}
ILaunchConfiguration config;
if (candidateConfigs.size() > 1) {
config = chooseConfiguration(candidateConfigs);
} else if (candidateConfigs.size() == 1) {
config = candidateConfigs.get(0);
} else {
config = createConfiguration(file);
}
return config;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project generator by mybatis.
the class GeneratorLaunchShortcut method createConfiguration.
private ILaunchConfiguration createConfiguration(IFile file) throws CoreException {
ILaunchConfigurationType configType = getLaunchConfigurationType();
String variableExpression = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", // $NON-NLS-1$
file.getFullPath().toPortableString());
// $NON-NLS-1$
String namePrefix = String.format("%s-%s", file.getProject().getName(), file.getName());
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(namePrefix));
wc.setAttribute(GeneratorLaunchConstants.ATTR_CONFIGURATION_FILE_NAME, variableExpression);
wc.setMappedResources(new IResource[] { file.getProject() });
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getJavaProjectNameFromResource(file));
ILaunchConfiguration config = wc.doSave();
return config;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project iobserve-analysis by research-iobserve.
the class PerOpteryxLaunchConfigurationBuilder method getDefaultLaunchConfiguration.
/**
* Returns a default launch configuration.
*
* @param projectModelDir
* The Peropteryx project dir in eclipse workspace
* @param sourceModelDir
* The PCM model directory
* @return The launch configuration
* @throws CoreException
* when creating or saving the launch configuration fails
*/
public static ILaunchConfiguration getDefaultLaunchConfiguration(final String projectModelDir, final String sourceModelDir) throws CoreException {
final Map<String, Object> attr = new HashMap<>();
PerOpteryxLaunchConfigurationBuilder.setDefaultConfigFiles(projectModelDir, attr);
PerOpteryxLaunchConfigurationBuilder.setDefaultGeneralOptions(attr);
PerOpteryxLaunchConfigurationBuilder.setDefaultAnalysisOptions(attr);
PerOpteryxLaunchConfigurationBuilder.setDefaultResourceOptions(attr);
PerOpteryxLaunchConfigurationBuilder.setDefaultReliabilityOptions(attr);
// setSimuComDefaultOptions(attr);
PerOpteryxLaunchConfigurationBuilder.setLQNSDefaultOptions(attr, projectModelDir, sourceModelDir);
PerOpteryxLaunchConfigurationBuilder.setDefaultTacticsOptions(attr);
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
final ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(PerOpteryxLaunchConfigurationBuilder.DSE_LAUNCH_TYPE_ID);
final ILaunchConfigurationWorkingCopy workingCopy = launchConfigType.newInstance(null, PerOpteryxLaunchConfigurationBuilder.DEFAULT_LAUNCH_CONFIG_NAME);
workingCopy.setAttributes(attr);
final ILaunchConfiguration launchConfig = workingCopy.doSave();
return launchConfig;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project statecharts by Yakindu.
the class StatechartLaunchShortcut method createNewLaunchConfiguration.
protected ILaunchConfiguration createNewLaunchConfiguration(IFile file) {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(getConfigType());
try {
ILaunchConfigurationWorkingCopy newConfig = configType.newInstance(null, launchManager.generateLaunchConfigurationName(file.getName()));
newConfig.setAttribute(FILE_NAME, file.getFullPath().toString());
return newConfig.doSave();
} catch (CoreException e) {
e.printStackTrace();
}
throw new IllegalStateException();
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project azure-tools-for-java by Microsoft.
the class MavenExecuteAction method createLaunchConfiguration.
private ILaunchConfiguration createLaunchConfiguration(IContainer basedir) {
try {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);
String launchSafeGoalName = goalName.replace(':', '-');
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, launchSafeGoalName);
workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedir.getLocation().toOSString());
workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, goalName);
workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "${project}");
workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, true);
setProjectConfiguration(workingCopy, basedir);
IPath path = getJREContainerPath(basedir);
if (path != null) {
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString());
}
return workingCopy;
} catch (CoreException ex) {
}
return null;
}
Aggregations