protected IAction getAction(String id) { if (id == null || id.length() == 0) { return null; } // Keep a cache, rather than creating a new action each time, // so that image caching in ActionContributionItem works. IAction action = (IAction) getActions().get(id); if (action == null) { IWizardDescriptor descriptor = wizardRegistry.findWizard(id); if (descriptor != null) { action = new WizardShortcutAction(window, descriptor); getActions().put(id, action); } } return action; }
/** * 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; }
/** * Create the wizard pages */ @Override public void addPages() { IWizardCategory root = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory(); IWizardDescriptor [] primary = WorkbenchPlugin.getDefault().getNewWizardRegistry().getPrimaryWizards(); if (categoryId != null) { IWizardCategory categories = root; StringTokenizer familyTokenizer = new StringTokenizer(categoryId, CATEGORY_SEPARATOR); while (familyTokenizer.hasMoreElements()) { categories = getChildWithID(categories, familyTokenizer .nextToken()); if (categories == null) { break; } } if (categories != null) { root = categories; } } mainPage = new NewWizardSelectionPage(workbench, selection, root, primary, projectsOnly); addPage(mainPage); }
@Override public Map getParameterValues() { final Map values = new HashMap(); final IWizardRegistry wizardRegistry = getWizardRegistry(); addParameterValues(values, wizardRegistry.getRootCategory()); return values; }
@Override public QuickAccessElement[] getElements() { if (cachedElements == null) { IWizardCategory rootCategory = WorkbenchPlugin.getDefault() .getNewWizardRegistry().getRootCategory(); List<IWizardDescriptor> result = new ArrayList<>(); collectWizards(rootCategory, result); IWizardDescriptor[] wizards = result .toArray(new IWizardDescriptor[result.size()]); for (int i = 0; i < wizards.length; i++) { if (!WorkbenchActivityHelper.filterItem(wizards[i])) { WizardElement wizardElement = new WizardElement(wizards[i], this); idToElement.put(wizardElement.getId(), wizardElement); } } cachedElements = idToElement.values().toArray( new QuickAccessElement[idToElement.size()]); } return cachedElements; }
public static IWizard createWizard(String id) { // First see if this is a "new wizard". IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(id); // If not check if it is an "import wizard". if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(id); } // Or maybe an export wizard if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(id); } try { // Then if we have a wizard, open it. if (descriptor != null) { IWizard wizard = descriptor.createWizard(); return wizard; } } catch (CoreException e) { e.printStackTrace(); } return null; }
/** * Returns whether the new wizards registry has a non-empty category with * the given identifier. * * @param categoryId * the identifier for the category * @return <code>true</code> if there is a non-empty category with the * given identifier, <code>false</code> otherwise */ protected boolean registryHasCategory(String categoryId) { return WorkbenchPlugin.getDefault().getNewWizardRegistry() .findCategory(categoryId) != null; }
/** * Returns the import wizards that are available for invocation. */ protected AdaptableList getAvailableImportWizards() { // TODO: imports are still flat - we need to get at the flat list. All // wizards will be in the "other" category. IWizardCategory root = WorkbenchPlugin.getDefault() .getImportWizardRegistry().getRootCategory(); WizardCollectionElement otherCategory = (WizardCollectionElement) root .findCategory(new Path( WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY)); if (otherCategory == null) { return new AdaptableList(); } return otherCategory.getWizardAdaptableList(); }
@Override public void updateElement(UIElement element, Map parameters) { String wizardId = (String) parameters.get(getWizardIdParameterId()); if (wizardId == null) return; IWizardDescriptor wizard = getWizardRegistry().findWizard(wizardId); if (wizard != null) { element.setText(NLS.bind(WorkbenchMessages.WizardHandler_menuLabel, wizard.getLabel())); element.setTooltip(wizard.getDescription()); element.setIcon(wizard.getImageDescriptor()); } }
/** * Return whether or not any examples are in the current install. * * @return boolean */ private boolean hasExamples() { boolean hasCategory = registryHasCategory(WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY); if (hasCategory) { IWizardCategory exampleCategory = WorkbenchPlugin .getDefault() .getNewWizardRegistry() .findCategory( WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY); return hasWizards(exampleCategory); } return false; }
/** * Returns the export wizards that are available for invocation. */ protected AdaptableList getAvailableExportWizards() { // TODO: exports are still flat - we need to get at the flat list. All // wizards will be in the "other" category. IWizardCategory root = WorkbenchPlugin.getDefault() .getExportWizardRegistry().getRootCategory(); WizardCollectionElement otherCategory = (WizardCollectionElement) root .findCategory(new Path( WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY)); if (otherCategory == null) { return new AdaptableList(); } return otherCategory.getWizardAdaptableList(); }
private IAction getAction(String id) { // Keep a cache, rather than creating a new action each time, // so that image caching in ActionContributionItem works. IAction action = (IAction) actions.get(id); if (action == null) { IWizardDescriptor wizardDesc = WorkbenchPlugin.getDefault() .getNewWizardRegistry().findWizard(id); if (wizardDesc != null) { action = new NewWizardShortcutAction(workbenchWindow, wizardDesc); actions.put(id, action); IConfigurationElement element = Adapters.adapt(wizardDesc, IConfigurationElement.class); if (element != null) { workbenchWindow.getExtensionTracker().registerObject( element.getDeclaringExtension(), action, IExtensionTracker.REF_WEAK); } } } return action; }
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); } }
public void openWizard(Shell shell, IWorkbench workbench, IStructuredSelection selection, String id) { // First see if this is a "new wizard". IWizardDescriptor descriptor = PlatformUI.getWorkbench() .getNewWizardRegistry().findWizard(id); // If not check if it is an "import wizard". if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry() .findWizard(id); } // Or maybe an export wizard if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry() .findWizard(id); } try { // Then if we have a wizard, open it. if (descriptor != null) { IWizard wizard = descriptor.createWizard(); ((IWorkbenchWizard) wizard).init(workbench, selection); WizardDialog wd = new WizardDialog(shell, wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } } }
@Override protected void restoreWidgetValues(){ IWizardCategory importRoot = WorkbenchPlugin.getDefault().getImportWizardRegistry().getRootCategory(); expandPreviouslyExpandedCategories(STORE_EXPANDED_IMPORT_CATEGORIES, importRoot,importTree.getViewer()); selectPreviouslySelected(STORE_SELECTED_IMPORT_WIZARD_ID, importRoot, importTree.getViewer()); super.restoreWidgetValues(); }
private IWizard createChildWizard(String id, String parentWizModelName) { NewProjectDataModelFacetWizard wizard = null; IWizardRegistry newWizardRegistry = WorkbenchPlugin.getDefault().getNewWizardRegistry(); IWizardDescriptor wizardDescriptor = newWizardRegistry.findWizard(id); try { // retrieve the model of the parent wizard IDataModel parentWizModel = getDataModel().getNestedModel(parentWizModelName); // create the child wizard and retrieve its model wizard = (NewProjectDataModelFacetWizard) wizardDescriptor.createWizard(); IDataModel childWizModel = wizard.getDataModel(); // copy the properties of the parent wizard's model to the child wizard's model Iterator props = parentWizModel.getBaseProperties().iterator(); while (props.hasNext()) { String prop = (String) props.next(); childWizModel.setProperty(prop, parentWizModel.getProperty(prop)); } int a = 1; } catch (CoreException ce) { Logger.getLogger().log(ce); } return wizard; }
@Override protected void restoreWidgetValues(){ IWizardCategory exportRoot = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory(); expandPreviouslyExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportRoot, exportTree.getViewer()); selectPreviouslySelected(STORE_SELECTED_EXPORT_WIZARD_ID, exportRoot, exportTree.getViewer()); super.restoreWidgetValues(); }
.findWizard(wizardId); if (wizardDescriptor == null) { throw new ExecutionException("unknown wizard: " + wizardId); //$NON-NLS-1$
@Override protected Composite createTreeViewer(Composite parent) { IWizardCategory root = WorkbenchPlugin.getDefault() .getImportWizardRegistry().getRootCategory(); importTree = new CategorizedWizardSelectionTree( root, WorkbenchMessages.ImportWizard_selectWizard); Composite importComp = importTree.createControl(parent); importTree.getViewer().addSelectionChangedListener(event -> listSelectionChanged(event.getSelection())); importTree.getViewer().addDoubleClickListener(event -> treeDoubleClicked(event)); setTreeViewer(importTree.getViewer()); return importComp; }
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(customWizard); if (descriptor != null) { try {