private void projectPageSelectionChanged(DialogField field) {
    List selElements = fProjectsList.getSelectedElements();
    fProjectsList.enableButton(IDX_EDIT, canEdit(selElements));
    fProjectsList.enableButton(IDX_REMOVE, canRemove(selElements));

    boolean noAttributes = containsOnlyTopLevelEntries(selElements);
    fProjectsList.enableButton(IDX_ADDPROJECT, noAttributes);
  }
  public ProjectsWorkbookPage(
      ListDialogField classPathList, IWorkbenchPreferenceContainer pageContainer) {
    fClassPathList = classPathList;
    fPageContainer = pageContainer;
    fSWTControl = null;

    String[] buttonLabels =
        new String[] {
          NewWizardMessages.ProjectsWorkbookPage_projects_add_button,
          NewWizardMessages.ProjectsWorkbookPage_projects_edit_button,
          NewWizardMessages.ProjectsWorkbookPage_projects_remove_button
        };

    ProjectsAdapter adapter = new ProjectsAdapter();

    fProjectsList = new TreeListDialogField(adapter, buttonLabels, new CPListLabelProvider());
    fProjectsList.setDialogFieldListener(adapter);
    fProjectsList.setLabelText(NewWizardMessages.ProjectsWorkbookPage_projects_label);

    fProjectsList.enableButton(IDX_REMOVE, false);
    fProjectsList.enableButton(IDX_EDIT, false);

    fProjectsList.setViewerComparator(new CPListElementSorter());
  }