use of org.eclipse.debug.core.ILaunchConfigurationType in project tdi-studio-se by Talend.
the class JavaProcessor method saveLaunchConfigurationWithParam.
// generate the ILaunchConfiguration with the parameter string.
@Override
public Object saveLaunchConfigurationWithParam(String parameterStr) throws CoreException {
/*
* When launch debug progress, just share all libraries between farther job and child jobs
*/
// computeLibrariesPath(this.getProcess().getNeededLibraries(true));
ILaunchConfiguration config = null;
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
String projectName = this.getCodeProject().getName();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
if (type != null) {
ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchManager.generateUniqueLaunchConfigurationNameFrom(this.getCodePath().lastSegment()));
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, this.getMainClass());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, true);
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, CTX_ARG + context.getName() + parameterStr);
config = wc.doSave();
}
return config;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project dbeaver by dbeaver.
the class DebugCore method createConfiguration.
public static ILaunchConfigurationWorkingCopy createConfiguration(IContainer container, String typeName, String name) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(typeName);
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, name);
return workingCopy;
}
use of org.eclipse.debug.core.ILaunchConfigurationType 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.ILaunchConfigurationType in project linuxtools by eclipse.
the class BaseResourceAwareLaunchShortcut method findLaunchConfiguration.
/**
* Locate a configuration to launch for the given type. If one cannot be
* found, create one.
*
* @param resource
* The {@code docker-compose.yml} to look up launch for.
*
* @return A re-useable config or <code>null</code> if none was found.
*/
protected ILaunchConfiguration findLaunchConfiguration(final String configTypeId, final IResource resource, final Predicate<ILaunchConfiguration> predicate) {
final ILaunchConfigurationType configType = LaunchConfigurationUtils.getLaunchConfigType(configTypeId);
final List<ILaunchConfiguration> candidateConfigs = new ArrayList<>();
try {
final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
Stream.of(configs).filter(predicate).forEach(config -> candidateConfigs.add(config));
} catch (CoreException e) {
Activator.log(e);
}
// If there are no existing configurations associated with the
// given resource,
// create one. If there is exactly one configuration associated with the
// given resource, return it. Otherwise, if there is more than one
// configuration associated with the given resource, prompt the user to
// choose
// one.
int candidateCount = candidateConfigs.size();
if (candidateCount < 1) {
return createConfiguration(resource);
} else if (candidateCount == 1) {
return candidateConfigs.get(0);
} else {
// anything.
return chooseConfiguration(candidateConfigs);
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType 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);
}
}
Aggregations