protected void fillContextMenu(IMenuManager manager) {
    Action removeAction =
        new Action(PDEUIMessages.CategorySection_remove) {
          public void run() {
            doGlobalAction(ActionFactory.DELETE.getId());
          }
        };
    removeAction.setEnabled(isEditable());
    manager.add(removeAction);
    getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager);

    ISelection selection = fCategoryViewer.getSelection();
    if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
      final ISiteFeature[] features = getFeaturesFromSelection((IStructuredSelection) selection);
      if (features.length > 0) {
        manager.add(new Separator());
        Action synchronizeAction = new SynchronizePropertiesAction(features, fModel);
        manager.add(synchronizeAction);
        Action buildAction =
            new Action(PDEUIMessages.CategorySection_build) {
              public void run() {
                ((SiteEditor) getPage().getPDEEditor()).handleBuild(features);
              }
            };
        buildAction.setEnabled(isEditable());
        manager.add(buildAction);
      }
    }
  }
  /**
   * @param candidates Array of IFeatureModel
   * @param monitor
   * @throws CoreException
   */
  public void doAdd(Object[] candidates) throws CoreException {
    // Category to add features to
    String categoryName = null;
    ISelection selection = fCategoryViewer.getSelection();
    if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
      Object element = ((IStructuredSelection) selection).getFirstElement();
      if (element instanceof ISiteCategoryDefinition) {
        categoryName = ((ISiteCategoryDefinition) element).getName();
      } else if (element instanceof SiteFeatureAdapter) {
        categoryName = ((SiteFeatureAdapter) element).category;
      }
    }
    //
    ISiteFeature[] added = new ISiteFeature[candidates.length];
    for (int i = 0; i < candidates.length; i++) {
      IFeatureModel candidate = (IFeatureModel) candidates[i];
      ISiteFeature child = createSiteFeature(fModel, candidate);
      if (categoryName != null) {
        addCategory(child, categoryName);
      }
      added[i] = child;
    }

    // Update model
    fModel.getSite().addFeatures(added);
    // Select last added feature
    if (added.length > 0) {
      if (categoryName != null) {
        expandCategory(categoryName);
      }
      fCategoryViewer.setSelection(
          new StructuredSelection(new SiteFeatureAdapter(categoryName, added[added.length - 1])),
          true);
    }
  }
 private void updateRemoveButtons(boolean updateRemove, boolean updateRemoveAll) {
   TablePart tablePart = getTablePart();
   Table table = tablePart.getTableViewer().getTable();
   TableItem[] tableSelection = table.getSelection();
   if (updateRemove) {
     ISelection selection = getViewerSelection();
     tablePart.setButtonEnabled(
         3,
         isEditable()
             && !selection.isEmpty()
             && selection instanceof IStructuredSelection
             && ((IStructuredSelection) selection).getFirstElement() instanceof IProductPlugin);
   }
   int count = fPluginTable.getTable().getItemCount();
   if (updateRemoveAll) tablePart.setButtonEnabled(4, isEditable() && count > 0);
   tablePart.setButtonEnabled(2, isEditable() && count > 0);
   tablePart.setButtonEnabled(5, isEditable() && tableSelection.length == 1);
 }