/** * Remove the wizard category 'General'. */ private void removeDefaultNewWizards() { // based on: // http://stackoverflow.com/questions/11307367/how-to-remove-default-wizards-from-file-new-menu-in-rcp-application // http://www.eclipse.org/forums/index.php/t/261462 AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry) PlatformUI.getWorkbench().getNewWizardRegistry(); IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories(); for (IWizardDescriptor wizard : getAllWizards(categories)) { if(wizard.getCategory().getId().matches("org.eclipse.ui.Basic")) { WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard; wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[] { wizardElement }); } } }
private void ensureGroupExists(ProjectTemplate template) { if (template.getGroup() == null) { return; } IWizardCategory category = wizardRegistry.findCategory(template.getGroup()); if (category == null) { String id = "project.template." + template.getGroup(); String label = template.getGroup(); ConfigurationElementDescription description = createGroupDescription(template); addExtension(id, label, description); } }
static private IWizardDescriptor[] getAllWizards(final IWizardCategory[] categories) { final List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>(); for (final IWizardCategory wizardCategory : categories) { results.addAll(Arrays.asList(wizardCategory.getWizards())); results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories()))); } return results.toArray(new IWizardDescriptor[0]); }
private static void addNewWizards(IPageLayout layout) { Collection<String> cooperateWizardIds = Optional .ofNullable(PlatformUI.getWorkbench().getNewWizardRegistry().findCategory(WIZARD_CATEGORY_ID)) .map(IWizardCategory::getWizards).map(Arrays::asList).map(Collection::stream) .map(s -> s.map(IWizardDescriptor::getId).collect(Collectors.toList())).orElse(Collections.emptyList()); cooperateWizardIds.forEach(layout::addNewWizardShortcut); }
private IWizardDescriptor[] getAllWizards(IWizardCategory... categories) { List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>(); for (IWizardCategory wizardCategory : categories) { results.addAll(Arrays.asList(wizardCategory.getWizards())); results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories()))); } return results.toArray(new IWizardDescriptor[0]); }
/** * Return whether or not any examples are in the current install. * * @return True if there exists a full examples wizard category. */ private boolean hasExamples() { IWizardRegistry newRegistry = PlatformUI.getWorkbench().getNewWizardRegistry(); IWizardCategory category = newRegistry.findCategory(FULL_EXAMPLES_WIZARD_CATEGORY); return category != null; }
private static IWizardDescriptor[] getAllWizards(IWizardCategory[] categories) { List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>(); for(IWizardCategory wizardCategory : categories){ results.addAll(Arrays.asList(wizardCategory.getWizards())); results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories()))); } return results.toArray(new IWizardDescriptor[0]); }
private List<IWizardDescriptor> getAllWizards(IWizardCategory[] categories) { List<IWizardDescriptor> results = new ArrayList<>(); for (IWizardCategory wizardCategory : categories) { results.addAll(Arrays.asList(wizardCategory.getWizards())); results.addAll(getAllWizards(wizardCategory.getCategories())); } return results; }
private static void removeWizards () { AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry)PlatformUI.getWorkbench().getNewWizardRegistry(); IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories(); for(IWizardDescriptor wizard : getAllWizards(categories)){ //System.out.println("ID: " + wizard.getId()); //System.out.println(" Label: " + wizard.getLabel()); //System.out.println(" Category label: " + wizard.getCategory().getLabel()); //System.out.println(" Category ID: " + wizard.getCategory().getId()); if( !wizard.getCategory().getId().equals("org.eclipse.ui.Basic") && !wizard.getCategory().getId().equals("org.eclipse.ui.Examples") && !wizard.getCategory().getId().startsWith("org.scaledl") && !wizard.getId().startsWith("org.scaledl") && !wizard.getCategory().getId().startsWith("de.uka") && !wizard.getCategory().getId().startsWith("org.palladiosimulator") && !wizard.getId().startsWith("de.uka") && !wizard.getId().startsWith("org.palladiosimulator") && !wizard.getCategory().getId().startsWith("org.reclipse") && !wizard.getId().startsWith("org.reclipse") && !wizard.getCategory().getId().startsWith("org.spotter") && !wizard.getId().startsWith("org.spotter") && !wizard.getCategory().getId().toLowerCase().contains("cloudscale") && !wizard.getId().toLowerCase().contains("cloudscale") && !wizard.getCategory().getId().contains("dlim") /* !wizard.getLabel().contains("ServicelevelObjective Model") && !wizard.getLabel().contains("Pms Model") && !wizard.getLabel().contains("Experiments Model") && !wizard.getLabel().contains("Measuringpoint Model") && !wizard.getLabel().contains("Resourceenvironment Model") && !wizard.getLabel().contains("Seff Model") && !wizard.getLabel().contains("Repository Model") && !wizard.getLabel().contains("Usage Model") && !wizard.getLabel().contains("Variation Model") && !wizard.getLabel().contains("Allocation Model") && */ ) { // TODO: removed for now when new stuff are integrated on daily bases -- fix-it WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard; wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[]{wizardElement}); } } }