use of org.eclipse.debug.core.ILaunchConfigurationType in project arduino-eclipse-plugin by Sloeber.
the class LaunchShortcut method getLaunchConfigurations.
/**
* Searches for all applicable launch configurations for this project.
*
* @return list with the launch configurations.
*/
private ArrayList<ILaunchConfiguration> getLaunchConfigurations() {
ArrayList<ILaunchConfiguration> result = new ArrayList<>();
try {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(LaunchConfiguration.LAUNCH_CONFIGURATION_TYPE_ID);
ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type);
for (int i = 0; i < configurations.length; i++) {
ILaunchConfiguration config = configurations[i];
if (!DebugUITools.isPrivate(config) && isGoodMatch(config)) {
result.add(config);
}
}
} catch (CoreException e) {
// Stupid Exception
}
return result;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project n4js by eclipse.
the class LaunchXpectShortcut method launchFile.
/**
* Launch an file, using the file information, which means using default launch configurations.
*/
protected void launchFile(IFile fileSelectedToRun, String mode) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
String testFileLocation = fileSelectedToRun.getRawLocationURI().toString();
String configName = computeLaunchConfigNameFrom(fileSelectedToRun, type);
XpectRunConfiguration runConfig = XpectRunConfiguration.createToRunXtFile(configName, testFileLocation);
runConfig.setConfigurationType(type);
runConfig.setWorkingDirectory(fileSelectedToRun.getRawLocation().toFile());
DebugUITools.launch(runConfig.toLaunchConfiguration(), mode);
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project n4js by eclipse.
the class AbstractRunnerLaunchShortcut method launchFile.
/**
* Launch a file, using the file information, which means using default launch configurations.
*/
protected void launchFile(IFile originalFileToRun, String mode) {
final String runnerId = getRunnerId();
final String path = originalFileToRun.getFullPath().toOSString();
final URI moduleToRun = URI.createPlatformResourceURI(path, true);
final String implementationId = chooseImplHelper.chooseImplementationIfRequired(runnerId, moduleToRun);
if (implementationId == ChooseImplementationHelper.CANCEL)
return;
RunConfiguration runConfig = runnerFrontEnd.createConfiguration(runnerId, implementationId, moduleToRun);
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode);
// execution dispatched to proper delegate LaunchConfigurationDelegate
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project n4js by eclipse.
the class AbstractTesterLaunchShortcut method launchTest.
/**
* Launch a test of the given URI (may point to project, folder, file).
*/
protected void launchTest(URI resourceToTest, String mode) {
TestConfiguration testConfig = testerFrontEnd.createConfiguration(getTesterId(), null, resourceToTest);
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
DebugUITools.launch(testConfigConverter.toLaunchConfiguration(type, testConfig), mode);
// execution dispatched to proper ILaunchConfigurationDelegate
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmLaunchShortcut method findLaunchConfiguration.
/**
* Locate a configuration to launch the given binary.<br>
* If one cannot be found, create one.
*
* @param bin The binary to launched
*
* @return A re-usable config or <code>null</code> if none.
* @throws Exception
*/
protected ILaunchConfiguration findLaunchConfiguration(IBinary bin) throws Exception {
ILaunchConfigurationType configType = getLaunchConfigType();
List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
IPath binPath = bin.getResource().getProjectRelativePath();
try {
ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
for (ILaunchConfiguration config : configs) {
IPath programPath = CDebugUtils.getProgramPath(config);
String projectName = CDebugUtils.getProjectName(config);
if (programPath != null && programPath.equals(binPath)) {
if ((projectName != null) && projectName.equals(bin.getCProject().getProject().getName())) {
candidateConfigs.add(config);
}
}
}
} catch (CoreException e) {
System.err.println(e);
}
IProject project = bin.getCProject().getProject();
// If there are no existing configurations associated with the IBinary,
// create one. If there is exactly one configuration associated with the
// IBinary, return it. Otherwise, if there is more than one
// configuration associated with the IBinary, prompt the user to choose
// one.
ILaunchConfiguration configuration = null;
int candidateCount = candidateConfigs.size();
if (candidateCount < 1) {
// Create default launch
configuration = LaunchParameterUtilities.createLaunchConfig(getActiveWorkbenchShell(), project, bin);
} else if (candidateCount == 1) {
configuration = candidateConfigs.get(0);
} else {
// Prompt the user to choose a configuration. A null result means
// the user
// cancelled the dialog, in which case this method returns null,
// since canceling the dialog should also cancel launching
// anything.
configuration = chooseConfiguration(candidateConfigs);
}
return configuration;
}
Aggregations