Package org.eclipse.jface.viewers
Class TextCellEditor
java.lang.Object
org.eclipse.jface.viewers.CellEditor
org.eclipse.jface.viewers.TextCellEditor
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData -
Field Summary
FieldsFields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new text string cell editor with no control The cell editor value is the string itself, which is initially the empty string.TextCellEditor(Composite parent) Creates a new text string cell editor parented under the given control.TextCellEditor(Composite parent, int style) Creates a new text string cell editor parented under the given control. -
Method Summary
Modifier and TypeMethodDescriptionprotected ControlcreateControl(Composite parent) Creates the control for this cell editor under the given parent control.protected booleanThis implementation ofCellEditor.dependsOnExternalFocusListener()returns false if the current instance's class is TextCellEditor, and true otherwise.protected ObjectTheTextCellEditorimplementation of thisCellEditorframework method returns the text string.protected voidSets the focus to the cell editor's control.protected voiddoSetValue(Object value) TheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).protected voidProcesses a modify event that occurred in this text cell editor.Since a text editor field is scrollable we don't set a minimumSize.protected voidHandles a default selection event from the text control by applying the editor value and deactivating this cell editor.booleanTheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.booleanTheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.booleanTheTextCellEditorimplementation of thisCellEditormethod returnstrueif there is a selection or if the caret is not positioned at the end of the text.booleanTheTextCellEditorimplementation of thisCellEditormethod always returnstrue.booleanCheck if save all is enabledbooleanReturnstrueif this cell editor is able to perform the select all action.protected voidkeyReleaseOccured(KeyEvent keyEvent) Processes a key release event that occurred in this cell editor.voidTheTextCellEditorimplementation of thisCellEditormethod copies the current selection to the clipboard.voidTheTextCellEditorimplementation of thisCellEditormethod cuts the current selection to the clipboard.voidTheTextCellEditorimplementation of thisCellEditormethod deletes the current selection or, if there is no selection, the character next character from the current position.voidTheTextCellEditorimplementation of thisCellEditormethod pastes the the clipboard contents over the current selection.voidTheTextCellEditorimplementation of thisCellEditormethod selects all of the current text.Methods inherited from class org.eclipse.jface.viewers.CellEditor
activate, activate, addListener, addPropertyChangeListener, create, deactivate, deactivate, dispose, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, focusLost, getControl, getDoubleClickTimeout, getErrorMessage, getStyle, getValidator, getValue, isActivated, isCorrect, isDirty, isFindEnabled, isRedoEnabled, isUndoEnabled, isValueValid, markDirty, performFind, performRedo, performUndo, removeListener, removePropertyChangeListener, setErrorMessage, setFocus, setStyle, setValidator, setValue, setValueValid, valueChanged
-
Field Details
-
text
The text control; initiallynull.
-
-
Constructor Details
-
TextCellEditor
public TextCellEditor()Creates a new text string cell editor with no control The cell editor value is the string itself, which is initially the empty string. Initially, the cell editor has no cell validator.- Since:
- 2.1
-
TextCellEditor
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
-
TextCellEditor
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 controlstyle- the style bits- Since:
- 2.1
-
-
Method Details
-
createControl
Description copied from class:CellEditorCreates the control for this cell editor under the given parent control.This framework method must be implemented by concrete subclasses.
- Specified by:
createControlin classCellEditor- Parameters:
parent- the parent control- Returns:
- the new control, or
nullif this cell editor has no control
-
doGetValue
TheTextCellEditorimplementation of thisCellEditorframework method returns the text string.- Specified by:
doGetValuein classCellEditor- Returns:
- the text string
- See Also:
-
doSetFocus
protected void doSetFocus()Description copied from class:CellEditorSets the focus to the cell editor's control.This framework method must be implemented by concrete subclasses.
- Specified by:
doSetFocusin classCellEditor- See Also:
-
doSetValue
TheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).- Specified by:
doSetValuein classCellEditor- Parameters:
value- a text string (typeString)- See Also:
-
editOccured
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 viafireEditorValueChanged. Subclasses should call this method at appropriate times. Subclasses may extend or reimplement.- Parameters:
e- the SWT modify event
-
getLayoutData
Since a text editor field is scrollable we don't set a minimumSize.- Overrides:
getLayoutDatain classCellEditor- Returns:
- the layout data object
-
handleDefaultSelection
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()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.- Overrides:
isCopyEnabledin classCellEditor- Returns:
trueif copy is possible,falseotherwise
-
isCutEnabled
public boolean isCutEnabled()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.- Overrides:
isCutEnabledin classCellEditor- Returns:
trueif cut is possible,falseotherwise
-
isDeleteEnabled
public boolean isDeleteEnabled()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif there is a selection or if the caret is not positioned at the end of the text.- Overrides:
isDeleteEnabledin classCellEditor- Returns:
trueif delete is possible,falseotherwise
-
isPasteEnabled
public boolean isPasteEnabled()TheTextCellEditorimplementation of thisCellEditormethod always returnstrue.- Overrides:
isPasteEnabledin classCellEditor- Returns:
trueif paste is possible,falseotherwise
-
isSaveAllEnabled
public boolean isSaveAllEnabled()Check if save all is enabled- Returns:
- true if it is
-
isSelectAllEnabled
public boolean isSelectAllEnabled()Returnstrueif this cell editor is able to perform the select all action.This default implementation always returns
false.Subclasses may override
- Overrides:
isSelectAllEnabledin classCellEditor- Returns:
trueif select all is possible,falseotherwise
-
keyReleaseOccured
Processes a key release event that occurred in this cell editor.The
TextCellEditorimplementation of this framework method ignores when the RETURN key is pressed since this is handled inhandleDefaultSelection. An exception is made for Ctrl+Enter for multi-line texts, since a default selection event is not sent in this case.- Overrides:
keyReleaseOccuredin classCellEditor- Parameters:
keyEvent- the key event
-
performCopy
public void performCopy()TheTextCellEditorimplementation of thisCellEditormethod copies the current selection to the clipboard.- Overrides:
performCopyin classCellEditor
-
performCut
public void performCut()TheTextCellEditorimplementation of thisCellEditormethod cuts the current selection to the clipboard.- Overrides:
performCutin classCellEditor
-
performDelete
public void performDelete()TheTextCellEditorimplementation of thisCellEditormethod deletes the current selection or, if there is no selection, the character next character from the current position.- Overrides:
performDeletein classCellEditor
-
performPaste
public void performPaste()TheTextCellEditorimplementation of thisCellEditormethod pastes the the clipboard contents over the current selection.- Overrides:
performPastein classCellEditor
-
performSelectAll
public void performSelectAll()TheTextCellEditorimplementation of thisCellEditormethod selects all of the current text.- Overrides:
performSelectAllin classCellEditor
-
dependsOnExternalFocusListener
protected boolean dependsOnExternalFocusListener()This implementation ofCellEditor.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:
dependsOnExternalFocusListenerin classCellEditor- Returns:
trueto indicate that a focus listener has to be attached- Since:
- 3.4
-