use of org.eclipse.debug.core.ILaunchManager in project bndtools by bndtools.
the class AbstractLaunchShortcut method createConfiguration.
protected ILaunchConfigurationWorkingCopy createConfiguration(IPath targetPath, IProject targetProject) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId);
ILaunchConfigurationWorkingCopy wc;
wc = configType.newInstance(null, manager.generateLaunchConfigurationName(targetPath.lastSegment()));
wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString());
wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN);
wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);
if (targetProject != null) {
IJavaProject javaProject = JavaCore.create(targetProject);
if (javaProject.exists()) {
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, targetProject.getName());
}
}
return wc;
}
use of org.eclipse.debug.core.ILaunchManager in project linuxtools by eclipse.
the class ClearLaunchConfigurationsRule method before.
@Override
protected void before() throws Throwable {
final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
final ILaunchConfigurationType launchConfigType = LaunchConfigurationUtils.getLaunchConfigType(launchConfigTypeId);
Stream.of(manager.getLaunchConfigurations(launchConfigType)).forEach(launchConfig -> {
try {
launchConfig.delete();
} catch (Exception e) {
fail("Failed to remove a launch configuration '" + launchConfig.getName() + "' of type '" + this.launchConfigTypeId + "'");
}
});
}
use of org.eclipse.debug.core.ILaunchManager in project linuxtools by eclipse.
the class LaunchConfigurationUtils method updateLaunchConfigurations.
/**
* Updates all {@link ILaunchConfiguration} of the given {@code type} where
* there is an attribute with the given {@code attributeName} of the given
* {@code oldValue}, and sets the {@code newValue} instead.
*
* @param type
* the type of {@link ILaunchConfiguration} to find
* @param attributeName
* the name of the attribute to look-up
* @param oldValue
* the old value to match
* @param newValue
* the new value to set
*/
public static void updateLaunchConfigurations(final String type, final String attributeName, final String oldValue, final String newValue) {
final ILaunchConfigurationType configType = LaunchConfigurationUtils.getLaunchConfigType(type);
final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
try {
for (ILaunchConfiguration config : manager.getLaunchConfigurations(configType)) {
try {
if (// $NON-NLS-1$
config.getAttribute(attributeName, "").equals(oldValue)) {
final ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
workingCopy.setAttribute(attributeName, newValue);
workingCopy.doSave();
}
} catch (CoreException e) {
Activator.logErrorMessage(LaunchMessages.getFormattedString(// $NON-NLS-1$
"UpdateLaunchConfiguration.named.error", config.getName()), e);
}
}
} catch (CoreException e) {
Activator.logErrorMessage(// $NON-NLS-1$
LaunchMessages.getString(// $NON-NLS-1$
"UpdateLaunchConfiguration.error"), e);
Activator.logErrorMessage("Failed to retrieve launch configurations after connection name changed", e);
}
}
use of org.eclipse.debug.core.ILaunchManager in project linuxtools by eclipse.
the class LaunchConfigurationUtils method getLaunchConfigurationWorkingCopy.
/**
* Returns the {@link ILaunchConfigurationWorkingCopy} with the given type
* and <strong>IDockerImage's name</strong>.
*
* @param type
* the configuration type
* @param imageName
* the associated {@link IDockerImage} name
* @param createIfNotFound
* flag to indicate if a new {@link ILaunchConfiguration} should
* be created if none was found.
* @return the ILaunchConfigurationWorkingCopy for the matching
* {@link ILaunchConfiguration} or a new instance if none was found.
* @throws CoreException
*/
private static ILaunchConfigurationWorkingCopy getLaunchConfigurationWorkingCopy(final ILaunchConfigurationType type, final String imageName) throws CoreException {
final ILaunchConfiguration existingLaunchConfiguration = getLaunchConfigurationByImageName(type, imageName);
if (existingLaunchConfiguration != null) {
return existingLaunchConfiguration.getWorkingCopy();
}
final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
final String configurationName = manager.generateLaunchConfigurationName(imageName);
return type.newInstance(null, configurationName);
}
use of org.eclipse.debug.core.ILaunchManager in project linuxtools by eclipse.
the class SystemTapScriptLaunch method setConsole.
public void setConsole(ScriptConsole console) {
if (this.console == console) {
return;
}
// If another launch is using the same console, remove that launch since
// ScriptConsole prevents two identical stap scripts from being be run at once.
this.console = console;
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
for (ILaunch launch : manager.getLaunches()) {
if (launch.equals(this)) {
continue;
}
if (launch instanceof SystemTapScriptLaunch) {
SystemTapScriptLaunch olaunch = (SystemTapScriptLaunch) launch;
if (olaunch.console == null || olaunch.console.equals(console)) {
olaunch.forceRemove();
}
}
}
console.addScriptConsoleObserver(this);
}
Aggregations