/** * Returns the identifier of the launch group this action is associated * with. * * @return the identifier of the launch group this action is associated * with */ protected String getLaunchGroupIdentifier() { return fLaunchGroup.getIdentifier(); } }
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());
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); } } }
/** * 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); } } } }
/** * 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; }
/** * Restore launch history */ private synchronized void loadLaunchHistories() { if (fLaunchHistories == null) { fRestoring = true; ILaunchGroup[] groups = getLaunchGroups(); fLaunchHistories = new HashMap<>(groups.length); ILaunchGroup extension = null; for (int i = 0; i < groups.length; i++) { extension = groups[i]; if (extension.isPublic()) { fLaunchHistories.put(extension.getIdentifier(), new LaunchHistory(extension)); } } restoreLaunchHistory(); fRestoring = false; } }
setLaunchConfiguration(configuration); setMode(launch.getLaunchMode()); setText(MessageFormat.format(ActionMessages.AddToFavoritesAction_1, new Object[] { DebugUIPlugin.removeAccelerators(getGroup().getLabel()) })); List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, (List<String>) null); if (groups != null) { return !groups.contains(getGroup().getIdentifier());
/** * Returns the mode of this action - run or debug * * @return the mode of this action - run or debug */ protected String getMode() { return fGroup.getMode(); }
public static String getLabel(String mode) { if (mode == null || mode.isEmpty()) { return ""; //$NON-NLS-1$ } if (modes == null) { initializeModes(); } ILaunchGroup launchGrp = modes.get(mode); return DebugUIPlugin.removeAccelerators(launchGrp.getLabel()); } }
IEvaluationContext context = createContext(); int accelerator = 1; List<LaunchShortcutExtension> allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); Iterator<LaunchShortcutExtension> iter = allShortCuts.iterator(); List<LaunchShortcutExtension> filteredShortCuts = new ArrayList<>(10);
/** * 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$ } } }
/** * 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; }
@Override protected Object getViewerInput() { return fHistory.getLaunchGroup().getMode(); }
/** * Returns a label to use for launch mode with accelerators removed. * * @return label to use for launch mode with accelerators removed */ private String getModeLabel() { return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel()); }
public Object[] getElements(Object inputElement) { ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); List possibleGroups = new ArrayList(); ILaunchConfiguration configuration = (ILaunchConfiguration) inputElement; for (int i = 0; i < groups.length; i++) { ILaunchGroup extension = groups[i]; LaunchHistory history = getLaunchConfigurationManager().getLaunchHistory( extension.getIdentifier()); if (history != null && history.accepts(configuration)) { possibleGroups.add(extension); } } return possibleGroups.toArray(); }
group = iLaunchLabelChangedListener.getLaunchGroup(); if(group != null) { if(isContextLaunchEnabled(group.getIdentifier())) { shortcuts = getShortcutsForSelection(selection, group.getMode()); if(resource == null) { resource = getLaunchableResource(shortcuts, selection); config = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getFilteredLastLaunch(group.getIdentifier()); if(config != null) { label = appendLaunched(config);
/** * 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; }
/** * 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 a label to use for launch mode with accelerators removed. * * @return label to use for launch mode with accelerators removed */ private String getModeLabel() { return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel()); }
@Override public Object[] getElements(Object inputElement) { ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); List<ILaunchGroup> possibleGroups = new ArrayList<>(); ILaunchConfiguration configuration = (ILaunchConfiguration)inputElement; for (int i = 0; i < groups.length; i++) { ILaunchGroup extension = groups[i]; LaunchHistory history = getLaunchConfigurationManager().getLaunchHistory(extension.getIdentifier()); if (history != null && history.accepts(configuration)) { possibleGroups.add(extension); } } return possibleGroups.toArray(); }