Class ColorCellEditor


@NoExtend public class ColorCellEditor extends DialogCellEditor
A cell editor that manages a color field. The cell editor's value is the color (an SWT RBG).

This class may be instantiated; it is not intended to be subclassed.

  • Constructor Details

    • ColorCellEditor

      public ColorCellEditor(Composite parent)
      Creates a new color cell editor parented under the given control. The cell editor value is black (RGB(0,0,0)) initially, and has no validator.
      Parameters:
      parent - the parent control
    • ColorCellEditor

      public ColorCellEditor(Composite parent, int style)
      Creates a new color cell editor parented under the given control. The cell editor value is black (RGB(0,0,0)) initially, and has no validator.
      Parameters:
      parent - the parent control
      style - the style bits
      Since:
      2.1
  • Method Details

    • createContents

      protected Control createContents(Composite cell)
      Description copied from class: DialogCellEditor
      Creates the controls used to show the value of this cell editor.

      The default implementation of this framework method creates a label widget, using the same font and background color as the parent control.

      Subclasses may reimplement. If you reimplement this method, you should also reimplement updateContents.

      Overrides:
      createContents in class DialogCellEditor
      Parameters:
      cell - the control for this cell editor
      Returns:
      the underlying control
    • dispose

      public void dispose()
      Description copied from class: CellEditor
      Disposes of this cell editor and frees any associated SWT resources.
      Overrides:
      dispose in class CellEditor
    • openDialogBox

      protected Object openDialogBox(Control cellEditorWindow)
      Description copied from class: DialogCellEditor
      Opens a dialog box under the given parent control and returns the dialog's value when it closes, or null if the dialog was canceled or no selection was made in the dialog.

      This framework method must be implemented by concrete subclasses. It is called when the user has pressed the button and the dialog box must pop up.

      Specified by:
      openDialogBox in class DialogCellEditor
      Parameters:
      cellEditorWindow - the parent control cell editor's window so that a subclass can adjust the dialog box accordingly
      Returns:
      the selected value, or null if the dialog was canceled or no selection was made in the dialog
    • updateContents

      protected void updateContents(Object value)
      Description copied from class: DialogCellEditor
      Updates the controls showing the value of this cell editor.

      The default implementation of this framework method just converts the passed object to a string using toString and sets this as the text of the label widget.

      Subclasses may reimplement. If you reimplement this method, you should also reimplement createContents.

      Overrides:
      updateContents in class DialogCellEditor
      Parameters:
      value - the new value of this cell editor