Class StringButtonFieldEditor

Direct Known Subclasses:
DirectoryFieldEditor, FileFieldEditor

public abstract class StringButtonFieldEditor extends StringFieldEditor
An abstract field editor for a string type preference that presents a string input field with a change button to its right to edit the input field's content. When the user presses the change button, the abstract framework method changePressed() gets called to compute a new string.
  • Constructor Details

    • StringButtonFieldEditor

      protected StringButtonFieldEditor()
      Creates a new string button field editor
    • StringButtonFieldEditor

      protected StringButtonFieldEditor(String name, String labelText, Composite parent)
      Creates a string button field editor.
      name - the name of the preference this field editor works on
      labelText - the label text of the field editor
      parent - the parent of the field editor's control
  • Method Details

    • adjustForNumColumns

      protected void adjustForNumColumns(int numColumns)
      Description copied from class: FieldEditor
      Adjusts the horizontal span of this field editor's basic controls.

      Subclasses must implement this method to adjust the horizontal span of controls so they appear correct in the given number of columns.

      The number of columns will always be equal to or greater than the value returned by this editor's getNumberOfControls method.

      adjustForNumColumns in class StringFieldEditor
      numColumns - the number of columns
    • changePressed

      protected abstract String changePressed()
      Notifies that this field editor's change button has been pressed.

      Subclasses must implement this method to provide a corresponding new string for the text field. If the returned value is null, the currently displayed value remains.

      the new string to display, or null to leave the old string showing
    • doFillIntoGrid

      protected void doFillIntoGrid(Composite parent, int numColumns)
      Description copied from class: StringFieldEditor
      Fills this field editor's basic controls into the given parent.

      The string field implementation of this FieldEditor framework method contributes the text field. Subclasses may override but must call super.doFillIntoGrid.

      doFillIntoGrid in class StringFieldEditor
      parent - the composite used as a parent for the basic controls; the parent's layout must be a GridLayout
      numColumns - the number of columns
    • getChangeControl

      protected Button getChangeControl(Composite parent)
      Get the change control. Create it in parent if required.
      parent - the parent composite
    • getNumberOfControls

      public int getNumberOfControls()
      Description copied from class: FieldEditor
      Returns the number of basic controls this field editor consists of.
      getNumberOfControls in class StringFieldEditor
      the number of controls
    • getShell

      protected Shell getShell()
      Returns this field editor's shell.
      the shell
    • setChangeButtonText

      public void setChangeButtonText(String text)
      Sets the text of the change button.
      text - the new text
    • setEnabled

      public void setEnabled(boolean enabled, Composite parent)
      Description copied from class: FieldEditor
      Set whether or not the controls in the field editor are enabled.
      setEnabled in class StringFieldEditor
      enabled - The enabled state.
      parent - The parent of the controls in the group. Used to create the controls if required.