/** * Returns the child collection element for the given id */ private IWizardCategory getChildWithID(IWizardCategory parent, String id) { IWizardCategory[] children = parent.getCategories(); for (IWizardCategory currentChild : children) { if (currentChild.getId().equals(id)) { return currentChild; } } return null; }
/** * Returns the child collection element for the given id */ private IWizardCategory getChildWithID( IWizardCategory parent, String id) { for (IWizardCategory wizardCategory : parent.getCategories()) { if (wizardCategory.getId().equals(id)) { return wizardCategory; } } return null; }
private void collectWizards(IWizardCategory category, List<IWizardDescriptor> result) { result.addAll(Arrays.asList(category.getWizards())); for (IWizardCategory childCategory : category.getCategories()) { collectWizards(childCategory, result); } }
private void addParameterValues(Map values, IWizardCategory wizardCategory) { for (final IWizardDescriptor wizardDescriptor : wizardCategory.getWizards()) { // Note: using description instead of label for the name // to reduce possibilities of key collision in the map // final String name = wizardDescriptor.getDescription(); // by request String name = wizardDescriptor.getLabel(); final String id = wizardDescriptor.getId(); final String value = (String) values.get(name); if (value!=null && !value.equals(id)) { name = name + " (" + id + ")"; //$NON-NLS-1$//$NON-NLS-2$ } values.put(name, id); } for (final IWizardCategory childCategory : wizardCategory.getCategories()) { addParameterValues(values, childCategory); } }
/** * @param category the wizard category * @return whether all of the wizards in the category are enabled via activity filtering */ private boolean allActivityEnabled(IWizardCategory category) { for (IWizardDescriptor wizard : category.getWizards()) { if (WorkbenchActivityHelper.filterItem(wizard)) { return false; } } for (IWizardCategory wizard : category.getCategories()) { if (!allActivityEnabled(wizard)) { return false; } } return true; }
/** * @param category the wizard category * @return whether all wizards in the category are considered primary */ private boolean allPrimary(IWizardCategory category) { for (IWizardDescriptor wizard : category.getWizards()) { if (!isPrimary(wizard)) { return false; } } for (IWizardCategory wizard : category.getCategories()) { if (!allPrimary(wizard)) { return false; } } return true; }
private boolean hasWizards(IWizardCategory category) { IWizardDescriptor[] wizards = category.getWizards(); if (wizards.length>0) { for (int i = 0; i < wizards.length; i++) { if (!WorkbenchActivityHelper.filterItem(wizards[i])) { return true; } } } IWizardCategory[] categories = category.getCategories(); for (int i = 0; i < categories.length; i++) { if (hasWizards(categories[i])) { return true; } } return false; }
/** * @param category * the wizard category * @return whether all of the wizards in the category are enabled via activity filtering */ private boolean allActivityEnabled(IWizardCategory category) { IWizardDescriptor[] wizards = category.getWizards(); for (IWizardDescriptor wizard : wizards) { if (WorkbenchActivityHelper.filterItem(wizard)) { return false; } } IWizardCategory[] children = category.getCategories(); for (int i = 0; i < children.length; i++) { if (!allActivityEnabled(children[i])) { return false; } } return true; }
/** * @param category * the wizard category * @return whether all wizards in the category are considered primary */ private boolean allPrimary(IWizardCategory category) { IWizardDescriptor[] wizards = category.getWizards(); for (IWizardDescriptor wizard2 : wizards) { IWizardDescriptor wizard = wizard2; if (!isPrimary(wizard)) { return false; } } IWizardCategory[] children = category.getCategories(); for (int i = 0; i < children.length; i++) { if (!allPrimary(children[i])) { return false; } } return true; }
private void initializeNewWizardsMenu(DisplayItem menu) { Category rootForNewWizards = new Category( WorkbenchMessages.ActionSetDialogInput_wizardCategory); shortcuts.addChild(rootForNewWizards); IWizardCategory wizardCollection = WorkbenchPlugin.getDefault() .getNewWizardRegistry().getRootCategory(); IWizardCategory[] wizardCategories = wizardCollection.getCategories(); List<String> activeIDs = Arrays.asList(perspective.getNewWizardShortcuts()); for (IWizardCategory element : wizardCategories) { if (WorkbenchActivityHelper.filterItem(element)) { continue; } initializeNewWizardsMenu(menu, rootForNewWizards, element, activeIDs); } }
IWizardCategory[] categories = wizardRegistry.getRootCategory().getCategories();
IWizardCategory[] children = wizardCategories.getCategories(); for (IWizardCategory element : children) { inputArray.add(element);
for (IWizardCategory wizardCategory : wizardCategories.getCategories()) { inputArray.add(wizardCategory);
for (IWizardCategory wizardCategory : wizardCategories.getCategories()) { inputArray.add(wizardCategory);
private void initializeNewWizardsMenu(DisplayItem menu, Category parentCategory, IWizardCategory element, List<String> activeIds) { Category category = new Category(element.getLabel()); parentCategory.addChild(category); Object[] wizards = element.getWizards(); for (Object wizard2 : wizards) { WorkbenchWizardElement wizard = (WorkbenchWizardElement) wizard2; ShortcutItem item = new ShortcutItem(wizard.getLabel(), wizard); item.setLabel(wizard.getLabel()); item.setDescription(wizard.getDescription()); if (wizard.getImageDescriptor() != null) { item.setImageDescriptor(wizard.getImageDescriptor()); } item.setCheckState(activeIds.contains(wizard.getId())); menu.addChild(item); category.addShortcutItem(item); } // @issue should not pass in null for (IWizardCategory child : element.getCategories()) { initializeNewWizardsMenu(menu, category, child, activeIds); } }