@Override public String generateName(String name) { if (name == null) { name = ""; //$NON-NLS-1$ } String providerConfigutationName = generateProviderConfigurationName(name, providerToolName); return getLaunchManager().generateLaunchConfigurationName(providerConfigutationName); } };
@Override public String generateName(String name) { if (name == null) { return getLaunchManager().generateLaunchConfigurationName(IInternalDebugCoreConstants.EMPTY_STRING); } return getLaunchManager().generateLaunchConfigurationName(name); }
/** * Generates a launch configuration name using the specified name. * * @param name the name, must not be null * @return an unique launch configuration name */ public static String generateLaunchConfigurationName(String name) { return DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name); }
private String getComputedName(String prefix) { ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); return lm.generateLaunchConfigurationName(prefix); }
private ILaunchConfiguration createLaunchConfiguration(GradleRunConfigurationAttributes configurationAttributes) { // derive the name of the launch configuration from the configuration attributes // since the launch configuration name must not contain ':', we replace all ':' with '.' String taskNamesOrDefault = configurationAttributes.getTasks().isEmpty() ? "(default tasks)" : CollectionsUtils.joinWithSpace(configurationAttributes.getTasks()); String rawLaunchConfigurationName = String.format("%s - %s", configurationAttributes.getWorkingDir().getName(), taskNamesOrDefault); String launchConfigurationName = this.launchManager.generateLaunchConfigurationName(rawLaunchConfigurationName.replace(':', '.')); ILaunchConfigurationType launchConfigurationType = this.launchManager.getLaunchConfigurationType(GradleRunConfigurationDelegate.ID); try { // create new launch configuration instance ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchConfigurationName); // configure the launch configuration configurationAttributes.apply(launchConfiguration); // try to persist the launch configuration and return it return persistConfiguration(launchConfiguration); } catch (CoreException e) { throw new GradlePluginsRuntimeException(String.format("Cannot create Gradle launch configuration %s.", launchConfigurationName), e); } }
/** * Creates an {@link ILaunchConfiguration} from the given set of {@link ILaunchConfigurationType}s * @param types the set of {@link String} {@link ILaunchConfigurationType} identifiers * @return a new {@link ILaunchConfiguration} * @since 3.6 */ private ILaunchConfiguration createConfigurationFromTypes(Set<String> types) { //context launching always takes the first type, so we do that here as well if(types != null && types.size() > 0) { try { ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType((String) types.toArray()[0]); ILaunchConfigurationWorkingCopy copy = type.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2)); return copy; } catch(CoreException ce) { //do nothing return null } } return null; }
private ILaunchConfiguration getLaunchConfiguration(String mode, IResource resource) { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType configType = launchManager .getLaunchConfigurationType("org.eclipse.acute.dotnetrun.DotnetRunDelegate"); //$NON-NLS-1$ try { ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType); String configName; if (resource.getLocation().toFile().isFile()) { configName = NLS.bind(Messages.DotnetRunDelegate_configuration, resource.getParent().getName() + "." + resource.getName()); //$NON-NLS-1$ } else { configName = NLS.bind(Messages.DotnetRunDelegate_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()) { resource = resource.getParent(); } wc.setAttribute(PROJECT_FOLDER, resource.getLocation().toString()); return wc; } catch (CoreException e) { AcutePlugin.logError(e); } return null; }
configName = launchManager.generateLaunchConfigurationName(configName); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName); if (resource.getLocation().toFile().isFile()) {
@Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { // set default name for script IResource resource = DebugUITools.getSelectedResource(); if (resource != null && resource instanceof IFile) { IFile file = (IFile) resource; if (AntUtil.isKnownAntFile(file)) { String projectName = file.getProject().getName(); StringBuffer buffer = new StringBuffer(projectName); buffer.append(' '); buffer.append(file.getName()); String name = buffer.toString().trim(); name = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name); configuration.rename(name); // set the project name so that the correct default VM install can be determined configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", file.getFullPath().toString())); //$NON-NLS-1$ } } configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$ super.setDefaults(configuration); } }
configName = launchManager.generateLaunchConfigurationName(configName); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName); if (resource.getLocation().toFile().isFile()) {
public ILaunchConfigurationWorkingCopy createLaunchConfiguration() throws CoreException { DebugPlugin debugPlugin = DebugPlugin.getDefault(); ILaunchManager manager = debugPlugin.getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigTypeId); String name = manager.generateLaunchConfigurationName(getNewLaunchConfigurationName()); ILaunchConfigurationWorkingCopy launchConfig = type.newInstance(null, name); launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_CONSOLE", isLaunchCaptureInConsole()); launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", isLaunchInBackground()); launchConfig.setAttribute("org.eclipse.debug.ui.ATTR_PRIVATE", isLaunchIsPrivate()); IRuntimeClasspathEntry[] classpath = getClasspath(launchConfig); List<String> mementos = new ArrayList<>(classpath.length); for (IRuntimeClasspathEntry entry : classpath) { mementos.add(entry.getMemento()); } launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, Boolean.FALSE); launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, mementos); if (getMainClass() != null) { launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, getMainClass()); } if (ListUtil.isNotEmpty(launchArgs)) { StringBuilder sb = new StringBuilder(); for (String s : launchArgs) { sb.append("\""); sb.append(s); sb.append("\" "); } launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, sb.toString()); } return launchConfig; }
/** * @see AbstractLaunchConfigurationAction#performAction() */ @Override protected void performAction() { ILaunchConfiguration original = (ILaunchConfiguration)getStructuredSelection().getFirstElement(); String newName = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(original.getName()); try { ILaunchConfigurationWorkingCopy newWorkingCopy = original.copy(newName); newWorkingCopy.doSave(); } catch (CoreException e) { errorDialog(e); } }
.generateLaunchConfigurationName(newConfigurationName);
/** * Create a temporary launch with the given id and name. This launch is not yet registered with * the ILaunchManager. * * @param id * @param name * @return * @throws CoreException */ public static ILaunch createTemporaryLaunch(String id, String name) throws CoreException { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(id); ILaunchConfigurationWorkingCopy launchConfig = type.newInstance( null, manager.generateLaunchConfigurationName(name)); // TODO(devoncarew): is this necessary? launchConfig.delete(); SDBGSourceLookupDirector sourceLookupDirector = new SDBGSourceLookupDirector(); sourceLookupDirector.initializeDefaults(launchConfig); return new Launch(launchConfig, ILaunchManager.DEBUG_MODE, sourceLookupDirector); }
/** 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_LOGO, DEFAULT_SHOW_LOG_INFO, DEFAULT_OFFLINE); setRuntimeConfiguration(wc, SARLRuntime.getDefaultSREInstall(), DEFAULT_USE_SYSTEM_SRE, DEFAULT_USE_PROJECT_SRE, resetJavaMainClass); JavaMigrationDelegate.updateResourceMapping(wc); return wc; }
/** * Create, initialize and return a new launch configuration of the given type * * @return a new, properly-initialized launch configuration */ private ILaunchConfiguration createNewConfiguration() { try { ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = lm.getLaunchConfigurationType(getLaunchConfigurationTypeName()); String name = lm.generateLaunchConfigurationName(getName(type)); ILaunchConfigurationWorkingCopy wc = type.newInstance(null, name); initializeConfiguration(wc); // set a flag to know the information in the new config was generated by PDE wc.setAttribute(IPDEUIConstants.GENERATED_CONFIG, true); return wc.doSave(); } catch (CoreException ce) { PDEPlugin.logException(ce); } return null; }
public ILaunchConfiguration createConfiguration(IResource type){ if( type == null ) return null; ILaunchConfiguration config = null; ILaunchConfigurationWorkingCopy wc = null; try { ILaunchConfigurationType configType = getConfigurationType(); if(RunJettyRunTab.isWebappProject(type.getProject())){ String launchConfigName = getLaunchManager(). generateLaunchConfigurationName(type.getProject().getName()); wc = configType.newInstance(null, launchConfigName); IProject proj = type.getProject(); RunJettyRunTab.initDefaultConfiguration(wc, proj == null ? null : proj.getName(), launchConfigName); //set mapped resource , let next time we could execute this directly from menuitem. wc.setMappedResources(new IResource[] {type}); config = wc.doSave(); }else{ showError("Project is not a regular webapp project (missing WEB-INF)"); } } catch (CoreException exception) { showError( exception.getStatus().getMessage()); } return config; }
String projectName = bin.getResource().getProjectRelativePath().toString(); ILaunchConfigurationType configType = getLaunchConfigType(); ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(bin.getElementName()));
ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(null, DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(LaunchConfigurationsMessages.CreateLaunchConfigurationPrototypeAction_New_prototype_2)); ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode());
ILaunchConfigurationWorkingCopy wc = type.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2)); ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode());