public Object[] getElements(Object inputElement) { // model = (ISite) inputElement; ArrayList<IWritable> result = new ArrayList<IWritable>(); ISiteCategoryDefinition[] catDefs = fModel.getSite().getCategoryDefinitions(); for (int i = 0; i < catDefs.length; i++) { result.add(catDefs[i]); } ISiteFeature[] features = fModel.getSite().getFeatures(); for (int i = 0; i < features.length; i++) { if (features[i].getCategories().length == 0) result.add(new SiteFeatureAdapter(null, features[i])); } return result.toArray(); }
private ISiteFeature[] getFeaturesFromSelection(IStructuredSelection sel) { if (sel.isEmpty()) return new ISiteFeature[0]; if (cachedSelection == sel) return cachedFeatures; cachedSelection = sel; ArrayList<ISiteFeature> features = new ArrayList<ISiteFeature>(sel.size()); Iterator<?> iterator = sel.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof SiteFeatureAdapter) { if ((((SiteFeatureAdapter) next).feature) != null) { features.add(((SiteFeatureAdapter) next).feature); } } } cachedFeatures = features.toArray(new ISiteFeature[features.size()]); return cachedFeatures; }