/** * Process extension. * * @param extension the extension * @return the collection */ private Collection<ModelTemplateDescription> processExtension(IExtension extension) { List<ModelTemplateDescription> templates = new ArrayList<ModelTemplateDescription>(); for (IConfigurationElement configElement : extension.getConfigurationElements()) { ModelTemplateDescription template = new ModelTemplateDescription( configElement.getAttribute(ATTRIBUTE_NAME), extension.getContributor().getName(), configElement.getAttribute(ATTRIBUTE_UML_FILE), configElement.getAttribute(ATTRIBUTE_NOTATION_FILE), configElement.getAttribute(ATTRIBUTE_DI_FILE)); template.setLanguage(configElement.getAttribute(ATTRIBUTE_LANGUAGE)); templates.add(template); } return templates; }
/** * Gets the elements. * * @param inputElement the input element * @return the elements * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ public Object[] getElements(Object inputElement) { if (inputElement instanceof Object[]) { List<ModelTemplateDescription> result = new ArrayList<ModelTemplateDescription>(); for (Object next : (Object[]) inputElement) { if (next instanceof String) { String diagramCategory = (String) next; for (ModelTemplateDescription template : getTemplatesDescription()) { if (diagramCategory == null || diagramCategory.equals(template.getLanguage())) { result.add(template); } } } } return result.toArray(); } return new Object[0]; }