Java Code Examples for org.eclipse.debug.core.ILaunchManager#getLaunchConfigurationType()
The following examples show how to use
org.eclipse.debug.core.ILaunchManager#getLaunchConfigurationType() .
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: CordovaCLI.java From thym with Eclipse Public License 1.0 | 6 votes |
protected ILaunchConfiguration getLaunchConfiguration(String label){ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); try { ILaunchConfiguration cfg = type.newInstance(null, "cordova"); ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy(); wc.setAttribute(IProcess.ATTR_PROCESS_LABEL, label); if(additionalEnvProps != null && !additionalEnvProps.isEmpty()){ wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,additionalEnvProps); } cfg = wc.doSave(); return cfg; } catch (CoreException e) { e.printStackTrace(); } return null; }
Example 2
Source File: FlexMavenPackagedProjectStagingDelegate.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@VisibleForTesting static ILaunchConfiguration createMavenPackagingLaunchConfiguration(IProject project) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType launchConfigurationType = launchManager .getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID); String launchConfigName = "CT4E App Engine flexible Maven deploy artifact packaging " + project.getLocation().toString().replaceAll("[^a-zA-Z0-9]", "_"); ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance( null /*container*/, launchConfigName); workingCopy.setAttribute(ILaunchManager.ATTR_PRIVATE, true); // IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND; workingCopy.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true); workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, project.getLocation().toString()); workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, "package"); workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, "${project}"); workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, true); IPath jreContainerPath = getJreContainerPath(project); workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreContainerPath.toString()); return workingCopy; }
Example 3
Source File: FatJarPackageWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private LaunchConfigurationElement[] getLaunchConfigurations() { ArrayList<ExistingLaunchConfigurationElement> result= new ArrayList<ExistingLaunchConfigurationElement>(); try { ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfiguration[] launchconfigs= manager.getLaunchConfigurations(type); for (int i= 0; i < launchconfigs.length; i++) { ILaunchConfiguration launchconfig= launchconfigs[i]; if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) { String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$ result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName)); } } } catch (CoreException e) { JavaPlugin.log(e); } return result.toArray(new LaunchConfigurationElement[result.size()]); }
Example 4
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 5
Source File: KubeUtil.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Starts a separate port forward launch */ public static PortForwardInfo launchPortForward(CodewindApplication app, int localPort, int port) throws Exception { // Check the app (throws an exception if there is a problem) checkApp(app); // Get the command List<String> commandList = getPortForwardCommand(app, localPort, port); String title = NLS.bind(Messages.PortForwardTitle, localPort + ":" + port); ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(UtilityLaunchConfigDelegate.LAUNCH_CONFIG_ID); ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance((IContainer) null, app.name); workingCopy.setAttribute(CodewindLaunchConfigDelegate.CONNECTION_ID_ATTR, app.connection.getConid()); workingCopy.setAttribute(CodewindLaunchConfigDelegate.PROJECT_ID_ATTR, app.projectID); workingCopy.setAttribute(UtilityLaunchConfigDelegate.TITLE_ATTR, title); workingCopy.setAttribute(UtilityLaunchConfigDelegate.COMMAND_ATTR, commandList); CodewindLaunchConfigDelegate.setConfigAttributes(workingCopy, app); ILaunchConfiguration launchConfig = workingCopy.doSave(); ILaunch launch = launchConfig.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor()); return new PortForwardInfo(localPort, port, launch); }
Example 6
Source File: LaunchConfigurationConfigurator.java From sarl with Apache License 2.0 | 5 votes |
/** initialize the launch configuration. * * @param configurationType the name of the configuration type to create. * @param projectName the name of the project. * @param id the identifier of the launch configuration. * @param resetJavaMainClass indicates if the JAva main class should be reset from the SRE configuration. * @return the created launch configuration. * @throws CoreException if the configuration cannot be created. * @since 0.7 */ protected ILaunchConfigurationWorkingCopy initLaunchConfiguration(String configurationType, String projectName, String id, boolean resetJavaMainClass) throws CoreException { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(configurationType); final ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, launchManager.generateLaunchConfigurationName(id)); setProjectName(wc, projectName); setDefaultContextIdentifier(wc, null); setLaunchingFlags(wc, DEFAULT_SHOW_LOG_INFO, DEFAULT_OFFLINE); setRuntimeConfiguration(wc, SARLRuntime.getDefaultSREInstall(), DEFAULT_USE_SYSTEM_SRE, DEFAULT_USE_PROJECT_SRE, resetJavaMainClass); JavaMigrationDelegate.updateResourceMapping(wc); return wc; }
Example 7
Source File: GwtSuperDevModeCodeServerLaunchUtil.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * Finds and returns an <b>existing</b> configuration to re-launch for the given URL, or * <code>null</code> if there is no existing configuration. * * @return a configuration to use for launching the given type or <code>null * </code> if none * @throws CoreException */ private static ILaunchConfiguration findLaunchConfiguration(IProject project) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType typeid = launchManager.getLaunchConfigurationType(GwtSuperDevModeLaunchConfiguration.TYPE_ID); ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(typeid); return searchMatchingConfigWithProject(project, configs); }
Example 8
Source File: TLCSpec.java From tlaplus with MIT License | 5 votes |
private static ILaunchConfiguration[] getAllLaunchConfigurations() { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType launchConfigurationType = launchManager .getLaunchConfigurationType(TLCModelLaunchDelegate.LAUNCH_CONFIGURATION_TYPE); try { return launchManager.getLaunchConfigurations(launchConfigurationType); } catch (CoreException shouldNeverHappen) { shouldNeverHappen.printStackTrace(); return new ILaunchConfiguration[0]; } }
Example 9
Source File: CompilerLaunchShortcut.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
protected ILaunchConfiguration findLaunchConfiguration(IResource resource) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType typeid = launchManager.getLaunchConfigurationType(CompilerLaunchConfiguration.TYPE_ID); ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(typeid); return searchMatchingUrlAndProject(resource.getProject(), configs); }
Example 10
Source File: DotnetTestDelegate.java From aCute with Eclipse Public License 2.0 | 5 votes |
private ILaunchConfiguration getLaunchConfiguration(String mode, IResource resource) { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType configType = launchManager .getLaunchConfigurationType("org.eclipse.acute.dotnettest.DotnetTestDelegate"); //$NON-NLS-1$ try { ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType); String configName; if (resource.getLocation().toFile().isFile()) { configName = NLS.bind(Messages.DotnetTestDelegate_configuration, resource.getParent().getName() + "." + resource.getName()); //$NON-NLS-1$ } else { configName = NLS.bind(Messages.DotnetTestDelegate_configuration, resource.getName()); } for (ILaunchConfiguration iLaunchConfiguration : launchConfigurations) { if (iLaunchConfiguration.getName().equals(configName) && iLaunchConfiguration.getModes().contains(mode)) { return iLaunchConfiguration; } } configName = launchManager.generateLaunchConfigurationName(configName); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName); if (resource.getLocation().toFile().isFile()) { if (resource.getFileExtension().equals("cs")) { //$NON-NLS-1$ wc.setAttribute(TEST_SELECTION_TYPE, SELECTED_TEST); wc.setAttribute(TEST_CLASS, resource.getName().replaceFirst("\\.cs$", "")); //$NON-NLS-1$ //$NON-NLS-2$ } resource = resource.getParent(); } wc.setAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, resource.getLocation().toString()); return wc; } catch (CoreException e) { e.printStackTrace(); } return null; }
Example 11
Source File: PythonFileRunner.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private static ILaunchConfigurationWorkingCopy getLaunchConfiguration(IFile resource, String programArguments) throws CoreException, MisconfigurationException, PythonNatureWithoutProjectException { String vmargs = ""; // Not sure if it should be a parameter or not IProject project = resource.getProject(); PythonNature nature = PythonNature.getPythonNature(project); ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager(); String launchConfigurationType = configurationFor(nature.getInterpreterType()); ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigurationType); if (type == null) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Python launch configuration not found", null)); } String location = resource.getRawLocation().toString(); String name = manager.generateUniqueLaunchConfigurationNameFrom(resource.getName()); String baseDirectory = new File(location).getParent(); int resourceType = IResource.FILE; ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, name); // Python Main Tab Arguments workingCopy.setAttribute(Constants.ATTR_PROJECT, project.getName()); workingCopy.setAttribute(Constants.ATTR_RESOURCE_TYPE, resourceType); workingCopy.setAttribute(Constants.ATTR_INTERPRETER, nature.getProjectInterpreter().getExecutableOrJar()); workingCopy.setAttribute(Constants.ATTR_LOCATION, location); workingCopy.setAttribute(Constants.ATTR_WORKING_DIRECTORY, baseDirectory); workingCopy.setAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, programArguments); workingCopy.setAttribute(Constants.ATTR_VM_ARGUMENTS, vmargs); workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); workingCopy.setMappedResources(new IResource[] { resource }); return workingCopy; }
Example 12
Source File: PydevIProcessFactory.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private static ILaunchConfiguration createLaunchConfig() { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType launchConfigurationType = manager .getLaunchConfigurationType("org.python.pydev.debug.interactiveConsoleConfigurationType"); ILaunchConfigurationWorkingCopy newInstance; try { newInstance = launchConfigurationType.newInstance(null, manager.generateLaunchConfigurationName("PyDev Interactive Launch")); } catch (CoreException e) { return null; } newInstance.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); return newInstance; }
Example 13
Source File: TestResultsView.java From n4js with Eclipse Public License 1.0 | 5 votes |
private ILaunchConfiguration getLaunchConfigForSession(TestSession session, List<TestCase> failed) { final TestConfiguration testConfig = session.configuration; ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = launchManager.getLaunchConfigurationType( testConfig.getLaunchConfigurationTypeIdentifier()); ILaunchConfiguration launchConfig = testConfigConverter.toLaunchConfiguration(type, testConfig, failed); return launchConfig; }
Example 14
Source File: WebAppLaunchShortcut.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * Finds and returns an <b>existing</b> configuration to re-launch for the given URL, or <code>null</code> if there is * no existing configuration. * * @return a configuration to use for launching the given type or <code>null * </code> if none * @throws CoreException */ protected ILaunchConfiguration findLaunchConfiguration(IResource resource, String startupUrl, boolean isExternal) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType typeid = launchManager.getLaunchConfigurationType(WebAppLaunchConfiguration.TYPE_ID); ILaunchConfiguration[] configs = launchManager.getLaunchConfigurations(typeid); return searchMatchingUrlAndProject(startupUrl, resource.getProject(), isExternal, configs); }
Example 15
Source File: TypeScriptCompilerLaunchHelper.java From typescript.java with MIT License | 5 votes |
private static ILaunchConfigurationWorkingCopy createEmptyLaunchConfiguration(String namePrefix) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType launchConfigurationType = launchManager .getLaunchConfigurationType(TypeScriptCompilerLaunchConstants.LAUNCH_CONFIGURATION_ID); ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchManager.generateLaunchConfigurationName(namePrefix)); return launchConfiguration; }
Example 16
Source File: HybridProjectLaunchShortcut.java From thym with Eclipse Public License 1.0 | 5 votes |
private ILaunchConfigurationType getLaunchConfigurationType(){ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); String launchTypeID = getLaunchConfigurationTypeID(); Assert.isNotNull(launchTypeID); ILaunchConfigurationType configType = lm.getLaunchConfigurationType(launchTypeID); return configType; }
Example 17
Source File: ScanWorkspaceOperation.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.scanningWorkspace, IProgressMonitor.UNKNOWN); final ILaunchManager manager = getLaunchManager(); final ILaunchConfigurationType ltype = manager .getLaunchConfigurationType(IPDELauncherConstants.ECLIPSE_APPLICATION_LAUNCH_CONFIGURATION_TYPE); try { final ILaunchConfigurationWorkingCopy workingCopy = ltype.newInstance(null, "Scan workspace"); workingCopy.setAttribute(IPDELauncherConstants.APPLICATION, applicationId()); workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "-scan"); if (Objects.equals(Platform.getOS(), Platform.OS_MACOSX)) { workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_USE_START_ON_FIRST_THREAD, true); } workingCopy.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false); workingCopy.setAttribute(IPDELauncherConstants.RUN_IN_UI_THREAD, true); workingCopy.setAttribute(IPDELauncherConstants.DOCLEAR, false); workingCopy.setAttribute(IPDELauncherConstants.LOCATION, tmpWorskpaceFolder()); workingCopy.setAttribute(IPDELauncherConstants.USE_PRODUCT, false); final ILaunch launch = workingCopy.launch("run", Repository.NULL_PROGRESS_MONITOR); launch.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener() { @Override public void streamAppended(String text, IStreamMonitor streamMonitor) { if (text.startsWith("$SCAN_PROGRESS_")) { scanStatus(text); } } }); while (!launch.isTerminated()) { Thread.sleep(1000); } if (workspaceModel.isEmpty()) { workspaceModel.setStatus(ValidationStatus.error(Messages.noRepositoryFoundAtLocation)); } if (launch.isTerminated()) { monitor.done(); } } catch (final CoreException | IOException e) { throw new InvocationTargetException(e); } }
Example 18
Source File: LaunchShortcut.java From neoscada with Eclipse Public License 1.0 | 4 votes |
protected ILaunchConfigurationType getConfigurationType () { final ILaunchManager lm = DebugPlugin.getDefault ().getLaunchManager (); return lm.getLaunchConfigurationType ( CONFIGURATION_TYPE_ID ); }
Example 19
Source File: LaunchPipelineShortcut.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
private ILaunchConfigurationType getDataflowLaunchConfigurationType( ILaunchManager launchManager) { ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(DATAFLOW_LAUNCH_CONFIGURATION_TYPE_ID); return launchConfigurationType; }
Example 20
Source File: PreviewAction.java From texlipse with Eclipse Public License 1.0 | 4 votes |
/** * Launches either the most recent viewer configuration, or if there * is no previous viewers, creates a new viewer launch configuration. */ public void run(IAction action) { try { ILaunchConfiguration config = null; // Get the output format IProject project = TexlipsePlugin.getCurrentProject(); String outputFormat = TexlipseProperties.getProjectProperty(project, TexlipseProperties.OUTPUT_FORMAT); // Get the preferred viewer for the current output format ViewerAttributeRegistry var = new ViewerAttributeRegistry(); String preferredViewer = var.getPreferredViewer(outputFormat); if (null == preferredViewer) { BuilderRegistry.printToConsole(TexlipsePlugin.getResourceString("builderErrorOutputFormatNotSet").replaceAll("%s", project.getName())); throw new CoreException(TexlipsePlugin.stat("No previewer found for the current output format.")); } ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType( TexLaunchConfigurationDelegate.CONFIGURATION_ID); ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type); if (configs != null) { // Try to find a recent viewer launch first for (ILaunchConfiguration c : configs) { if (c.getType().getIdentifier().equals(TexLaunchConfigurationDelegate.CONFIGURATION_ID)) { if (c.getAttribute("viewerCurrent", "").equals(preferredViewer)) { config = c; break; } } } } // If there was no available viewer if (config == null) { // Create a new one ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, manager.generateUniqueLaunchConfigurationNameFrom("Preview Document in " + preferredViewer)); // Request another viewer than the topmost in the preferences workingCopy.setAttribute("viewerCurrent", preferredViewer); // For some reason the Eclipse API wants us to init default values // for new configurations using the ConfigurationTab dialog. TexLaunchConfigurationTab tab = new TexLaunchConfigurationTab(); tab.setDefaults(workingCopy); config = workingCopy.doSave(); } DebugUITools.launch(config, ILaunchManager.RUN_MODE); } catch (CoreException e) { TexlipsePlugin.log("Launching viewer", e); } }