1 11 package org.eclipse.update.internal.ui.model; 12 13 import java.net.*; 14 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.update.core.*; 17 18 22 public class SimpleFeatureAdapter extends FeatureAdapter { 23 protected IFeature feature; 24 private boolean optional; 25 public SimpleFeatureAdapter(IFeature feature) { 26 this(feature, false); 27 } 28 public SimpleFeatureAdapter(IFeature feature, boolean optional) { 29 this.feature = feature; 30 this.optional = optional; 31 } 32 33 public IFeature getFeature(IProgressMonitor monitor) throws CoreException { 34 return feature; 35 } 36 37 public String getFastLabel() { 38 return feature.getLabel(); 39 } 40 41 public URL getURL() { 42 return feature.getURL(); 43 } 44 45 public ISite getSite() { 46 return feature.getSite(); 47 } 48 49 public IFeatureAdapter[] getIncludedFeatures(IProgressMonitor monitor) { 50 try { 51 IIncludedFeatureReference[] included = getFeature(monitor).getIncludedFeatureReferences(); 52 SimpleFeatureAdapter[] result = 53 new SimpleFeatureAdapter[included.length]; 54 for (int i = 0; i < included.length; i++) { 55 result[i] = 56 new SimpleFeatureAdapter(included[i].getFeature(null), included[i].isOptional()); 57 result[i].setIncluded(true); 58 } 59 return result; 60 } catch (CoreException e) { 61 return new IFeatureAdapter[0]; 62 } 63 } 64 public boolean isOptional() { 65 return optional; 66 } 67 } 68 | Popular Tags |