private static void gatherViewDependencies(IExtension extension, List<String> needs, List<String> provides) { IConfigurationElement[] elements = extension.getConfigurationElements(); for (IConfigurationElement element : elements) { IConfigurationElement[] children = element.getChildren(); for (IConfigurationElement child : children) { String type = child.getName(); if (IWorkbenchRegistryConstants.TAG_VIEW.equals(type)) { String id = child.getAttribute(IWorkbenchRegistryConstants.ATT_ID); String relative = child.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIVE); provides.add(id); if (relative != null) { needs.add(relative); } } } } }
private boolean readElement(final IConfigurationElement inElement) { if (inElement.getName() .equals(IWorkbenchRegistryConstants.TAG_CATEGORY)) { deferCategory(inElement); return true; } else if (inElement.getName() .equals(IWorkbenchRegistryConstants.TAG_PRIMARYWIZARD)) { if (deferPrimary == null) { deferPrimary = new HashSet<String>(); } deferPrimary.add( inElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID)); return true; } else { if (!inElement.getName() .equals(IWorkbenchRegistryConstants.TAG_WIZARD)) { return false; } final WorkbenchWizardElement lWizard = createWizardElement( inElement); if (lWizard != null) { addNewElementToResult(lWizard, inElement); } return true; } }
private WorkbenchWizardElement createWizardElement( final IConfigurationElement inElement) { // WizardElements must have a name attribute if (inElement .getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) { logMissingAttribute(inElement, IWorkbenchRegistryConstants.ATT_NAME); return null; } if (getClassValue(inElement, IWorkbenchRegistryConstants.ATT_CLASS) == null) { logMissingAttribute(inElement, IWorkbenchRegistryConstants.ATT_CLASS); return null; } return new WorkbenchWizardElement(inElement, context); }
private String getClassValue(final IConfigurationElement inConfigElement, final String inClassAttributeName) { final String outClassName = inConfigElement .getAttribute(inClassAttributeName); if (outClassName != null) { return outClassName; } final IConfigurationElement[] lCandidateChildren = inConfigElement .getChildren(inClassAttributeName); if (lCandidateChildren.length == 0) { return null; } return lCandidateChildren[0] .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS); }
private ConfigurationElementDescription createTemplateDescription(ProjectTemplate template) { List<ConfigurationElementAttribute> atts = new ArrayList<ConfigurationElementAttribute>(); atts.add(new ConfigurationElementAttribute("class", ProjectTemplateWizard.class.getName())); atts.add(new ConfigurationElementAttribute("id", template.getId())); atts.add(new ConfigurationElementAttribute("name", template.getName())); atts.add(new ConfigurationElementAttribute("icon", template.getSmallIcon().getId())); atts.add(new ConfigurationElementAttribute("project", "true")); if (template.getGroup() != null) { atts.add(new ConfigurationElementAttribute("category", template.getGroup())); } ConfigurationElementAttribute[] attsArray = atts.toArray(new ConfigurationElementAttribute[atts.size()]); return new ConfigurationElementDescription(IWorkbenchRegistryConstants.TAG_WIZARD, attsArray, null, null); }
@Override public IPerspectiveFactory createFactory() { try { return (IPerspectiveFactory) getSimulationDescriptor().getConfigElement() .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS); } catch (final CoreException e) { e.printStackTrace(); throw new RuntimeException(e); } }
/** * Answer the icon of this element. */ @Override public ImageDescriptor getImageDescriptor() { if (imageDescriptor == null) { final String iconName = configuration .getAttribute(IWorkbenchRegistryConstants.ATT_ICON); if (iconName == null) { return null; } imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( configuration.getNamespaceIdentifier(), iconName); } return imageDescriptor; }
@Override public ImageDescriptor getDescriptionImage() { if (descriptionImage == null) { final String descImage = configuration.getAttribute( IWorkbenchRegistryConstants.ATT_DESCRIPTION_IMAGE); if (descImage == null) { return null; } descriptionImage = AbstractUIPlugin.imageDescriptorFromPlugin( configuration.getNamespaceIdentifier(), descImage); } return descriptionImage; }
@Override public boolean canFinishEarly() { return Boolean .valueOf(configuration.getAttribute( IWorkbenchRegistryConstants.ATT_CAN_FINISH_EARLY)) .booleanValue(); }
@Override public boolean hasPages() { final String hasPagesString = configuration .getAttribute(IWorkbenchRegistryConstants.ATT_HAS_PAGES); // default value is true if (hasPagesString == null) { return true; } return Boolean.valueOf(hasPagesString).booleanValue(); }
public void consolidateCategory(final WizardCollectionElement inWizards) { final WizardCollectionElement lCategory = inWizards .findCategory(configuration.getAttribute( IWorkbenchRegistryConstants.ATT_CATEGORY)); lCategory.add(this); setParent(lCategory); }
private String getCategoryStringFor(final IConfigurationElement inConfig) { String outResult = inConfig .getAttribute(IWorkbenchRegistryConstants.TAG_CATEGORY); if (outResult == null) { outResult = UNCATEGORIZED_WIZARD_CATEGORY; } return outResult; }
private void tabSelected(CTabItem item) { if (item.getData() instanceof IConfigurationElement) { final IConfigurationElement element = (IConfigurationElement) item .getData(); Composite pageComposite = (Composite) item.getControl(); try { final InstallationPage page = (InstallationPage) element .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS); page.createControl(pageComposite); // new controls created since the dialog font was applied, so // apply again. Dialog.applyDialogFont(pageComposite); page.setPageContainer(this); // Must be done before creating the buttons because the control // button creation methods // use this map. pageToId.put(page, element .getAttribute(IWorkbenchRegistryConstants.ATT_ID)); createButtons(page); item.setData(page); item.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { page.dispose(); } }); pageComposite.layout(true, true); } catch (CoreException e1) { Label label = new Label(pageComposite, SWT.NONE); label.setText(e1.getMessage()); item.setData(null); } } String id = (String) item.getData(ID); rememberSelectedTab(id); buttonManager.update(id); Button button = createButton(buttonManager.getParent(), IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); GridData gd = (GridData) button.getLayoutData(); gd.horizontalAlignment = SWT.BEGINNING; gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) / 2; // Layout the button bar's parent and all of its children. We must // cascade through all children because the buttons have changed and // because tray dialog inserts an extra composite in the button bar // hierarchy. getButtonBar().getParent().layout(true, true); }
private ConfigurationElementDescription createGroupDescription(ProjectTemplate template) { ConfigurationElementAttribute[] atts = new ConfigurationElementAttribute[2]; atts[0] = new ConfigurationElementAttribute("id", template.getGroup()); atts[1] = new ConfigurationElementAttribute("name", template.getGroup()); return new ConfigurationElementDescription(IWorkbenchRegistryConstants.TAG_CATEGORY, atts, null, null); }
@Override public String getLabel(final Object inObject) { return configElement == null ? name : configElement .getAttribute(IWorkbenchRegistryConstants.ATT_NAME); }
@Override public String getLabel(final Object inObject) { return getAttributeChecked(IWorkbenchRegistryConstants.ATT_NAME); }
@Override public String getHelpHref() { return configuration .getAttribute(IWorkbenchRegistryConstants.ATT_HELP_HREF); }
/** * WizardCollectionElement constructor. * * @param inElement * {@link IConfigurationElement} * @param inParent * {@link WizardCollectionElement} the parent, may be * <code>null</code> */ public WizardCollectionElement(final IConfigurationElement inElement, final WizardCollectionElement inParent) { configElement = inElement; id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID); parent = inParent; }
/** * WorkbenchWizardElement constructor. * * @param inConfiguration * {@link IConfigurationElement} * @param inContext * {@link IEclipseContext} */ public WorkbenchWizardElement(final IConfigurationElement inConfiguration, final IEclipseContext inContext) { configuration = inConfiguration; context = inContext; id = configuration.getAttribute(IWorkbenchRegistryConstants.ATT_ID); }
/** * Create an the instance of the object described by the configuration * element. That is, create the instance of the class the isv supplied in * the extension point. * * @return Object the new object * @throws CoreException */ public Object createExecutableExtension() throws CoreException { return createExtension(configuration, IWorkbenchRegistryConstants.ATT_CLASS); }