private void removeCategory(ISiteFeature aFeature, String catName) {
   try {
     if (aFeature == null) return;
     ISiteCategory[] cats = aFeature.getCategories();
     for (int i = 0; i < cats.length; i++) {
       if (catName.equals(cats[i].getName()))
         aFeature.removeCategories(new ISiteCategory[] {cats[i]});
     }
   } catch (CoreException e) {
   }
 }
 private void addCategory(ISiteFeature aFeature, String catName) {
   try {
     if (aFeature == null) return;
     ISiteCategory[] cats = aFeature.getCategories();
     for (int j = 0; j < cats.length; j++) {
       if (cats[j].getName().equals(catName)) return;
     }
     ISiteCategory cat = fModel.getFactory().createCategory(aFeature);
     cat.setName(catName);
     expandCategory(catName);
     aFeature.addCategories(new ISiteCategory[] {cat});
   } catch (CoreException e) {
   }
 }
 private boolean handleRemoveSiteFeatureAdapter(SiteFeatureAdapter adapter) {
   try {
     ISiteFeature feature = adapter.feature;
     if (adapter.category == null) {
       fModel.getSite().removeFeatures(new ISiteFeature[] {feature});
     } else {
       removeCategory(feature, adapter.category);
       if (feature.getCategories().length == 0)
         fModel.getSite().removeFeatures(new ISiteFeature[] {feature});
     }
     return true;
   } catch (CoreException e) {
   }
   return false;
 }