/* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    setControl(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setName);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fWorkingSetName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fWorkingSetName.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            validatePage();
          }
        });
    fWorkingSetName.setFocus();

    label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setContent);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fTree = new CheckboxFilteredTree(composite, SWT.BORDER, new PatternFilter());
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    fTree.getViewer().getControl().setLayoutData(gd);
    final IStructuredContentProvider fTableContentProvider = new ContentProvider();
    fTree.getCheckboxTreeViewer().setContentProvider(fTableContentProvider);
    fTree.getCheckboxTreeViewer().setLabelProvider(new WorkingSetLabelProvider());
    fTree.getCheckboxTreeViewer().setUseHashlookup(true);
    fTree.getCheckboxTreeViewer().setInput(PDECore.getDefault());

    fTree
        .getCheckboxTreeViewer()
        .addCheckStateListener(
            new ICheckStateListener() {
              public void checkStateChanged(CheckStateChangedEvent event) {
                validatePage();
              }
            });

    // Add select / deselect all buttons for bug 46669
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(2, true));
    buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
    selectAllButton.setText(PDEUIMessages.PluginWorkingSet_selectAll_label);
    selectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_selectAll_toolTip);
    selectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree
                .getCheckboxTreeViewer()
                .setCheckedElements(
                    fTableContentProvider.getElements(fTree.getCheckboxTreeViewer().getInput()));
            validatePage();
          }
        });
    selectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(selectAllButton);

    Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
    deselectAllButton.setText(PDEUIMessages.PluginWorkingSet_deselectAll_label);
    deselectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_deselectAll_toolTip);
    deselectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree.getCheckboxTreeViewer().setCheckedElements(new Object[0]);
            validatePage();
          }
        });
    deselectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(deselectAllButton);
    setPageComplete(false);
    setMessage(PDEUIMessages.PluginWorkingSet_message);

    initialize();
    Dialog.applyDialogFont(composite);

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(composite, IHelpContextIds.PLUGIN_WORKING_SET);
  }
 private static GridData getButtonGridData(Button button) {
   GridData data = new GridData(GridData.FILL_HORIZONTAL);
   data.widthHint = SWTUtil.getButtonWidthHint(button);
   // data.heightHint= SWTUtil.getButtonHeigthHint(button);
   return data;
 }