/** * 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; }
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());
/** * 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; }
IEvaluationContext context = createContext(); int accelerator = 1; List<LaunchShortcutExtension> allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); Iterator<LaunchShortcutExtension> iter = allShortCuts.iterator(); List<LaunchShortcutExtension> filteredShortCuts = new ArrayList<>(10);
return !priv && type.supportsMode(fGroup.getMode()) && equalCategories(type.getCategory(), fGroup.getCategory()) && !WorkbenchActivityHelper.filterItem(new LaunchConfigurationTypeContribution(type));