Class ScaleFieldEditor

java.lang.Object
org.eclipse.jface.preference.FieldEditor
org.eclipse.jface.preference.ScaleFieldEditor

public class ScaleFieldEditor extends FieldEditor
A field editor for an integer type preference. This class may be used as is, or subclassed as required.
Since:
3.0
  • Field Details

    • scale

      protected Scale scale
      The scale, or null if none.
  • Constructor Details

    • ScaleFieldEditor

      public ScaleFieldEditor(String name, String labelText, Composite parent)
      Creates a scale field editor.
      Parameters:
      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
    • ScaleFieldEditor

      public ScaleFieldEditor(String name, String labelText, Composite parent, int min, int max, int increment, int pageIncrement)
      Creates a scale field editor with particular scale values.
      Parameters:
      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
      min - the value used for Scale.setMinimum(int).
      max - the value used for Scale.setMaximum(int).
      increment - the value used for Scale.setIncrement(int).
      pageIncrement - the value used for Scale.setPageIncrement(int).
  • 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.

      Specified by:
      adjustForNumColumns in class FieldEditor
      Parameters:
      numColumns - the number of columns
    • doFillIntoGrid

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

      Subclasses must implement this method to create the controls for this field editor.

      Note this method may be called by the constructor, so it must not access fields on the receiver object because they will not be fully initialized.

      Specified by:
      doFillIntoGrid in class FieldEditor
      Parameters:
      parent - the composite used as a parent for the basic controls; the parent's layout must be a GridLayout
      numColumns - the number of columns
    • doLoad

      protected void doLoad()
      Description copied from class: FieldEditor
      Initializes this field editor with the preference value from the preference store.

      Subclasses must implement this method to properly initialize the field editor.

      Specified by:
      doLoad in class FieldEditor
    • doLoadDefault

      protected void doLoadDefault()
      Description copied from class: FieldEditor
      Initializes this field editor with the default preference value from the preference store.

      Subclasses must implement this method to properly initialize the field editor.

      Specified by:
      doLoadDefault in class FieldEditor
    • doStore

      protected void doStore()
      Description copied from class: FieldEditor
      Stores the preference value from this field editor into the preference store.

      Subclasses must implement this method to save the entered value into the preference store.

      Specified by:
      doStore in class FieldEditor
    • getIncrement

      public int getIncrement()
      Returns the value that will be used for Scale.setIncrement(int).
      Returns:
      the value.
      See Also:
    • getMaximum

      public int getMaximum()
      Returns the value that will be used for Scale.setMaximum(int).
      Returns:
      the value.
      See Also:
    • getMinimum

      public int getMinimum()
      Returns the value that will be used for Scale.setMinimum(int).
      Returns:
      the value.
      See Also:
    • getNumberOfControls

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

      public int getPageIncrement()
      Returns the value that will be used for Scale.setPageIncrement(int).
      Returns:
      the value.
      See Also:
    • getScaleControl

      public Scale getScaleControl()
      Returns this field editor's scale control.
      Returns:
      the scale control, or null if no scale field is created yet
    • setFocus

      public void setFocus()
      Description copied from class: FieldEditor
      Sets the focus to this field editor.

      The default implementation of this framework method does nothing. Subclasses may reimplement.

      Overrides:
      setFocus in class FieldEditor
    • setIncrement

      public void setIncrement(int increment)
      Set the value to be used for Scale.setIncrement(int) and update the scale.
      Parameters:
      increment - a value greater than 0.
      See Also:
    • setMaximum

      public void setMaximum(int max)
      Set the value to be used for Scale.setMaximum(int) and update the scale.
      Parameters:
      max - a value greater than 0.
      See Also:
    • setMinimum

      public void setMinimum(int min)
      Set the value to be used for Scale.setMinumum(int) and update the scale.
      Parameters:
      min - a value greater than 0.
      See Also:
    • setPageIncrement

      public void setPageIncrement(int pageIncrement)
      Set the value to be used for Scale.setPageIncrement(int) and update the scale.
      Parameters:
      pageIncrement - a value greater than 0.
      See Also:
    • valueChanged

      protected void valueChanged()
      Informs this field editor's listener, if it has one, about a change to the value (VALUE property) provided that the old and new values are different.

      This hook is not called when the scale is initialized (or reset to the default value) from the preference store.

    • setEnabled

      public void setEnabled(boolean enabled, Composite parent)
      Bug 470866 fix
      Overrides:
      setEnabled in class FieldEditor
      Parameters:
      enabled - The enabled state.
      parent - The parent of the controls in the group. Used to create the controls if required.