public ILaunchConfiguration asLaunchConfiguration() { final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType type = manager.getLaunchConfigurationType(ErlangLaunchDelegate.CONFIGURATION_TYPE_INTERNAL); ILaunchConfigurationWorkingCopy workingCopy; try { final RuntimeInfo info = getRuntimeInfo(); final String name = getNodeName(); workingCopy = type.newInstance(null, name); workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, Charsets.ISO_8859_1.name()); workingCopy.setAttribute( DebugPlugin.ATTR_PROCESS_FACTORY_ID, "org.erlide.core.ertsProcessFactory"); workingCopy.setAttribute(ErlLaunchAttributes.NODE_NAME, getNodeName()); workingCopy.setAttribute(ErlLaunchAttributes.RUNTIME_NAME, info.getName()); workingCopy.setAttribute(ErlLaunchAttributes.COOKIE, getCookie()); // workingCopy.setAttribute(ErlLaunchAttributes.CONSOLE, // !options.contains(BackendOptions.NO_CONSOLE)); workingCopy.setAttribute(ErlLaunchAttributes.USE_LONG_NAME, hasLongName()); workingCopy.setAttribute(ErlLaunchAttributes.INTERNAL, isInternal()); return workingCopy; } catch (final CoreException e) { e.printStackTrace(); return null; } }
/* (non-Javadoc) * @see org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut#createConfiguration(org.eclipse.jdt.core.IType) */ @Override protected ILaunchConfiguration createConfiguration(IType type) { ILaunchConfiguration config = null; ILaunchConfigurationWorkingCopy wc = null; try { ILaunchConfigurationType configType = getConfigurationType(); wc = configType.newInstance( null, getLaunchManager().generateLaunchConfigurationName(type.getTypeQualifiedName('.'))); // wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, // type.getFullyQualifiedName()); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName()); wc.setMappedResources(new IResource[] {type.getUnderlyingResource()}); config = wc.doSave(); } catch (CoreException exception) { MessageDialog.openError( JDIDebugUIPlugin.getActiveWorkbenchShell(), LauncherMessages.JavaLaunchShortcut_3, exception.getStatus().getMessage()); } return config; }
/** Create & return a new configuration based on the specified <code>IType</code>. */ protected ILaunchConfiguration createConfiguration(IType type) { String launcherName = MainLauncher.this.getLauncherName(); ILaunchConfigurationType configType = MainLauncher.this.getLaunchConfigurationType(); ILaunchConfigurationWorkingCopy wc = null; try { wc = configType.newInstance(null, launcherName); } catch (CoreException exception) { JDIDebugUIPlugin.log(exception); return null; } wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName()); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName()); MainLauncher.this.setAdditionalAttributes(wc); ILaunchConfiguration config = null; try { config = wc.doSave(); } catch (CoreException exception) { JDIDebugUIPlugin.log(exception); } return config; }
/** * Return whether there are any registered launch configuration types for the mode of this action. * * @return whether there are any registered launch configuration types for the mode of this action */ private boolean existsConfigTypesForMode() { ILaunchConfigurationType[] configTypes = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); for (int i = 0; i < configTypes.length; i++) { ILaunchConfigurationType configType = configTypes[i]; if (configType.supportsMode(getMode())) { return true; } } return false; }
private static boolean isOSGiLaunch(ILaunch launch) throws CoreException { ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration(); boolean result = false; if (launchConfiguration != null) { ILaunchConfigurationType type = launchConfiguration.getType(); String identifier = type.getIdentifier(); if (identifier.equals("org.eclipse.pde.ui.EquinoxLauncher")) { result = true; } } return result; }
private static ILaunchConfiguration createLaunchConfigurationForProject(IJavaProject javaProject) throws CoreException { DebugPlugin plugin = DebugPlugin.getDefault(); ILaunchManager manager = plugin.getLaunchManager(); ILaunchConfigurationType javaAppType = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy wc = javaAppType.newInstance(null, "temp-config"); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, javaProject.getElementName()); return wc; }
/** cli Comment method "removeJobLaunch". */ public static void removeJobLaunch(IRepositoryViewObject objToDelete) { if (objToDelete == null) { return; } Property property = objToDelete.getProperty(); if (property == null || !(property.getItem() instanceof ProcessItem)) { return; } Project project = ProjectManager.getInstance().getProject(property); if (project == null) { return; } final String objProjectName = project.getLabel(); final String objId = property.getId(); // final String objName = property.getLabel(); final String objVersion = property.getVersion(); ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); if (launchManager == null) { return; } try { ILaunchConfiguration configuration = null; for (ILaunchConfiguration config : launchManager.getLaunchConfigurations()) { String jobId = config.getAttribute(TalendDebugUIConstants.JOB_ID, (String) null); // String jobName = configuration.getAttribute(TalendDebugUIConstants.JOB_NAME, (String) // null); String jobVersion = config.getAttribute(TalendDebugUIConstants.JOB_VERSION, (String) null); String projectName = config.getAttribute(TalendDebugUIConstants.CURRENT_PROJECT_NAME, (String) null); ILaunchConfigurationType type = config.getType(); if (type != null && TalendDebugUIConstants.JOB_DEBUG_LAUNCH_CONFIGURATION_TYPE.equals( type.getIdentifier()) && objProjectName.equals(projectName) && objId.equals(jobId) && objVersion.equals(jobVersion)) { configuration = config; break; } } if (configuration == null) { return; } configuration.delete(); } catch (CoreException e) { // nothing to do } }
/** * Tests the {@link * BuilderCoreUtils#isUnmigratedConfig(org.eclipse.debug.core.ILaunchConfiguration)} method * * @throws Exception */ public void testIsUnmigratedConfig1() throws Exception { ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager() .getLaunchConfigurationType( IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); if (type != null) { ILaunchConfigurationWorkingCopy config = type.newInstance( BuilderCoreUtils.getBuilderFolder(getProject(), true), "testIsUnmigratedConfig1"); //$NON-NLS-1$ assertTrue( "should be considered 'unmigrated'", BuilderCoreUtils.isUnmigratedConfig(config)); // $NON-NLS-1$ } else { fail("could not find the Ant builder launch configuration type"); // $NON-NLS-1$ } }
private void launch(String pName, String fName, String mode) { try { ILaunchConfiguration found = null; ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType lct = lm.getLaunchConfigurationType(GoLaunchConfigurationDelegate.ID); ILaunchConfiguration[] lcfgs = lm.getLaunchConfigurations(lct); for (ILaunchConfiguration lcf : lcfgs) { String project = lcf.getAttribute(GoConstants.GO_CONF_ATTRIBUTE_PROJECT, ""); String mainfile = lcf.getAttribute(GoConstants.GO_CONF_ATTRIBUTE_MAIN, ""); String prgArgs = lcf.getAttribute(GoConstants.GO_CONF_ATTRIBUTE_ARGS, ""); if (prgArgs.isEmpty()) { // this is an empty run, no params, don't mix with already // definded with params if (project.equalsIgnoreCase(pName) && Path.fromOSString(fName).equals(Path.fromOSString(mainfile))) { found = lcf; break; } } } if (found == null) { // create a new launch configuration String cfgName = lm.generateLaunchConfigurationName(Path.fromOSString(fName).lastSegment()); ILaunchConfigurationWorkingCopy workingCopy = lct.newInstance(null, cfgName); workingCopy.setAttribute(GoConstants.GO_CONF_ATTRIBUTE_PROJECT, pName); workingCopy.setAttribute(GoConstants.GO_CONF_ATTRIBUTE_MAIN, fName); workingCopy.setAttribute(GoConstants.GO_CONF_ATTRIBUTE_ARGS, ""); workingCopy.setAttribute( GoConstants.GO_CONF_ATTRIBUTE_BUILD_CONFIG, BuildConfiguration.RELEASE.toString()); workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, "UTF-8"); found = workingCopy.doSave(); } if (found != null) { found.launch(mode, null, true, true); } } catch (CoreException ce) { Activator.logError(ce); } }
protected ILaunchConfiguration createNewLaunchConfiguration(IFile file) { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(getConfigType()); try { ILaunchConfigurationWorkingCopy newConfig = configType.newInstance( null, launchManager.generateLaunchConfigurationName(file.getName())); newConfig.setAttribute(FILE_NAME, file.getFullPath().toString()); // newConfig.setAttribute(OPERATION_CLASS, "org.yakindu.Operations"); return newConfig.doSave(); } catch (CoreException e) { e.printStackTrace(); } throw new IllegalStateException(); }
@Override // TODO LWA danger of NullPointerException // integrate commons HashCodeBuilder public int hashCode() { int code = PRIME_BASE; code = PRIME_MULTIPLYER * code + launchConfigurationType.hashCode(); code = PRIME_MULTIPLYER * code + categoryNode.hashCode(); return code; }
@Override public boolean equals(Object obj) { if (obj instanceof LaunchTypeNode) { LaunchTypeNode typeNode = (LaunchTypeNode) obj; return launchConfigurationType.equals(typeNode.getLaunchConfigurationType()) && categoryNode.equals(typeNode.getCategoryNode()); } return super.equals(obj); }
protected ILaunchConfiguration createConfiguration(IType type) { ILaunchConfiguration config = null; ILaunchConfigurationWorkingCopy wc = null; try { ILaunchConfigurationType configType = getAJConfigurationType(); wc = configType.newInstance( null, getLaunchManager().generateLaunchConfigurationName(type.getElementName())); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName()); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName()); config = wc.doSave(); } catch (CoreException exception) { reportErorr(exception); } return config; }
private ILaunchConfiguration createLaunchConfiguration(IContainer basedir, String goal) { try { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID); String launchSafeGoalName = goal.replace(':', '-'); ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance( null, // NLS.bind( Messages.ExecutePomAction_executing, launchSafeGoalName, basedir.getLocation().toString().replace('/', '-'))); workingCopy.setAttribute( MavenLaunchConstants.ATTR_POM_DIR, basedir.getLocation().toOSString()); workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, goal); workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "${project}"); // $NON-NLS-1$ workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, true); setProjectConfiguration(workingCopy, basedir); IPath path = getJREContainerPath(basedir); if (path != null) { workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString()); } // TODO when launching Maven with debugger consider to add the following property // -Dmaven.surefire.debug="-Xdebug // -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent // -Djava.compiler=NONE" return workingCopy; } catch (CoreException ex) { log.error(ex.getMessage(), ex); } return null; }
/* * (non-Javadoc) * * @see org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier#getMacros(int, * java.lang.Object) */ public ICdtVariable[] getMacros(int contextType, Object contextData) { switch (contextType) { case ILaunchVariableContextInfo.CONTEXT_LAUNCH: if (contextData instanceof ILaunchConfiguration) { loadLaunchConfigurationMacroSuppliers(); try { ILaunchConfigurationType launchConfigurationType = ((ILaunchConfiguration) contextData).getType(); ILaunchConfigurationVariableSupplier launchConfigurationMacroSupplier = (ILaunchConfigurationVariableSupplier) this.auxiliarySuppliers.get(launchConfigurationType.getIdentifier()); return launchConfigurationMacroSupplier.getVariables( (ILaunchConfiguration) contextData); } catch (CoreException e) { e.printStackTrace(); } } } return null; }
ILaunchConfigurationWorkingCopy createConfiguration(IPath targetPath) throws CoreException { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId); ILaunchConfigurationWorkingCopy wc; wc = configType.newInstance( null, manager.generateUniqueLaunchConfigurationNameFrom(targetPath.lastSegment())); wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString()); wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN); wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES); IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath); if (targetResource != null && targetResource.exists()) wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, targetResource.getProject().getName()); return wc; }
/** * Creates a launch configuration with the given name in the given location * * @param launchConfigName * @param path * @return the handle to the new launch configuration * @throws CoreException */ public static ILaunchConfiguration createLaunchConfiguration(String launchConfigName, String path) throws CoreException { ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager() .getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); ILaunchConfigurationWorkingCopy config = type.newInstance( AbstractAntUITest.getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName); //$NON-NLS-1$ config.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, AbstractAntUITest.getJavaProject().getElementName()); config.setAttribute( IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + path + "}"); // $NON-NLS-1$ //$NON-NLS-2$ config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); config.doSave(); return config; }
private ILaunchConfiguration getLaunchConfiguration( final RuntimeInfo info, final Set<BackendOptions> options) { final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType type = manager.getLaunchConfigurationType(ErlangLaunchDelegate.CONFIGURATION_TYPE_INTERNAL); ILaunchConfigurationWorkingCopy workingCopy; try { workingCopy = type.newInstance(null, "internal " + info.getNodeName()); workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, "ISO-8859-1"); workingCopy.setAttribute(ErlLaunchAttributes.NODE_NAME, info.getNodeName()); workingCopy.setAttribute(ErlLaunchAttributes.RUNTIME_NAME, info.getName()); workingCopy.setAttribute(ErlLaunchAttributes.COOKIE, info.getCookie()); workingCopy.setAttribute( ErlLaunchAttributes.CONSOLE, !options.contains(BackendOptions.NO_CONSOLE)); workingCopy.setAttribute(ErlLaunchAttributes.USE_LONG_NAME, false); return workingCopy; } catch (final CoreException e) { e.printStackTrace(); return null; } }
private ILaunchConfiguration getLaunchConfiguration( final Collection<IErlProject> projects, final String mode) throws CoreException { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final List<String> projectNames = getProjectNames(projects); String name = ListsUtils.packList(projectNames, "_"); if (name.length() > 15) { name = ListsUtils.packList(StringUtils.removeCommonPrefixes(projectNames), "_"); } // try and find one final ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(); for (final ILaunchConfiguration launchConfiguration : launchConfigurations) { if (launchConfiguration.getName().equals(name)) { if (mode.equals(ILaunchManager.DEBUG_MODE)) { return addInterpretedModules(projects, launchConfiguration); } return launchConfiguration; } } // try and make one final ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(ErlangLaunchDelegate.CONFIGURATION_TYPE); ILaunchConfigurationWorkingCopy wc = null; wc = launchConfigurationType.newInstance(null, name); wc.setAttribute( ErlLaunchAttributes.PROJECTS, ListsUtils.packList(projectNames, PROJECT_NAME_SEPARATOR)); wc.setAttribute( ErlLaunchAttributes.RUNTIME_NAME, projects.iterator().next().getRuntimeInfo().getName()); wc.setAttribute(ErlLaunchAttributes.NODE_NAME, name); wc.setAttribute(ErlLaunchAttributes.CONSOLE, true); wc.setAttribute(ErlLaunchAttributes.INTERNAL, false); wc.setAttribute(ErlLaunchAttributes.LOAD_ALL_NODES, false); wc.setAttribute(ErlLaunchAttributes.COOKIE, "erlide"); wc.setAttribute("org.eclipse.debug.core.environmentVariables", Maps.newHashMap()); if (mode.equals("debug")) { final List<String> moduleNames = getProjectAndModuleNames(projects); wc.setAttribute(ErlLaunchAttributes.DEBUG_INTERPRET_MODULES, moduleNames); } wc.setMappedResources(getProjectResources(projects)); return wc.doSave(); }
/** * Creates a shared launch configuration for launching Ant in a separate VM with the given name. * * @since 3.5 */ public static void createLaunchConfigurationForSeparateVM( String launchConfigName, String buildFileName) throws Exception { String bf = buildFileName; ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager() .getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE); ILaunchConfigurationWorkingCopy config = type.newInstance( AbstractAntUITest.getJavaProject().getProject().getFolder("launchConfigurations"), launchConfigName); //$NON-NLS-1$ config.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.eclipse.ant.internal.launching.remote.InternalAntRunner"); //$NON-NLS-1$ config.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ config.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, AbstractAntUITest.getJavaProject().getElementName()); if (bf == null) { bf = launchConfigName; } config.setAttribute( IExternalToolConstants.ATTR_LOCATION, "${workspace_loc:/" + PROJECT_NAME + "/buildfiles/" + bf + ".xml}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ config.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); config.setAttribute( DebugPlugin.ATTR_PROCESS_FACTORY_ID, IAntUIConstants.REMOTE_ANT_PROCESS_FACTORY_ID); ProjectHelper.setVM(config); config.doSave(); }
/** * Verifies that the classpath entry is valid and won't cause the launch to fail. * * @param entry The entry to validate. * @param serverProject The project that the test server will run out of. * @return true if it's valid */ public static boolean classpathEntryIsValid(String entry, IProject serverProject) { try { ILaunchConfigurationType type = DebugPlugin.getDefault() .getLaunchManager() .getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy copy = type.newInstance(null, "ezeTemp"); // $NON-NLS-1$ copy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, serverProject.getName()); copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); List<String> classpath = new ArrayList<String>(1); classpath.add(entry); copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath); JavaRuntime.resolveRuntimeClasspath( JavaRuntime.computeUnresolvedRuntimeClasspath(copy), copy); return true; } catch (CoreException ce) { return false; } }
/** Create a new CreateLaunchAction. */ public CreateLaunchAction( ManageLaunchesDialog launchConfigurationDialog, ILaunchConfigurationType configType) { super("Create a new " + configType.getName()); this.launchConfigurationDialog = launchConfigurationDialog; this.configType = configType; setImageDescriptor( new DecorationOverlayIcon( SDBGDebugUIPlugin.getImage(DebugUITools.getDefaultImageDescriptor(configType)), SDBGDebugUIPlugin.getImageDescriptor("ovr16/new.png"), IDecoration.TOP_RIGHT)); }
public Collection<ILaunchNode> getLaunchNodes() { Set<ILaunchNode> launchNodes = new HashSet<ILaunchNode>(); if (categoryNode != null) { for (ILaunchNode launchNode : categoryNode.getLaunchNodes()) { try { if (launchConfigurationType.equals(launchNode.getLaunchConfiguration().getType())) { launchNodes.add(launchNode); } } catch (CoreException e) { } } } return launchNodes; }
public static ILaunchConfiguration getLaunchConfiguration( IProject project, String script, boolean persist) throws CoreException { ILaunchConfigurationType configType = getLaunchConfigurationType(); IGrailsInstall install = GrailsCoreActivator.getDefault().getInstallManager().getGrailsInstall(project); if (install == null) { return null; } String nameAndScript = (script != null ? "(" + script + ")" : ""); if (project != null) { nameAndScript = project.getName() + " " + nameAndScript; } nameAndScript = sanitize(nameAndScript); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, nameAndScript); GrailsLaunchArgumentUtils.prepareLaunchConfiguration( project, script, install, GrailsBuildSettingsHelper.getBaseDir(project), wc); if (persist) { return wc.doSave(); } else { return wc; } }
private void processLauncherEvent(DebugEvent event) throws CoreException { if (!(event.getSource() instanceof RuntimeProcess)) { return; } RuntimeProcess runtimeProcess = (RuntimeProcess) event.getSource(); ILaunch launch = runtimeProcess.getLaunch(); ILaunchConfiguration launchConfig = launch.getLaunchConfiguration(); if (launchConfig == null) { return; } ILaunchConfigurationType launchType = launchConfig.getType(); ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType sdmCodeServerType = launchManager.getLaunchConfigurationType(GwtSuperDevModeLaunchConfiguration.TYPE_ID); if (launchType.equals(sdmCodeServerType) && event.getKind() == DebugEvent.CREATE) { // Start: Observe the console for SDM launching processSdmCodeServerLauncher(event); } else if (launchType.equals(sdmCodeServerType) && event.getKind() == DebugEvent.TERMINATE) { // Stop: Observe the console for SDM terminating processSdmCodeServerTerminate(event); } else { if (event.getKind() == DebugEvent.CREATE) { // Start: Delineate event for Server Launching and then possibly launch SDM posiblyLaunchGwtSuperDevModeCodeServer(event); } else if (event.getKind() == DebugEvent.TERMINATE) { // Stop: Delineate event for Server Launching and then possibly terminate SDM possiblyTerminateLaunchConfiguration(event); } } }
public void exec(final IProject project, final IProgressMonitor monitor) { final ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType configType = lm.getLaunchConfigurationType( "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); try { final String projectName = project.getName(); final ILaunchConfigurationWorkingCopy config = configType.newInstance( null, lm.generateLaunchConfigurationName(LAUT_ENTRY + " " + projectName)); config.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true); config.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_CONSOLE", true); config.setAttribute("org.eclipse.debug.ui.ATTR_PRIVATE", true); config.setAttribute( "org.eclipse.debug.core.ATTR_REFRESH_SCOPE", "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?><resources><item path=\"/" + project.getName() + "\" type=\"4\"/></resources>}"); config.setAttribute( "org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE", "${projects:" + projectName + "}"); config.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", getExecPath()); config.setAttribute( "org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", "-f \"" + project.getLocation().toOSString() + "\""); config.setAttribute( "org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY", getWorkingPath().toOSString()); new LaunchHelper().launch(config, ILaunchManager.RUN_MODE, monitor); } catch (CoreException e) { AlloyCore.logError("Problem launching laut tool.", e); } }
private boolean execMavenLaunch( final IProject project, final String goal, final IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(LAUNCH_CONFIGURATION_TYPE_ID); final IPath basedirLocation = project.getLocation(); final String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment()); final ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName); workingCopy.setAttribute(ATTR_POM_DIR, basedirLocation.toString()); workingCopy.setAttribute(ATTR_GOALS, goal); workingCopy.setAttribute(ATTR_UPDATE_SNAPSHOTS, true); workingCopy.setAttribute(ATTR_WORKSPACE_RESOLUTION, true); workingCopy.setAttribute(ATTR_SKIP_TESTS, true); if (facade != null) { final ResolverConfiguration configuration = facade.getResolverConfiguration(); final String selectedProfiles = configuration.getSelectedProfiles(); if (selectedProfiles != null && selectedProfiles.length() > 0) { workingCopy.setAttribute(ATTR_PROFILES, selectedProfiles); } new LaunchHelper().launch(workingCopy, "run", monitor); return true; } else { return false; } }
protected ILaunchConfiguration createConfiguration(LaunchConfigurationInfo info) throws CoreException { ILaunchConfiguration config = null; ILaunchConfigurationWorkingCopy wc = null; final ILaunchConfigurationType configType = getLaunchManager() .getLaunchConfigurationType("migdb.dsl.ide.launch.OpsLaunchConfigurationType"); wc = configType.newInstance( null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(info.name)); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, info.project); wc.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, MigDbLauncher.class.getName()); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false); wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, info.opsFile); wc.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "${workspace}"); wc.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, true); config = wc.doSave(); return config; }
/** * @param host * @param port * @param timeout * @param appName * @param launchName * @return non-null launch configuration to debug the given application name. * @throws CoreException if unable to resolve launch configuration. */ protected ILaunchConfiguration resolveLaunchConfiguration(String host, int port, int timeout) throws CoreException { String launchLabel = getLaunchLabel(); String configID = provider.getLaunchConfigurationID() != null ? provider.getLaunchConfigurationID() : CloudFoundryDebuggingLaunchConfigDelegate.LAUNCH_CONFIGURATION_ID; launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(configID); if (launchConfigType != null) { IProject project = getApplicationModule().getLocalModule().getProject(); // Create the launch configuration, whether the project exists // or not, as there may // not be a local project associated with the deployed app ILaunchConfiguration launchConfiguration = launchConfigType.newInstance(project, launchLabel); ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy(); if (project != null && project.isAccessible()) { wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName()); } // Convert all to String to make it consistent when reading the // attributes later. wc.setAttribute(CloudFoundryDebuggingLaunchConfigDelegate.HOST_NAME, host); wc.setAttribute(CloudFoundryDebuggingLaunchConfigDelegate.PORT, port + ""); // $NON-NLS-1$ wc.setAttribute( CloudFoundryDebuggingLaunchConfigDelegate.TIME_OUT, timeout + ""); // $NON-NLS-1$ wc.setAttribute(DebugOperations.CLOUD_DEBUG_LAUNCH_ID, getDebuggerConnectionIdentifier()); wc.setAttribute(DebugOperations.CLOUD_DEBUG_SERVER, getCloudFoundryServer().getServerId()); wc.setAttribute( DebugOperations.CLOUD_DEBUG_APP_NAME, getApplicationModule().getDeployedApplicationName()); return launchConfiguration = wc.doSave(); } else { throw CloudErrorUtil.toCoreException( "No debug launch configuration found for - " + provider.getLaunchConfigurationID()); // $NON-NLS-1$ } }
protected void create(ILaunchConfigurationType configType) { try { ILaunchConfigurationWorkingCopy wc = configType.newInstance( null, DebugPlugin.getDefault() .getLaunchManager() .generateLaunchConfigurationName("New launch")); // TODO(devoncarew): init this launch config with a starting resource and name wc.doSave(); launchConfigurationDialog.selectLaunchConfiguration(wc.getName()); } catch (CoreException exception) { DebugErrorHandler.errorDialog( launchConfigurationDialog.getShell(), "Error Created Launch", "Unable to create the selected launch: " + exception.toString(), exception); } }