/* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(
        new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(
        new IDialogFieldListener() {
          public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
          }
        });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
  }
  /** Update the values stored in the keys based on the UI. */
  protected final void updateModel(DialogField field) {

    if (fAptEnabledField != null && field == fAptEnabledField) {
      String newVal = String.valueOf(fAptEnabledField.isSelected());
      setValue(KEY_APTENABLED, newVal);
    } else if (field == fGenSrcDirField) {
      String newVal = fGenSrcDirField.getText();
      setValue(KEY_GENSRCDIR, newVal);
    } else if (field == fReconcileEnabledField) {
      String newVal = String.valueOf(fReconcileEnabledField.isSelected());
      setValue(KEY_RECONCILEENABLED, newVal);
    }
    validateSettings(null, null, null); // params are ignored
  }
  @Override
  protected void saveSettings() {
    List<ProcessorOption> elements;
    boolean isProjSpecificDisabled = (fJProj != null) && !fBlockControl.isEnabled();
    if (isProjSpecificDisabled) {
      // We're in a project properties pane but the entire configuration
      // block control is disabled.  That means the per-project settings checkbox
      // is unchecked.  To save that state, we'll clear the proc options map.
      elements = Collections.<ProcessorOption>emptyList();
    } else {
      elements = getListElements();
    }
    saveProcessorOptions(elements);
    super.saveSettings();
    if (null != fAptProject) {
      if (isProjSpecificDisabled) { // compare against workspace defaults
        if (!fOriginalGenSrcDir.equals(AptConfig.getGenSrcDir(null))) {
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
        }
        if (fOriginalAptEnabled != AptConfig.isEnabled(null)) {
          // make JDT "processingEnabled" setting track APT "enabled" setting.
          setJDTProcessAnnotationsSetting(fAptEnabledField.isSelected());

          fAptProject.preferenceChanged(AptPreferenceConstants.APT_ENABLED);
        }
        if (fOriginalReconcileEnabled != AptConfig.shouldProcessDuringReconcile(null)) {
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_RECONCILEENABLED);
        }
      } else { // compare against current settings
        if (!fOriginalGenSrcDir.equals(fGenSrcDirField.getText()))
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
        boolean isAptEnabled = fAptEnabledField.isSelected();
        if (fOriginalAptEnabled != isAptEnabled) {
          // make JDT "processingEnabled" setting track APT "enabled" setting.
          setJDTProcessAnnotationsSetting(isAptEnabled);

          fAptProject.preferenceChanged(AptPreferenceConstants.APT_ENABLED);
        }
        if (fOriginalReconcileEnabled != fReconcileEnabledField.isSelected())
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_RECONCILEENABLED);
      }
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener
  * #dialogFieldChanged(org.eclipse.jdt.
  * internal.ui.wizards.dialogfields.DialogField)
  */
 public void dialogFieldChanged(DialogField field) {
   if (field == fWorkspaceRadio) {
     final boolean checked = fWorkspaceRadio.isSelected();
     if (checked) {
       fPreviousExternalLocation = fLocation.getText();
       fLocation.setText(getDefaultPath(fNameGroup.getName()));
     } else {
       fLocation.setText(fPreviousExternalLocation);
     }
   }
   fireEvent();
 }
 /*
  * At workspace level, don't ask for a rebuild.
  */
 @Override
 protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
   if (workspaceSettings) return null;
   // if the only thing that changed was the reconcile setting, return null: a rebuild is not
   // necessary
   if (fOriginalGenSrcDir.equals(fGenSrcDirField.getText())) {
     if (fOriginalAptEnabled == fAptEnabledField.isSelected()) {
       if (!procOptionsChanged()) {
         return null;
       }
     }
   }
   return super.getFullBuildDialogStrings(workspaceSettings);
 }
 public boolean isNotSortingFieldsEnabled() {
   return fNotSortAllRadio.isSelected();
 }
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#close()
  */
 @Override
 public boolean close() {
   fDialogSettings.put(DIALOG_SETTINGS_SORT_ALL, fSortAllRadio.isSelected());
   return super.close();
 }
 public boolean isWorkspaceRadioSelected() {
   return fWorkspaceRadio.isSelected();
 }