Package com.iizigo.text
Class TTextCellEditor
- java.lang.Object
- org.eclipse.jface.viewers.CellEditor
- com.iizigo.text.TTextCellEditor
public class TTextCellEditor extends org.eclipse.jface.viewers.CellEditorA 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 Summary
Fields Modifier and Type Field Description protected org.eclipse.swt.widgets.TexttextThe text control; initiallynull.
Constructor Summary
Constructors Constructor Description TTextCellEditor(int column, org.eclipse.swt.widgets.Composite parent)Creates a new text string cell editor parented under the given control.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.widgets.ControlcreateControl(org.eclipse.swt.widgets.Composite parent)protected booleandependsOnExternalFocusListener()This implementation ofCellEditor.dependsOnExternalFocusListener()returns false if the current instance's class is TextCellEditor, and true otherwise.protected java.lang.ObjectdoGetValue()TheTextCellEditorimplementation of thisCellEditorframework method returns the text string.protected voiddoSetFocus()protected voiddoSetValue(java.lang.Object value)TheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).protected voideditOccured(org.eclipse.swt.events.ModifyEvent e)Processes a modify event that occurred in this text cell editor.org.eclipse.jface.viewers.CellEditor.LayoutDatagetLayoutData()Since a text editor field is scrollable we don't set a minimumSize.protected voidhandleDefaultSelection(org.eclipse.swt.events.SelectionEvent event)Handles a default selection event from the text control by applying the editor value and deactivating this cell editor.booleanisCopyEnabled()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.booleanisCutEnabled()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.booleanisDeleteEnabled()TheTextCellEditorimplementation of thisCellEditormethod returnstrueif there is a selection or if the caret is not positioned at the end of the text.booleanisPasteEnabled()TheTextCellEditorimplementation of thisCellEditormethod always returnstrue.booleanisSaveAllEnabled()Check if save all is enabledbooleanisSelectAllEnabled()Returnstrueif this cell editor is able to perform the select all action.protected voidkeyReleaseOccured(org.eclipse.swt.events.KeyEvent keyEvent)Processes a key release event that occurred in this cell editor.voidperformCopy()TheTextCellEditorimplementation of thisCellEditormethod copies the current selection to the clipboard.voidperformCut()TheTextCellEditorimplementation of thisCellEditormethod cuts the current selection to the clipboard.voidperformDelete()TheTextCellEditorimplementation of thisCellEditormethod deletes the current selection or, if there is no selection, the character next character from the current position.voidperformPaste()TheTextCellEditorimplementation of thisCellEditormethod pastes the the clipboard contents over the current selection.voidperformSelectAll()TheTextCellEditorimplementation 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
Constructor Detail
TTextCellEditor
public TTextCellEditor(int column, org.eclipse.swt.widgets.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 Detail
createControl
protected org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
- Specified by:
createControlin classorg.eclipse.jface.viewers.CellEditor
doGetValue
protected java.lang.Object doGetValue()
TheTextCellEditorimplementation of thisCellEditorframework method returns the text string.- Specified by:
doGetValuein classorg.eclipse.jface.viewers.CellEditor- Returns:
- the text string
doSetFocus
protected void doSetFocus()
- Specified by:
doSetFocusin classorg.eclipse.jface.viewers.CellEditor
doSetValue
protected void doSetValue(java.lang.Object value)
TheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).- Specified by:
doSetValuein classorg.eclipse.jface.viewers.CellEditor- Parameters:
value- a text string (typeString)
editOccured
protected void editOccured(org.eclipse.swt.events.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 viafireEditorValueChanged. Subclasses should call this method at appropriate times. Subclasses may extend or reimplement.- Parameters:
e- the SWT modify event
getLayoutData
public org.eclipse.jface.viewers.CellEditor.LayoutData getLayoutData()
Since a text editor field is scrollable we don't set a minimumSize.- Overrides:
getLayoutDatain classorg.eclipse.jface.viewers.CellEditor
handleDefaultSelection
protected void handleDefaultSelection(org.eclipse.swt.events.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()
TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.- Overrides:
isCopyEnabledin classorg.eclipse.jface.viewers.CellEditor
isCutEnabled
public boolean isCutEnabled()
TheTextCellEditorimplementation of thisCellEditormethod returnstrueif the current selection is not empty.- Overrides:
isCutEnabledin classorg.eclipse.jface.viewers.CellEditor
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 classorg.eclipse.jface.viewers.CellEditor
isPasteEnabled
public boolean isPasteEnabled()
TheTextCellEditorimplementation of thisCellEditormethod always returnstrue.- Overrides:
isPasteEnabledin classorg.eclipse.jface.viewers.CellEditor
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 classorg.eclipse.jface.viewers.CellEditor- Returns:
trueif select all is possible,falseotherwise
keyReleaseOccured
protected void keyReleaseOccured(org.eclipse.swt.events.KeyEvent keyEvent)
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 classorg.eclipse.jface.viewers.CellEditor- Parameters:
keyEvent- the key event
performCopy
public void performCopy()
TheTextCellEditorimplementation of thisCellEditormethod copies the current selection to the clipboard.- Overrides:
performCopyin classorg.eclipse.jface.viewers.CellEditor
performCut
public void performCut()
TheTextCellEditorimplementation of thisCellEditormethod cuts the current selection to the clipboard.- Overrides:
performCutin classorg.eclipse.jface.viewers.CellEditor
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 classorg.eclipse.jface.viewers.CellEditor
performPaste
public void performPaste()
TheTextCellEditorimplementation of thisCellEditormethod pastes the the clipboard contents over the current selection.- Overrides:
performPastein classorg.eclipse.jface.viewers.CellEditor
performSelectAll
public void performSelectAll()
TheTextCellEditorimplementation of thisCellEditormethod selects all of the current text.- Overrides:
performSelectAllin classorg.eclipse.jface.viewers.CellEditor
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 classorg.eclipse.jface.viewers.CellEditor- Since:
- 3.4