private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
 private void handleRemove() {
   IStructuredSelection ssel = (IStructuredSelection) fImportListViewer.getSelection();
   if (ssel.size() > 0) {
     Table table = fImportListViewer.getTable();
     int index = table.getSelectionIndices()[0];
     doRemove(ssel.toList());
     table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
     pageChanged(false, true);
   }
 }
 private void handleAdd() {
   IStructuredSelection ssel = (IStructuredSelection) fAvailableListViewer.getSelection();
   if (ssel.size() > 0) {
     Table table = fAvailableListViewer.getTable();
     int index = table.getSelectionIndices()[0];
     doAdd(ssel.toList());
     table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
     pageChanged(true, false);
   }
 }
 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);
  }