private void collectWizards(IWizardCategory category, List<IWizardDescriptor> result) { result.addAll(Arrays.asList(category.getWizards())); for (IWizardCategory childCategory : category.getCategories()) { collectWizards(childCategory, result); } }
/** * 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; }
/** * Remove all primary wizards that are not in the wizard collection */ private void trimPrimaryWizards() { ArrayList<IWizardDescriptor> newPrimaryWizards = new ArrayList<IWizardDescriptor>(primaryWizards.length); if (wizardCategories == null) { return;//No categories so nothing to trim } for (IWizardDescriptor primaryWizard : primaryWizards) { if (wizardCategories.findWizard(primaryWizard.getId()) != null) { newPrimaryWizards.add(primaryWizard); } } primaryWizards = newPrimaryWizards.toArray(new WorkbenchWizardElement[newPrimaryWizards.size()]); }
IWizardCategory[] categories = wizardRegistry.getRootCategory().getCategories(); IWizardDescriptor bpmn2ModelerWizard = null; for (IWizardCategory category : categories) { if (DROOLS_WIZARD_CATEGORY_ID.equals(category.getId())) { droolsWizardCategory = category; if (JBPM_WIZARD_CATEGORY_ID.equals(category.getId())) { jbpmWizardCategory = category; for(IWizardDescriptor wizard : category.getWizards()) { if (BPMN2_MODELER_JBPM_WIZARD.equals(wizard.getId())) { bpmn2ModelerWizard = wizard; for(IWizardDescriptor wizard : category.getWizards()) { for (String id : wizardIdsToRemove) { if (id.equals(wizard.getId())) {
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); } }
if (wizardCategories.getParent() == null) { for (IWizardCategory wizardCategory : wizardCategories.getCategories()) { inputArray.add(wizardCategory);
/** * Selects the wizard category and wizard in this page that were selected * last time this page was used. If a category or wizard that was * previously selected no longer exists then it is ignored. */ protected void selectPreviouslySelected(String setting, IWizardCategory wizardCategories, final TreeViewer viewer) { String selectedId = getDialogSettings().get(setting); if (selectedId == null) { return; } if (wizardCategories == null) { return; } Object selected = wizardCategories.findCategory(new Path( selectedId)); if (selected == null) { selected = wizardCategories.findWizard(selectedId); if (selected == null) { // if we cant find either a category or a wizard, abort. return; } } viewer.setSelection(new StructuredSelection(selected), 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); } }
/** * Stores the collection of currently-expanded categories in this page's dialog store, in order to recreate this * page's state in the next instance of this page. */ protected void storeExpandedCategories() { Object[] expandedElements = filteredTree.getViewer().getExpandedElements(); List<String> expandedElementPaths = new ArrayList<String>(expandedElements.length); for (Object expandedElement : expandedElements) { if (expandedElement instanceof IWizardCategory) { expandedElementPaths.add(((IWizardCategory) expandedElement).getPath().toString()); } } settings.put(STORE_EXPANDED_CATEGORIES_ID, expandedElementPaths.toArray(new String[expandedElementPaths.size()])); }
/** * Expands the wizard categories in this page's category viewer that were expanded last time this page was used. If * a category that was previously expanded no longer exists then it is ignored. */ protected void expandPreviouslyExpandedCategories() { String[] expandedCategoryPaths = settings.getArray(STORE_EXPANDED_CATEGORIES_ID); if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) { return; } List<IWizardCategory> categoriesToExpand = new ArrayList<IWizardCategory>(expandedCategoryPaths.length); if (wizardCategories != null) { for (String expandedCategoryPath : expandedCategoryPaths) { IWizardCategory category = wizardCategories.findCategory(new Path(expandedCategoryPath)); if (category != null) { categoriesToExpand.add(category); } } } if (!categoriesToExpand.isEmpty()) { filteredTree.getViewer().setExpandedElements(categoriesToExpand.toArray()); } }
if (wizardCategories.getParent() == null) { IWizardCategory[] children = wizardCategories.getCategories(); for (IWizardCategory element : children) { inputArray.add(element);
/** * Selects the wizard category and wizard in this page that were selected last time this page was used. If a * category or wizard that was previously selected no longer exists then it is ignored. */ protected void selectPreviouslySelected() { String selectedId = settings.get(STORE_SELECTED_ID); if (selectedId == null) { return; } if (wizardCategories == null) { return; } Object selected = wizardCategories.findCategory(new Path(selectedId)); if (selected == null) { selected = wizardCategories.findWizard(selectedId); if (selected == null) { // if we cant find either a category or a wizard, abort. return; } } //work around for 62039 final StructuredSelection selection = new StructuredSelection(selected); filteredTree.getViewer().getControl().getDisplay().asyncExec(new Runnable() { public void run() { filteredTree.getViewer().setSelection(selection, true); } }); }
/** * Stores the collection of currently-expanded categories in this page's * dialog store, in order to recreate this page's state in the next * instance of this page. */ protected void storeExpandedCategories() { Object[] expandedElements = filteredTree.getViewer().getExpandedElements(); List expandedElementPaths = new ArrayList(expandedElements.length); for (Object expandedElement : expandedElements) { if (expandedElement instanceof IWizardCategory) { expandedElementPaths .add(((IWizardCategory) expandedElement) .getPath().toString()); } } settings.put(STORE_EXPANDED_CATEGORIES_ID, (String[]) expandedElementPaths .toArray(new String[expandedElementPaths.size()])); }
/** * Expands the wizard categories in this page's category viewer that were * expanded last time this page was used. If a category that was previously * expanded no longer exists then it is ignored. */ protected void expandPreviouslyExpandedCategories() { String[] expandedCategoryPaths = settings .getArray(STORE_EXPANDED_CATEGORIES_ID); if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) { return; } List categoriesToExpand = new ArrayList(expandedCategoryPaths.length); if (wizardCategories != null) { for (String expandedCategoryPath : expandedCategoryPaths) { IWizardCategory category = wizardCategories .findCategory(new Path(expandedCategoryPath)); if (category != null) { categoriesToExpand.add(category); } } } if (!categoriesToExpand.isEmpty()) { filteredTree.getViewer().setExpandedElements(categoriesToExpand.toArray()); } }
/** * @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; }
if (wizardCategories.getParent() == null) { for (IWizardCategory wizardCategory : wizardCategories.getCategories()) { inputArray.add(wizardCategory);
/** * 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; }
/** * Selects the wizard category and wizard in this page that were selected * last time this page was used. If a category or wizard that was * previously selected no longer exists then it is ignored. */ protected void selectPreviouslySelected() { String selectedId = settings.get(STORE_SELECTED_ID); if (selectedId == null) { return; } if (wizardCategories == null) { return; } Object selected = wizardCategories.findCategory(new Path( selectedId)); if (selected == null) { selected = wizardCategories.findWizard(selectedId); if (selected == null) { // if we cant find either a category or a wizard, abort. return; } } //work around for 62039 final StructuredSelection selection = new StructuredSelection(selected); filteredTree.getViewer().getControl().getDisplay().asyncExec(() -> filteredTree.getViewer().setSelection(selection, true)); }
/** * Stores the collection of currently-expanded categories in this page's * dialog store, in order to recreate this page's state in the next * instance of this page. */ protected void storeExpandedCategories(String setting, TreeViewer viewer) { Object[] expandedElements = viewer.getExpandedElements(); List expandedElementPaths = new ArrayList(expandedElements.length); for (Object expandedElement : expandedElements) { if (expandedElement instanceof IWizardCategory) { expandedElementPaths .add(((IWizardCategory) expandedElement) .getPath().toString()); } } getDialogSettings().put(setting, (String[]) expandedElementPaths .toArray(new String[expandedElementPaths.size()])); }
/** * Expands the wizard categories in this page's category viewer that were * expanded last time this page was used. If a category that was previously * expanded no longer exists then it is ignored. */ protected void expandPreviouslyExpandedCategories(String setting, IWizardCategory wizardCategories, TreeViewer viewer) { String[] expandedCategoryPaths = getDialogSettings() .getArray(setting); if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) { return; } List categoriesToExpand = new ArrayList(expandedCategoryPaths.length); if (wizardCategories != null) { for (String expandedCategoryPath : expandedCategoryPaths) { IWizardCategory category = wizardCategories .findCategory(new Path(expandedCategoryPath)); if (category != null) { categoriesToExpand.add(category); } } } if (!categoriesToExpand.isEmpty()) { viewer.setExpandedElements(categoriesToExpand.toArray()); } }