/*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
   */
  @Override
  protected void createFieldEditors() {

    // Load up the preference store
    super.createFieldEditors();
    // Add a string editor to edit the tool command
    Composite parent = getFieldEditorParent();
    FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
    commandStringField =
        new StringFieldEditor(fTool.getId(), Messages.BuildToolSettingsPage_tool_command, parent);
    commandStringField.setEmptyStringAllowed(false);
    GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
    addField(commandStringField);
    // Add a field editor that displays overall build options
    Composite par = getFieldEditorParent();
    allOptionFieldEditor =
        new MultiLineTextFieldEditor(ToolSettingsPrefStore.ALL_OPTIONS_ID, ALL_OPTIONS, par);
    allOptionFieldEditor.getTextControl(par).setEditable(false);
    //		gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(allOptionFieldEditor);

    addField(createLabelEditor(getFieldEditorParent(), WHITESPACE));
    addField(
        createLabelEditor(
            getFieldEditorParent(), Messages.BuildToolSettingsPage_tool_advancedSettings));

    // Add a string editor to edit the tool command line pattern
    parent = getFieldEditorParent();
    commandLinePatternField =
        new StringFieldEditor(
            fTool.getId() + ToolSettingsPrefStore.COMMAND_LINE_SUFFIX,
            Messages.BuildToolSettingsPage_tool_commandLinePattern,
            parent);
    gd = ((GridData) commandLinePatternField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = Dialog.convertWidthInCharsToPixels(fm, 30);
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(commandLinePatternField);
  }
  @Override
  public void propertyChange(PropertyChangeEvent event) {
    // allow superclass to handle as well
    super.propertyChange(event);

    if (fInfo instanceof MultiResourceInfo) {
      MultiResourceInfo mri = (MultiResourceInfo) fInfo;
      if (event.getSource() == commandStringField) {
        mri.setToolsCommand(fTool, commandStringField.getStringValue());
        updateFields();
      } else if (event.getSource() == commandLinePatternField) {
        mri.setCommandLinePattern(fTool, commandLinePatternField.getStringValue());
      }
    } else {
      if (event.getSource() == commandStringField) {
        fTool.setToolCommand(commandStringField.getStringValue());
        updateFields();
      } else if (event.getSource() == commandLinePatternField) {
        fTool.setCommandLinePattern(commandLinePatternField.getStringValue());
      }
    }
  }