@Override public Object getParent(Object element) { if(element instanceof ILaunchConfiguration) { try { return ((ILaunchConfiguration)element).getType(); } catch (CoreException e) { return null; } } return null; } @Override
public ILaunchConfigurationType getType() throws CoreException { return delegate.getType(); }
/** * @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType) */ @Override public synchronized ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>(); for (ILaunchConfiguration config : getAllLaunchConfigurations()) { if (config.getType().equals(type)) { configs.add(config); } } return configs.toArray(new ILaunchConfiguration[configs.size()]); }
/** * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object) */ @Override public int category(Object element) { Map<ILaunchConfigurationType, Integer> map = getCategories(); if (element instanceof ILaunchConfiguration) { ILaunchConfiguration configuration = (ILaunchConfiguration) element; try { Integer i = map.get(configuration.getType()); if (i != null) { return i.intValue(); } } catch (CoreException e) { } } return map.size(); }
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); }
public static boolean isSupported(ILaunchConfiguration configuration) { try { return launchConfigTypeFor(configuration.getType().getIdentifier()) != null; } catch (CoreException e) { return false; } }
public static Set<IPackageFragmentRoot> collectSourceFolders(ILaunchConfiguration configuration) throws CoreException { SupportedLaunchConfigType type = launchConfigTypeFor(configuration.getType().getIdentifier()); if (type == null) { return ImmutableSet.of(); } return type.getSourceFolders(configuration); }
/** * Returns the tab group for the given launch configuration and the mode the dialog opened in * @param type the type of the configuration * @param config * @param mode * @return * @throws CoreException */ public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfiguration config, String mode) throws CoreException { HashSet<String> modes = new HashSet<>(); modes.add(mode); LaunchConfigurationTabGroupExtension ext = getExtension(config.getType().getIdentifier(), modes); if (ext == null) { IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "No tab group defined for launch configuration type " + config.getType().getIdentifier(), null); //$NON-NLS-1$ throw new CoreException(status); } return new LaunchConfigurationTabGroupWrapper(ext.newTabGroup(), ext.getIdentifier(), config); }
/** * 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); }
/** * Constructor * @param parentShell the parent shell * @param mode the current mode context * @param configuration the current launch configuration context * * @throws CoreException */ public SelectLaunchModesDialog(Shell parentShell, String mode, ILaunchConfiguration configuration) throws CoreException { super(parentShell); super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3); setShellStyle(getShellStyle() | SWT.RESIZE); fValidModes = new ArrayList<>(); Set<Set<String>> modes = configuration.getType().getSupportedModeCombinations(); for (Set<String> modeset : modes) { if(modeset.contains(mode)) { fValidModes.add(modeset); } } }
@Override public ISourcePathComputer getSourcePathComputer(ILaunchConfiguration configuration) throws CoreException { String id = null; id = configuration.getAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID, (String)null); if (id == null) { //use default computer for configuration type, if any return configuration.getType().getSourcePathComputer(); } return getSourcePathComputer(id); }
/** * Returns if the specified configuration should be considered as a potential candidate * @param config to configuration * @return if the specified configuration should be considered as a potential candidate * @throws CoreException if an exception occurs */ private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException { if(config != null && !DebugUITools.isPrivate(config)) { if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$ return true; } else { IResource[] res = config.getMappedResources(); if(res != null) { return true; } } } return false; }
private boolean hasSelfRecursive(ILaunchConfiguration c) throws CoreException { if (c == null) { return false; } if (c.getType().equals(groupType)) { // it's a launch group if (c.getName().equals(selfRef.getName())) { return true; } // recurse to all elements of the group for (GroupLaunchElement e : GroupLaunchConfigurationDelegate.createLaunchElements(c)) { // if any of the contained configs is self if (hasSelfRecursive(e.data)) { return true; } } } return false; }
private IPluginBase[] getPlugins() { IPluginModelBase[] models = null; try { ILaunchConfigurationType type = fLaunchConfig.getType(); String id = type.getIdentifier(); // if it is an Eclipse launch if (id.equals(EclipseLaunchShortcut.CONFIGURATION_TYPE)) models = BundleLauncherHelper.getMergedBundles(fLaunchConfig, false); // else if it is an OSGi launch else if (id.equals(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE)) models = BundleLauncherHelper.getMergedBundles(fLaunchConfig, true); } catch (CoreException e) { } IPluginBase[] result = new IPluginBase[models == null ? 0 : models.length]; for (int i = 0; i < result.length; i++) result[i] = models[i].getPluginBase(true); return result; }
/** * Returns the launch group that the given launch configuration belongs to, for the specified * mode, or <code>null</code> if none. * * @param configuration the launch configuration * @param mode the mode * @return the launch group the given launch configuration belongs to, for the specified mode, * or <code>null</code> if none * @since 3.0 */ public static ILaunchGroup getLaunchGroup(ILaunchConfiguration configuration, String mode) { try { return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(configuration.getType(), mode); } catch(CoreException ce) { return null; } }
/** * Used to render launch history items in the re-launch drop downs */ protected String getLaunchText(ILaunch launch) { if (launch.getLaunchConfiguration() == null || (!launch.getLaunchConfiguration().exists() && !launch.getLaunchConfiguration().isWorkingCopy())) { return DebugUIMessages.DefaultLabelProvider__unknown__1; } // new launch configuration ILaunchConfiguration config = launch.getLaunchConfiguration(); StringBuffer buff= new StringBuffer(config.getName()); buff.append(" ["); //$NON-NLS-1$ try { buff.append(config.getType().getName()); } catch (CoreException e) { DebugUIPlugin.log(e); } buff.append("]"); //$NON-NLS-1$ return buff.toString(); }
/** * Determines if the currently showing launch configuration has multiple launch delegates for the same mode set, but does not care * if there has been a default selected yet or not * @return true if the current launch configuration has multiple launch delegates, false otherwise */ private boolean hasMultipleDelegates() { ILaunchConfiguration config = getWorkingCopy(); if(config != null) { try { Set<String> modes = getCurrentModeSet(); ILaunchDelegate[] delegates = LaunchConfigurationManager.filterLaunchDelegates(config.getType(), modes); return delegates.length > 1; } catch (CoreException ce) {DebugUIPlugin.log(ce);} } return false; }
/** * Goes through all the dart launches registered with the {@link ILaunchManager} and removes the * terminated launches * * @throws CoreException */ public static void removeTerminatedLaunches() throws CoreException { ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); for (ILaunch launch : launches) { if (launch.getLaunchConfiguration() == null || (launch.getLaunchConfiguration().getType().getIdentifier().startsWith( "com.github.sdbg") && launch.isTerminated())) { removeLaunch(launch); } } }
/** * Computes and returns the image descriptor for this console. * * @return an image descriptor for this console or <code>null</code> */ protected ImageDescriptor computeImageDescriptor() { ILaunchConfiguration configuration = getProcess().getLaunch().getLaunchConfiguration(); if (configuration != null) { ILaunchConfigurationType type; try { type = configuration.getType(); return DebugPluginImages.getImageDescriptor(type.getIdentifier()); } catch (CoreException e) { DebugUIPlugin.log(e); } } return null; }
@Override public void runWithEvent(Event event) { if ((event.stateMask & SWT.MOD1) > 0) { try { ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fConfig.getType(), fMode); if(group != null) { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(fConfig), group.getIdentifier()); } else { runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false); } } catch(CoreException ce) {} } else { runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false); } }