Class StyledTextCellEditor
- java.lang.Object
-
- org.eclipse.jface.viewers.CellEditor
-
- org.yakindu.base.utils.jface.viewers.StyledTextCellEditor
-
- Direct Known Subclasses:
XtextStyledTextCellEditor
public class StyledTextCellEditor extends CellEditor
This is a complete copy ofTextCellEditor
. Only the control is changed fromText
toStyledText
, with some small modifications.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData
-
-
Field Summary
Fields Modifier and Type Field Description protected StyledText
text
The text control; initiallynull
.-
Fields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
-
-
Constructor Summary
Constructors Constructor Description StyledTextCellEditor()
Creates a new text string cell editor with no control The cell editor value is the string itself, which is initially the empty string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Control
createControl(Composite parent)
protected StyledText
createStyledText(Composite parent)
Hook changing creation of Controlprotected boolean
dependsOnExternalFocusListener()
This implementation ofCellEditor.dependsOnExternalFocusListener()
returns false if the current instance's class is TextCellEditor, and true otherwise.protected Object
doGetValue()
TheTextCellEditor
implementation of thisCellEditor
framework method returns the text string.protected void
doSetFocus()
protected void
doSetValue(Object value)
TheTextCellEditor
implementation of thisCellEditor
framework method accepts a text string (typeString
).protected void
editOccured(ModifyEvent e)
Processes a modify event that occurred in this text cell editor.CellEditor.LayoutData
getLayoutData()
Since a text editor field is scrollable we don't set a minimumSize.protected VerifyKeyListener
getVerifyKeyListener()
protected void
handleDefaultSelection(SelectionEvent event)
Handles a default selection event from the text control by applying the editor value and deactivating this cell editor.boolean
isCopyEnabled()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if the current selection is not empty.boolean
isCutEnabled()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if the current selection is not empty.boolean
isDeleteEnabled()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if there is a selection or if the caret is not positioned at the end of the text.boolean
isPasteEnabled()
TheTextCellEditor
implementation of thisCellEditor
method always returnstrue
.boolean
isSaveAllEnabled()
Check if save all is enabledboolean
isSelectAllEnabled()
Returnstrue
if this cell editor is able to perform the select all action.protected void
keyReleaseOccured(KeyEvent keyEvent)
Processes a key release event that occurred in this cell editor.void
performCopy()
TheTextCellEditor
implementation of thisCellEditor
method copies the current selection to the clipboard.void
performCut()
TheTextCellEditor
implementation of thisCellEditor
method cuts the current selection to the clipboard.void
performDelete()
TheTextCellEditor
implementation of thisCellEditor
method deletes the current selection or, if there is no selection, the character next character from the current position.void
performPaste()
TheTextCellEditor
implementation of thisCellEditor
method pastes the the clipboard contents over the current selection.void
performSelectAll()
TheTextCellEditor
implementation of thisCellEditor
method 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 Detail
-
text
protected StyledText text
The text control; initiallynull
.
-
-
Method Detail
-
createControl
protected Control createControl(Composite parent)
- Specified by:
createControl
in classCellEditor
-
getVerifyKeyListener
protected VerifyKeyListener getVerifyKeyListener()
-
createStyledText
protected StyledText createStyledText(Composite parent)
Hook changing creation of Control- Parameters:
parent
-- Returns:
-
doGetValue
protected Object doGetValue()
TheTextCellEditor
implementation of thisCellEditor
framework method returns the text string.- Specified by:
doGetValue
in classCellEditor
- Returns:
- the text string
-
doSetFocus
protected void doSetFocus()
- Specified by:
doSetFocus
in classCellEditor
-
doSetValue
protected void doSetValue(Object value)
TheTextCellEditor
implementation of thisCellEditor
framework method accepts a text string (typeString
).- Specified by:
doSetValue
in classCellEditor
- Parameters:
value
- a text string (typeString
)
-
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 viafireEditorValueChanged
. 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 classCellEditor
-
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()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if the current selection is not empty.- Overrides:
isCopyEnabled
in classCellEditor
-
isCutEnabled
public boolean isCutEnabled()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if the current selection is not empty.- Overrides:
isCutEnabled
in classCellEditor
-
isDeleteEnabled
public boolean isDeleteEnabled()
TheTextCellEditor
implementation of thisCellEditor
method returnstrue
if there is a selection or if the caret is not positioned at the end of the text.- Overrides:
isDeleteEnabled
in classCellEditor
-
isPasteEnabled
public boolean isPasteEnabled()
TheTextCellEditor
implementation of thisCellEditor
method always returnstrue
.- Overrides:
isPasteEnabled
in classCellEditor
-
isSaveAllEnabled
public boolean isSaveAllEnabled()
Check if save all is enabled- Returns:
- true if it is
-
isSelectAllEnabled
public boolean isSelectAllEnabled()
Returnstrue
if this cell editor is able to perform the select all action.This default implementation always returns
false
.Subclasses may override
- Overrides:
isSelectAllEnabled
in classCellEditor
- 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 inhandleDefaultSelection
. 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 classCellEditor
- Parameters:
keyEvent
- the key event
-
performCopy
public void performCopy()
TheTextCellEditor
implementation of thisCellEditor
method copies the current selection to the clipboard.- Overrides:
performCopy
in classCellEditor
-
performCut
public void performCut()
TheTextCellEditor
implementation of thisCellEditor
method cuts the current selection to the clipboard.- Overrides:
performCut
in classCellEditor
-
performDelete
public void performDelete()
TheTextCellEditor
implementation of thisCellEditor
method deletes the current selection or, if there is no selection, the character next character from the current position.- Overrides:
performDelete
in classCellEditor
-
performPaste
public void performPaste()
TheTextCellEditor
implementation of thisCellEditor
method pastes the the clipboard contents over the current selection.- Overrides:
performPaste
in classCellEditor
-
performSelectAll
public void performSelectAll()
TheTextCellEditor
implementation of thisCellEditor
method selects all of the current text.- Overrides:
performSelectAll
in 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:
dependsOnExternalFocusListener
in classCellEditor
- Since:
- 3.4
-
-