ILaunchConfigurationWorkingCopy workingCopy = launchConfig.getWorkingCopy(); workingCopy.delete(); ILaunchConfigurationType launchType = launchConfig.getType(); IContainer container = launchConfig.getFile() == null ? null : launchConfig.getFile().getParent(); ILaunchConfigurationWorkingCopy newLaunchConfig = launchType.newInstance( container, workingCopy.getName() ); // copy all attributes from 'launchConfig' to 'newLaunchConfig' newLaunchConfig.doSave();
String id = type.getIdentifier(); String name = id + ".SHARED_INFO"; //$NON-NLS-1$ ILaunchConfiguration shared = null; workingCopy = type.newInstance(null, name); workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
/** * Determines all {@link IPackageFragmentRoot}s that potentially referenced by * a given launch configuration. * * @param configuration * launch configuration to determine overall scope * * @return overall scope */ public static Set<IPackageFragmentRoot> getOverallScope( ILaunchConfiguration configuration) throws CoreException { ICoverageLauncher launcher = (ICoverageLauncher) configuration.getType() .getDelegates(Collections.singleton(CoverageTools.LAUNCH_MODE))[0] .getDelegate(); return launcher.getOverallScope(configuration); }
DuplicateDelegate dd = null; for(int i = 0; i < types.length; i++) { modes = types[i].getSupportedModeCombinations(); for (Iterator<Set<String>> iter = modes.iterator(); iter.hasNext();) { modeset = iter.next(); delegates = types[i].getDelegates(modeset); if(delegates.length > 1) { tmp = fDuplicates.get(types[i]); tmp.add(dd); fDuplicates.put(types[i], tmp); prefdelegate = types[i].getPreferredDelegate(modeset); if(prefdelegate != null) { fDupeSelections.put(dd, prefdelegate);
/** * Returns the launch group the given launch configuration type belongs to, in * the specified mode, or <code>null</code> if none. * * @param type the type * @param mode the mode * @return the launch group the given launch configuration belongs to, in * the specified mode, or <code>null</code> if none */ public ILaunchGroup getLaunchGroup(ILaunchConfigurationType type, String mode) { if (!type.supportsMode(mode)) { return null; } String category = type.getCategory(); ILaunchGroup[] groups = getLaunchGroups(); ILaunchGroup extension = null; for (int i = 0; i < groups.length; i++) { extension = groups[i]; if (category == null) { if (extension.getCategory() == null && extension.getMode().equals(mode)) { return extension; } } else if (category.equals(extension.getCategory())) { if (extension.getMode().equals(mode)) { return extension; } } } return null; }
ILaunchConfigurationType type = lm.getLaunchConfigurationType(id); if(type != null) { String identifier = type.getIdentifier(); if (!typeIds.contains(identifier) && type.isPublic() && !"org.eclipse.ui.externaltools.builder".equals(type.getCategory())) { //$NON-NLS-1$ typeIds.add(identifier);
@Override public String getLocalId() { return type.getIdentifier(); }
Assert.isNotNull(monitor); long[] result= {}; final ILaunchConfigurationWorkingCopy copy= DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(LAUNCH_CONFIG_TYPE).newInstance(null, LAUNCH_CONFIG_TYPE + System.currentTimeMillis()); copy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); final ILaunchConfiguration configuration= copy.doSave(); try { final ILaunchConfigurationDelegate delegate= configuration.getType().getDelegate(ILaunchManager.RUN_MODE); if (delegate instanceof SerialVersionLaunchConfigurationDelegate) { final SerialVersionLaunchConfigurationDelegate extension= (SerialVersionLaunchConfigurationDelegate) delegate;
modes.addAll(config.getModes()); SelectLaunchersDialog sldd = new SelectLaunchersDialog(shell, config.getType().getDelegates(modes), config.getWorkingCopy(), mode); delegate = config.getType().getPreferredDelegate(modes);
priv = !type.isPublic(); return !priv && !equalCategories(type.getCategory(), fCategory) && !WorkbenchActivityHelper.filterItem(new LaunchConfigurationTypeContribution(type));
@Override public String getCategory() throws CoreException { return getType().getCategory(); }
@Override public int hashCode() { if (fType != null) { int hash = fType.getIdentifier().hashCode(); if (fDelegate != null) { hash += fDelegate.hashCode(); } return hash; } return super.hashCode(); }
ILaunchDelegate delegate = config.getPreferredDelegate(modes); if(delegate == null) { delegate = config.getType().getPreferredDelegate(modes); ILaunchDelegate[] delegates = config.getType().getDelegates(modes); for(int j = 0; j < delegates.length; j++) { if(delegateSet.size() == 0 || delegateSet.contains(delegates[j].getId())) {
return !priv && type.supportsMode(fGroup.getMode()) && equalCategories(type.getCategory(), fGroup.getCategory()) && !WorkbenchActivityHelper.filterItem(new LaunchConfigurationTypeContribution(type));
protected boolean saveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { if (IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY .equals(configuration.getType().getCategory())) { // don't prompt for builders return true; } return super.saveBeforeLaunch(configuration, mode, monitor); }
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); } }
/** * @see ILaunchManager#getLaunchConfigurationType(String) */ @Override public ILaunchConfigurationType getLaunchConfigurationType(String id) { ILaunchConfigurationType[] types = getLaunchConfigurationTypes(); for(int i = 0; i < types.length; i++) { if (types[i].getIdentifier().equals(id)) { return types[i]; } } return null; }
/** * Returns a listing of <code>IlaunchDeleagtes</code> that does not contain any delegates from disabled activities * @param type the type to get the delegates from * @param modes the set of launch modes to get delegates for * @return the filtered listing of <code>ILaunchDelegate</code>s or an empty array, never <code>null</code>. * @throws CoreException if an exception occurs * @since 3.3 */ public static ILaunchDelegate[] filterLaunchDelegates(ILaunchConfigurationType type, Set<String> modes) throws CoreException { IWorkbenchActivitySupport as = PlatformUI.getWorkbench().getActivitySupport(); ILaunchDelegate[] delegates = type.getDelegates(modes); if(as == null) { return delegates; } HashSet<ILaunchDelegate> set = new HashSet<>(); for(int i = 0; i < delegates.length; i++) { //filter by capabilities if(!WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(delegates[i]))) { set.add(delegates[i]); } } return set.toArray(new ILaunchDelegate[set.size()]); }
ILaunchDelegate[] delegates = getType().getDelegates(modes); ILaunchConfigurationDelegate delegate = null; if (delegates.length == 1) { ILaunchDelegate del = getPreferredDelegate(modes); if(del == null) { del = getType().getPreferredDelegate(modes); del = getPreferredDelegate(modes); if(del == null) { del = getType().getPreferredDelegate(modes);
/** * Returns if the specified configuration is supported by this instance of the view. * Supported means that: * <ul> * <li>The configuration is not private</li> * <li>AND that the configurations' type supports the mode of the current launch group</li> * <li>AND that the category of the configurations' type matches that of the current launch group</li> * </ul> * @param configuration the configuration * @return true if the configuration is supported by this instance of the view, false otherwise * * @since 3.4 */ protected boolean isSupportedConfiguration(ILaunchConfiguration configuration) { try { ILaunchConfigurationType type = configuration.getType(); return !configuration.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false) && type.supportsMode(getLaunchGroup().getMode()) && equalCategories(type.getCategory(), getLaunchGroup().getCategory()); } catch(CoreException ce) { DebugUIPlugin.log(ce); } return false; }