/** * Returns the mode of this action - run or debug * * @return the mode of this action - run or debug */ protected String getMode() { return fGroup.getMode(); }
@Override protected Object getViewerInput() { return fHistory.getLaunchGroup().getMode(); }
/** * Returns the mode (e.g., 'run' or 'debug') of this drop down. * * @return the mode of this action */ protected String getMode() { return internalGetHistory().getLaunchGroup().getMode(); }
/** * Returns the mode of this page - run or debug. */ protected String getMode() { return getLaunchHistory().getLaunchGroup().getMode(); }
/** * Constructs a contextual launch action for the given launch mode. * * @param mode launch mode */ public ContextualLaunchAction(String mode) { fMode = mode; ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); fGroupsByCategory = new HashMap<>(3); for (int i = 0; i < groups.length; i++) { ILaunchGroup group = groups[i]; if (group.getMode().equals(mode)) { if (group.getCategory() == null) { fGroup = group; } else { fGroupsByCategory.put(group.getCategory(), group); } } } }
/** * 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; }
private static synchronized void initializeModes() { if (modes != null) { return; } modes = new LinkedHashMap<>(); modes.put(GroupLaunchElement.MODE_INHERIT, new InheritModeGroup()); Set<ILaunchGroup> sortedGroups = new TreeSet<>((a, b) -> { return a.getLabel().compareTo(b.getLabel()); }); LaunchConfigurationManager mgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); sortedGroups.addAll(Arrays.asList(mgr.getLaunchGroups())); for (ILaunchGroup launchGroup : sortedGroups) { LaunchHistory history = mgr.getLaunchHistory(launchGroup.getIdentifier()); if (history == null) { // mode currently not supported. continue; } String modeName = launchGroup.getMode(); if (!modes.containsKey(modeName)) { modes.put(modeName, launchGroup); } } }
for (int i = 0; i < groups.length; i++) { ILaunchGroup group = groups[i]; if (group.getMode().equals(mode) && group.getCategory() == null) { return openLaunchConfigurationDialogOnGroup(shell, selection, group.getIdentifier());
/** * This method launches the last configuration that was launched, if any. * * @param group the launch group to launch with * @param isShift is Shift pressed (use <code>false</code> if no support for * Shift) * @return true if there was a last launch and it was launched, false * otherwise */ protected boolean launchLast(ILaunchGroup group, boolean isShift) { ILaunchConfiguration config = null; if(group != null) { config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier()); if(config != null) { launch(config, group.getMode(), isShift); return true; } } return false; }
/** * Construct a launch configuration corresponding to the specified XML * element, and place it in the appropriate history. * @param entry the XML entry to read from * @param histories the array of histories to try and add the restored configurations to * @param prepend if any restored items should be added to to top of the launch history */ private void createHistoryElement(Element entry, LaunchHistory[] histories, boolean prepend) { String memento = entry.getAttribute(IConfigurationElementConstants.MEMENTO); String mode = entry.getAttribute(IConfigurationElementConstants.MODE); try { ILaunchConfiguration launchConfig = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(memento); //touch the type to see if its type exists launchConfig.getType(); if (launchConfig.exists()) { LaunchHistory history = null; for (int i = 0; i < histories.length; i++) { history = histories[i]; if (history.accepts(launchConfig) && history.getLaunchGroup().getMode().equals(mode)) { history.addHistory(launchConfig, prepend); } } } } catch (CoreException e) { //do nothing, as we want to throw away invalid launch history entries silently } }
List<LaunchShortcutExtension> sc = pruneShortcuts(shortcuts, resource, group.getMode()); LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); return appendLaunched(config); List<ILaunchConfiguration> configs = getParticipatingLaunchConfigurations(selection, resource, sc, group.getMode()); int csize = configs.size(); if(csize == 1) {
/** * Returns whether the given configuration is included in the group * associated with this launch history. * * @param launch * @return boolean */ public boolean accepts(ILaunchConfiguration configuration) { try { if (!LaunchConfigurationManager.isVisible(configuration)) { return false; } if (configuration.getType().supportsMode(getLaunchGroup().getMode())) { String launchCategory = null; launchCategory = configuration.getCategory(); String category = getLaunchGroup().getCategory(); if (launchCategory == null || category == null) { return launchCategory == category; } return category.equals(launchCategory); } } catch (CoreException e) { DebugUIPlugin.log(e); } return false; }
/** * Removes the specified <code>ILaunchConfiguration</code> from the launch histories associated * with the specified listing of <code>ILaunchGroup</code>s. * @param config the configuration to remove from the histories from the given launch groups * @param groups the launch groups whose histories the given configuration should be removed from * * @since 3.4 */ private void removeFromLaunchHistories(ILaunchConfiguration config, ILaunchGroup[] groups) { LaunchHistory history = null; for(int i = 0; i < groups.length; i++) { history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(groups[i].getIdentifier()); if(history != null) { history.removeFromHistory(fConfiguration); } else { DebugUIPlugin.logErrorMessage(MessageFormat.format("Unable to remove configuration [{0}] from launch history. The launch history for mode [{1}] does not exist.", new Object[] { config.getName(), groups[i].getMode() })); //$NON-NLS-1$ } } }
/** * Creates a cascading menu action to populate with shortcuts in the given * launch group. * * @param launchGroupIdentifier launch group identifier */ public LaunchShortcutsAction(String launchGroupIdentifier) { super(); fGroup = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(launchGroupIdentifier); ILaunchMode mode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fGroup.getMode()); setText(mode.getLaunchAsLabel()); setMenuCreator(this); setEnabled(existsConfigTypesForMode()); }
/** * Computes the context id for this viewer * @return the context id */ public String computeContextId() { try { ISelection selection = getViewer().getSelection(); if (!selection.isEmpty() && selection instanceof IStructuredSelection ) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object firstSelected = structuredSelection.getFirstElement(); ILaunchConfigurationType configType = null; if (firstSelected instanceof ILaunchConfigurationType) { configType = (ILaunchConfigurationType) firstSelected; } else if (firstSelected instanceof ILaunchConfiguration) { configType = ((ILaunchConfiguration) firstSelected).getType(); } if (configType != null) { String helpContextId = LaunchConfigurationPresentationManager.getDefault().getHelpContext(configType, fLaunchGroup.getMode()); if (helpContextId != null) { return helpContextId; } } } } catch (CoreException ce) {DebugUIPlugin.log(ce);} return null; }
return !priv && type.supportsMode(fGroup.getMode()) && equalCategories(type.getCategory(), fGroup.getCategory()) && !WorkbenchActivityHelper.filterItem(new LaunchConfigurationTypeContribution(type));
/** * @see org.eclipse.ui.dialogs.FilteredTree#doCreateTreeViewer(org.eclipse.swt.widgets.Composite, int) */ @Override protected TreeViewer doCreateTreeViewer(Composite cparent, int style) { treeViewer = new LaunchConfigurationViewer(cparent, style); treeViewer.setLabelProvider(new DecoratingLabelProvider(DebugUITools.newDebugModelPresentation(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); treeViewer.setComparator(new WorkbenchViewerComparator()); treeViewer.setContentProvider(new LaunchConfigurationTreeContentProvider(fLaunchGroup.getMode(), cparent.getShell())); treeViewer.addFilter(new LaunchGroupFilter(fLaunchGroup)); treeViewer.setUseHashlookup(true); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); if(fFilters != null) { for (int i = 0; i < fFilters.length; i++) { treeViewer.addFilter(fFilters[i]); } } treeViewer.getControl().addHelpListener(new HelpListener() { @Override public void helpRequested(HelpEvent evt) { handleHelpRequest(evt); } }); return treeViewer; }
if(group != null) { if(isContextLaunchEnabled(group.getIdentifier())) { shortcuts = getShortcutsForSelection(selection, group.getMode()); if(resource == null) { resource = getLaunchableResource(shortcuts, selection);
if(group != null) { LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); String mode = group.getMode(); List<LaunchShortcutExtension> shortcuts = fLRM.getShortcutsForSelection(selection, mode);