Java Code Examples for org.eclipse.debug.ui.DebugUITools#launch()
The following examples show how to use
org.eclipse.debug.ui.DebugUITools#launch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugScriptAction.java From birt with Eclipse Public License 1.0 | 6 votes |
public void run( IAction action ) { ModuleHandle handle = null; if (handle == null ) { FormEditor editor = UIUtil.getActiveReportEditor( false ); if (editor instanceof MultiPageReportEditor) { handle = ((MultiPageReportEditor)editor).getModel( ); } } if (handle != null) { String fileName = handle.getFileName( ); ILaunchConfiguration config = ScriptLaunchShortcut.findLaunchConfiguration( fileName, ScriptLaunchShortcut.getConfigurationType( ) ); if (config != null) { DebugUITools.launch(config, "debug");//$NON-NLS-1$ } } }
Example 2
Source File: HybridProjectLaunchShortcut.java From thym with Eclipse Public License 1.0 | 6 votes |
private void launch(IProject project) { try { HybridProject hp = HybridProject.getHybridProject(project); if(!validateBuildToolsReady() || !shouldProceedWithLaunch(hp) || !RequirementsUtility.checkCordovaRequirements() ){ return; } ILaunchConfiguration launchConfig = findOrCreateLaunchConfiguration(project); ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy(); updateLaunchConfiguration(wc); launchConfig = wc.doSave(); DebugUITools.launch(launchConfig, "run"); } catch (CoreException e) { if (e.getCause() instanceof IOException) { Status status = new Status(IStatus.ERROR, HybridUI.PLUGIN_ID, "Unable to complete the build for target plarform", e.getCause()); StatusManager.handle(status); }else{ StatusManager.handle(e); } } }
Example 3
Source File: AbstractLaunchShortcut.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Launch the given targets in the given build file. The targets are * launched in the given mode. * * @param resources the resources to launch * @param mode the mode in which the file should be executed */ protected void launch(FileOrResource[] resources, String mode) { ILaunchConfiguration conf = null; List<ILaunchConfiguration> configurations = findExistingLaunchConfigurations(resources); if (configurations.isEmpty()) { conf = createDefaultLaunchConfiguration(resources); } else { if (configurations.size() == 1) { conf = configurations.get(0); } else { conf = chooseConfig(configurations); if (conf == null) { // User canceled selection return; } } } if (conf != null) { DebugUITools.launch(conf, mode); return; } fileNotFound(); }
Example 4
Source File: AbstractRunnerLaunchShortcut.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * 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 != null ? new N4JSProjectName(implementationId) : null, moduleToRun); ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID()); DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode); // execution dispatched to proper delegate LaunchConfigurationDelegate }
Example 5
Source File: LaunchHandler.java From corrosion with Eclipse Public License 2.0 | 6 votes |
/** * Looks up an existing cargo test launch configuration with the arguments * specified in {@code command} for the given {@code project}. If no such launch * configuration exists, creates a new one. The launch configuration is then * run. * * @param command rls.run command with all information needed to run cargo test * @param project the context project for which the launch configuration is * looked up / created */ private static void createAndStartCargoTest(RLSRunCommand command, IProject project) { CargoArgs args = CargoArgs.fromAllArguments(command.args); Map<String, String> envMap = command.env; ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager .getLaunchConfigurationType(CargoTestDelegate.CARGO_TEST_LAUNCH_CONFIG_TYPE_ID); try { // check if launch config already exists ILaunchConfiguration[] launchConfigurations = manager.getLaunchConfigurations(type); Set<Entry<String, String>> envMapEntries = envMap.entrySet(); // prefer running existing launch configuration with same parameters ILaunchConfiguration launchConfig = Arrays.stream(launchConfigurations) .filter((l) -> matchesTestLaunchConfig(l, project, args, envMapEntries)).findAny() .orElseGet(() -> createCargoLaunchConfig(manager, type, project, args, envMap)); if (launchConfig != null) { DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE); } } catch (CoreException e) { CorrosionPlugin.logError(e); } }
Example 6
Source File: AbstractSarlLaunchShortcut.java From sarl with Apache License 2.0 | 6 votes |
/** * Launches the given element type in the specified mode. * * @param projectName the name of the project. * @param fullyQualifiedName the element name. * @param mode launch mode * @throws CoreException if something is going wrong. */ protected void launch(String projectName, String fullyQualifiedName, String mode) throws CoreException { final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName); ILaunchConfiguration config = null; final int count = configs.size(); if (count == 1) { config = configs.get(0); } else if (count > 1) { config = chooseConfiguration(configs); if (config == null) { return; } } if (config == null) { config = createConfiguration(projectName, fullyQualifiedName); } if (config != null) { DebugUITools.launch(config, mode); } }
Example 7
Source File: LaunchShortcut.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * Resolves a type that can be launched from the given scope and launches in the * specified mode. * * @param scope the XDS elements to consider for a type that can be launched * @param mode launch mode * @param emptyMessage error message when no types are resolved for launching */ private void searchAndLaunch(Object[] scope, String mode, String emptyMessage) { IProject xdsProject = selectXdsProject(scope, emptyMessage); if (xdsProject != null) { ILaunchConfigurationType launchConfigType = getConfigurationType(LAUNCH_CONFIG_TYPE_ID); List<ILaunchConfiguration> configs = getLaunchConfigurations(xdsProject, launchConfigType).collect(Collectors.toList()); ILaunchConfiguration config = null; if (!configs.isEmpty()) { config = selectConfiguration(configs); if (config == null) { return; } } if (config == null) { config = createConfiguration(xdsProject); } if (config != null) { DebugUITools.launch(config, mode); } } }
Example 8
Source File: TypeScriptCompilerLaunchHelper.java From typescript.java with MIT License | 5 votes |
public static void launch(IFile tsconfigFile, String mode) { ILaunchConfigurationType tscLaunchConfigurationType = DebugPlugin.getDefault().getLaunchManager() .getLaunchConfigurationType(TypeScriptCompilerLaunchConstants.LAUNCH_CONFIGURATION_ID); try { // Check if configuration already exists ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager() .getLaunchConfigurations(tscLaunchConfigurationType); ILaunchConfiguration existingConfiguraion = chooseLaunchConfiguration(configurations, tsconfigFile); if (existingConfiguraion != null) { ILaunchConfigurationWorkingCopy wc = existingConfiguraion.getWorkingCopy(); existingConfiguraion = wc.doSave(); DebugUITools.launch(existingConfiguraion, mode); // Creating Launch Configuration from scratch } else { IProject project = tsconfigFile.getProject(); ILaunchConfigurationWorkingCopy newConfiguration = createEmptyLaunchConfiguration( project.getName() + " [" + tsconfigFile.getProjectRelativePath().toString() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ newConfiguration.setAttribute(TypeScriptCompilerLaunchConstants.BUILD_PATH, getBuildPath(tsconfigFile)); newConfiguration.doSave(); DebugUITools.launch(newConfiguration, mode); } } catch (CoreException e) { TypeScriptCorePlugin.logError(e, e.getMessage()); } }
Example 9
Source File: DebugResourceAction.java From birt with Eclipse Public License 1.0 | 5 votes |
public void run( IAction action ) { IFile file = getSelectedFile( ); if ( file == null ) { return; } String fileName = file.getLocation( ).toOSString( ); ILaunchConfiguration config = ScriptLaunchShortcut.findLaunchConfiguration( fileName, ScriptLaunchShortcut.getConfigurationType( ) ); if (config != null) { DebugUITools.launch(config, "debug");//$NON-NLS-1$ } }
Example 10
Source File: StatechartLaunchShortcut.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void launch(IFile file, String mode) { showConsole(); final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(getConfigType()); ILaunchConfiguration launchConfig = findLaunchConfiguration(configType, file); if (launchConfig != null) { DebugUITools.launch(launchConfig, mode); } else { ILaunchConfiguration launchConfiguration = createNewLaunchConfiguration(file); DebugUITools.launch(launchConfiguration, mode); } }
Example 11
Source File: LaunchShortcut.java From dartboard with Eclipse Public License 2.0 | 5 votes |
private void launchProject(IProject project, String mode) { if (project == null) { MessageDialog.openError(PlatformUIUtil.getActiveShell(), Messages.Launch_ConfigurationRequired_Title, Messages.Launch_ConfigurationRequired_Body); return; } ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(Constants.LAUNCH_CONFIGURATION_ID); try { // Find last launch configuration for selected project. ILaunchConfiguration launchConfiguration = null; for (ILaunchConfiguration conf : manager.getLaunchConfigurations(type)) { if (conf.getAttribute(Constants.LAUNCH_SELECTED_PROJECT, "").equalsIgnoreCase(project.getName())) { //$NON-NLS-1$ launchConfiguration = conf; } } if (launchConfiguration != null) { DebugUITools.launch(launchConfiguration, mode); } else { ILaunchConfigurationWorkingCopy copy = type.newInstance(null, manager.generateLaunchConfigurationName( LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2)); copy.setAttribute(Constants.LAUNCH_SELECTED_PROJECT, project.getName()); copy.setAttribute(Constants.LAUNCH_MAIN_CLASS, project.getPersistentProperty(StagehandGenerator.QN_ENTRYPOINT)); int result = DebugUITools.openLaunchConfigurationDialog(PlatformUIUtil.getActiveShell(), copy, Constants.LAUNCH_GROUP, null); if (result == Window.OK) { copy.doSave(); } } } catch (CoreException e) { LOG.log(DartLog.createError("Could not save new launch configuration", e)); //$NON-NLS-1$ } }
Example 12
Source File: BaseLaunchShortcut.java From goclipse with Eclipse Public License 1.0 | 5 votes |
protected void doLaunchTarget(ILaunchable launchTarget, String mode) throws CoreException, OperationCancellation { ILaunchConfiguration config = findExistingLaunchConfiguration(launchTarget); if(config == null) { config = launchTarget.createNewConfiguration(); } DebugUITools.launch(config, mode); }
Example 13
Source File: TestResultsView.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Invoked when user performs {@link #actionRelaunch}. */ protected void performRelaunch() { if (null != currentRoot) { final TestSession session = from(registeredSessions).firstMatch(s -> s.root == currentRoot).orNull(); if (null != session) { registeredSessions.remove(session); ILaunchConfiguration launchConfig = getLaunchConfigForSession(session, null); DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE, true); } } }
Example 14
Source File: LaunchShortcut.java From dartboard with Eclipse Public License 2.0 | 5 votes |
private void launchProject(IProject project, String mode) { if (project == null) { return; } ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType("org.eclipse.dartboard.flutter.launch"); try { // Find last launch configuration for selected project. ILaunchConfiguration launchConfiguration = null; for (ILaunchConfiguration conf : manager.getLaunchConfigurations(type)) { if (conf.getAttribute("selected_project", "").equalsIgnoreCase(project.getName())) { //$NON-NLS-1$ launchConfiguration = conf; } } if (launchConfiguration != null) { DebugUITools.launch(launchConfiguration, mode); } else { ILaunchConfigurationWorkingCopy copy = type.newInstance(null, manager.generateLaunchConfigurationName( LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2)); copy.setAttribute("selected_project", project.getName()); int result = DebugUITools.openLaunchConfigurationDialog(PlatformUIUtil.getActiveShell(), copy, "org.eclipse.dartboard.launchGroup", null); if (result == Window.OK) { copy.doSave(); } } } catch (CoreException e) { LOG.log(DartLog.createError("Could not save new launch configuration", e)); //$NON-NLS-1$ } }
Example 15
Source File: LaunchConfigStarter.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void startLaunchConfig( ILaunchConfiguration launchConfig ) { ILaunchMode launchMode = new LaunchModeComputer( launchConfig, preferredLaunchMode ).computeLaunchMode(); DebugUITools.launch( launchConfig, launchMode.getIdentifier() ); }
Example 16
Source File: LaunchConfigSelectionHistoryPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void runLaunchConfig() { DebugUITools.launch( launchConfig, RUN_MODE ); }
Example 17
Source File: LaunchConfigSelectionHistoryPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void debugLaunchConfig() { DebugUITools.launch( launchConfig, DEBUG_MODE ); }
Example 18
Source File: LaunchPipelineShortcut.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
private void launchExisting(ILaunchConfiguration configuration, String mode) { DebugUITools.launch(configuration, mode); }
Example 19
Source File: PydevdServerLaunchShortcut.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void launch(FileOrResource[] file, String mode) { ILaunchConfiguration conf = createDefaultLaunchConfiguration(file); DebugUITools.launch(conf, mode); }
Example 20
Source File: LaunchXpectShortcut.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * 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); }