Search in sources :

Example 16 with ILaunchConfigurationType

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;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ArrayList(java.util.ArrayList) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 17 with ILaunchConfigurationType

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);
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 18 with ILaunchConfigurationType

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
}
Also used : RunConfiguration(org.eclipse.n4js.runner.RunConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) URI(org.eclipse.emf.common.util.URI)

Example 19 with ILaunchConfigurationType

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
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) TestConfiguration(org.eclipse.n4js.tester.TestConfiguration) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 20 with ILaunchConfigurationType

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;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IPath(org.eclipse.core.runtime.IPath) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) IProject(org.eclipse.core.resources.IProject)

Aggregations

ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)86 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)57 ILaunchManager (org.eclipse.debug.core.ILaunchManager)52 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)48 CoreException (org.eclipse.core.runtime.CoreException)41 ArrayList (java.util.ArrayList)20 IPath (org.eclipse.core.runtime.IPath)8 HashMap (java.util.HashMap)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)6 Path (org.eclipse.core.runtime.Path)6 ILaunch (org.eclipse.debug.core.ILaunch)6 File (java.io.File)5 Map (java.util.Map)5 IProject (org.eclipse.core.resources.IProject)5 List (java.util.List)4 IResource (org.eclipse.core.resources.IResource)4 IStatus (org.eclipse.core.runtime.IStatus)4 IOException (java.io.IOException)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 LaunchHelper (com.liferay.ide.core.util.LaunchHelper)2