private boolean alreadyExists(String name) {
   ISiteCategoryDefinition[] defs =
       fCurrentCategoryDefinition.getModel().getSite().getCategoryDefinitions();
   for (int i = 0; i < defs.length; i++) {
     ISiteCategoryDefinition def = defs[i];
     if (def == fCurrentCategoryDefinition) continue;
     String dname = def.getName();
     if (dname != null && dname.equals(name)) return true;
   }
   return false;
 }
 private void bringFeatures(String oldCategory) {
   ISiteFeature[] siteFeatures = fCurrentCategoryDefinition.getModel().getSite().getFeatures();
   for (int i = 0; i < siteFeatures.length; i++) {
     ISiteCategory[] categories = siteFeatures[i].getCategories();
     for (int c = 0; c < categories.length; c++) {
       if (oldCategory.equals(categories[c].getName())) {
         try {
           categories[c].setName(fCurrentCategoryDefinition.getName());
         } catch (CoreException ce) {
         }
       }
     }
   }
 }
 private void applyValue(String property, String value) throws CoreException {
   if (fCurrentCategoryDefinition == null) return;
   if (property.equals(PROPERTY_NAME)) {
     String oldName = fCurrentCategoryDefinition.getName();
     fCurrentCategoryDefinition.setName(value);
     bringFeatures(oldName);
   } else if (property.equals(PROPERTY_TYPE)) fCurrentCategoryDefinition.setLabel(value);
   else if (property.equals(PROPERTY_DESC)) {
     if (value == null || value.length() == 0) {
       fCurrentCategoryDefinition.setDescription(null);
     } else {
       ISiteDescription siteDesc = fCurrentCategoryDefinition.getDescription();
       if (siteDesc == null) {
         siteDesc =
             fCurrentCategoryDefinition
                 .getModel()
                 .getFactory()
                 .createDescription(fCurrentCategoryDefinition);
         siteDesc.setText(value);
         fCurrentCategoryDefinition.setDescription(siteDesc);
       } else {
         siteDesc.setText(value);
       }
     }
   }
 }
 private void setValue(String property) {
   if (fCurrentCategoryDefinition == null) {
     clearField(property);
   } else {
     if (property.equals(PROPERTY_NAME))
       fNameText.setValue(fCurrentCategoryDefinition.getName(), true);
     else if (property.equals(PROPERTY_TYPE))
       fLabelText.setValue(fCurrentCategoryDefinition.getLabel(), true);
     else if (property.equals(PROPERTY_DESC)) {
       ISiteDescription siteDesc = fCurrentCategoryDefinition.getDescription();
       if (siteDesc == null) {
         clearField(property);
       } else {
         fDescriptionText.setValue(siteDesc.getText(), true);
       }
     }
   }
 }