1 11 package org.eclipse.update.core; 12 13 import java.util.ArrayList ; 14 import java.util.Arrays ; 15 import java.util.List ; 16 17 33 public class SiteFeatureReferenceModel extends FeatureReference { 34 35 private List 36 categoryNames; 37 38 39 44 public SiteFeatureReferenceModel() { 45 super(); 46 } 47 48 52 public SiteFeatureReferenceModel(ISiteFeatureReference ref) { 53 super(ref); 54 if (ref instanceof SiteFeatureReferenceModel) { 55 SiteFeatureReferenceModel refModel = (SiteFeatureReferenceModel) ref; 56 setCategoryNames(refModel.getCategoryNames()); 57 } 58 } 59 60 61 67 public String [] getCategoryNames() { 68 if (categoryNames == null) 69 return new String [0]; 70 71 return (String []) categoryNames.toArray(new String [0]); 72 } 73 74 81 public void setCategoryNames(String [] categoryNames) { 82 assertIsWriteable(); 83 if (categoryNames == null) 84 this.categoryNames = null; 85 else 86 this.categoryNames = new ArrayList (Arrays.asList(categoryNames)); 87 } 88 89 96 public void addCategoryName(String categoryName) { 97 assertIsWriteable(); 98 if (this.categoryNames == null) 99 this.categoryNames = new ArrayList (); 100 if (!this.categoryNames.contains(categoryName)) 101 this.categoryNames.add(categoryName); 102 } 103 104 111 public void removeCategoryName(String categoryName) { 112 assertIsWriteable(); 113 if (this.categoryNames != null) 114 this.categoryNames.remove(categoryName); 115 } 116 } 117 | Popular Tags |