Class TTextCellEditor


public class TTextCellEditor extends CellEditor
A cell editor that manages a text entry field. The cell editor's value is the text string itself.

This class may be instantiated or subclassed.

  • Field Details

    • text

      protected Text text
      The text control; initially null.
  • Constructor Details

    • TTextCellEditor

      public TTextCellEditor(int column, Composite parent)
      Creates a new text string cell editor parented under the given control. The cell editor value is the string itself, which is initially the empty string. Initially, the cell editor has no cell validator.
      Parameters:
      parent - the parent control
  • Method Details

    • createControl

      protected Control createControl(Composite parent)
      Specified by:
      createControl in class CellEditor
    • doGetValue

      protected Object doGetValue()
      The TextCellEditor implementation of this CellEditor framework method returns the text string.
      Specified by:
      doGetValue in class CellEditor
      Returns:
      the text string
    • doSetFocus

      protected void doSetFocus()
      Specified by:
      doSetFocus in class CellEditor
    • doSetValue

      protected void doSetValue(Object value)
      The TextCellEditor implementation of this CellEditor framework method accepts a text string (type String).
      Specified by:
      doSetValue in class CellEditor
      Parameters:
      value - a text string (type String)
    • editOccured

      protected void editOccured(ModifyEvent e)
      Processes a modify event that occurred in this text cell editor. This framework method performs validation and sets the error message accordingly, and then reports a change via fireEditorValueChanged. Subclasses should call this method at appropriate times. Subclasses may extend or reimplement.
      Parameters:
      e - the SWT modify event
    • getLayoutData

      public CellEditor.LayoutData getLayoutData()
      Since a text editor field is scrollable we don't set a minimumSize.
      Overrides:
      getLayoutData in class CellEditor
    • handleDefaultSelection

      protected void handleDefaultSelection(SelectionEvent event)
      Handles a default selection event from the text control by applying the editor value and deactivating this cell editor.
      Parameters:
      event - the selection event
      Since:
      3.0
    • isCopyEnabled

      public boolean isCopyEnabled()
      The TextCellEditor implementation of this CellEditor method returns true if the current selection is not empty.
      Overrides:
      isCopyEnabled in class CellEditor
    • isCutEnabled

      public boolean isCutEnabled()
      The TextCellEditor implementation of this CellEditor method returns true if the current selection is not empty.
      Overrides:
      isCutEnabled in class CellEditor
    • isDeleteEnabled

      public boolean isDeleteEnabled()
      The TextCellEditor implementation of this CellEditor method returns true if there is a selection or if the caret is not positioned at the end of the text.
      Overrides:
      isDeleteEnabled in class CellEditor
    • isPasteEnabled

      public boolean isPasteEnabled()
      The TextCellEditor implementation of this CellEditor method always returns true.
      Overrides:
      isPasteEnabled in class CellEditor
    • isSaveAllEnabled

      public boolean isSaveAllEnabled()
      Check if save all is enabled
      Returns:
      true if it is
    • isSelectAllEnabled

      public boolean isSelectAllEnabled()
      Returns true if this cell editor is able to perform the select all action.

      This default implementation always returns false.

      Subclasses may override

      Overrides:
      isSelectAllEnabled in class CellEditor
      Returns:
      true if select all is possible, false otherwise
    • keyReleaseOccured

      protected void keyReleaseOccured(KeyEvent keyEvent)
      Processes a key release event that occurred in this cell editor.

      The TextCellEditor implementation of this framework method ignores when the RETURN key is pressed since this is handled in handleDefaultSelection. An exception is made for Ctrl+Enter for multi-line texts, since a default selection event is not sent in this case.

      Overrides:
      keyReleaseOccured in class CellEditor
      Parameters:
      keyEvent - the key event
    • performCopy

      public void performCopy()
      The TextCellEditor implementation of this CellEditor method copies the current selection to the clipboard.
      Overrides:
      performCopy in class CellEditor
    • performCut

      public void performCut()
      The TextCellEditor implementation of this CellEditor method cuts the current selection to the clipboard.
      Overrides:
      performCut in class CellEditor
    • performDelete

      public void performDelete()
      The TextCellEditor implementation of this CellEditor method deletes the current selection or, if there is no selection, the character next character from the current position.
      Overrides:
      performDelete in class CellEditor
    • performPaste

      public void performPaste()
      The TextCellEditor implementation of this CellEditor method pastes the the clipboard contents over the current selection.
      Overrides:
      performPaste in class CellEditor
    • performSelectAll

      public void performSelectAll()
      The TextCellEditor implementation of this CellEditor method selects all of the current text.
      Overrides:
      performSelectAll in class CellEditor
    • dependsOnExternalFocusListener

      protected boolean dependsOnExternalFocusListener()
      This implementation of CellEditor.dependsOnExternalFocusListener() returns false if the current instance's class is TextCellEditor, and true otherwise. Subclasses that hook their own focus listener should override this method and return false. See also bug 58777.
      Overrides:
      dependsOnExternalFocusListener in class CellEditor
      Since:
      3.4