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);
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#modelChanged(org.eclipse.pde.core.IModelChangedEvent)
   */
  public void modelChanged(IModelChangedEvent e) {
    // No need to call super, handling world changed event here
    if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) {
      handleModelEventWorldChanged(e);
      return;
    }
    Object[] objects = e.getChangedObjects();
    if (e.getChangeType() == IModelChangedEvent.INSERT) {
      for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof IProductPlugin) fPluginTable.add(objects[i]);
      }
    } else if (e.getChangeType() == IModelChangedEvent.REMOVE) {

      Table table = fPluginTable.getTable();
      int index = table.getSelectionIndex();

      for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof IProductPlugin) fPluginTable.remove(objects[i]);
      }

      // Update Selection

      int count = table.getItemCount();

      if (count == 0) {
        // Nothing to select
      } else if (index < count) {
        table.setSelection(index);
      } else {
        table.setSelection(count - 1);
      }

    } else if (e.getChangeType() == IModelChangedEvent.CHANGE) {
      fPluginTable.refresh();
    }
    updateRemoveButtons(false, true);
  }