/*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
   * .Composite)
   */
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    createMessageArea(composite);
    CheckboxTreeViewer treeViewer = createTreeViewer(composite);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(60);
    data.heightHint = convertHeightInCharsToPixels(18);

    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(composite.getFont());

    Button button = new Button(composite, SWT.PUSH);
    button.setText(NewWizardMessages.MultipleFolderSelectionDialog_button);
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            newFolderButtonPressed();
          }
        });
    button.setFont(composite.getFont());

    fNewFolderButton = button;

    treeViewer.addSelectionChangedListener(this);
    if (fExisting != null) {
      Object[] existing = fExisting.toArray();
      treeViewer.setGrayedElements(existing);
      setInitialSelections(existing);
    }
    if (fFocusElement != null) {
      treeViewer.setSelection(new StructuredSelection(fFocusElement), true);
    }
    treeViewer.addCheckStateListener(
        new ICheckStateListener() {
          public void checkStateChanged(CheckStateChangedEvent event) {
            forceExistingChecked(event);
          }
        });

    applyDialogFont(composite);
    return composite;
  }
  /**
   * Creates the tree viewer.
   *
   * @param parent the parent composite
   * @return the tree viewer
   */
  protected CheckboxTreeViewer createTreeViewer(Composite parent) {
    fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

    fViewer.setContentProvider(fContentProvider);
    fViewer.setLabelProvider(fLabelProvider);
    fViewer.addCheckStateListener(
        new ICheckStateListener() {
          public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
          }
        });

    fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
    if (fFilters != null) {
      for (int i = 0; i != fFilters.size(); i++) fViewer.addFilter((ViewerFilter) fFilters.get(i));
    }

    fViewer.setInput(fInput);

    return fViewer;
  }