Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jface.viewers
Class TextCellEditor  view TextCellEditor download TextCellEditor.java

java.lang.Object
  extended byorg.eclipse.jface.viewers.CellEditor
      extended byorg.eclipse.jface.viewers.TextCellEditor

public class TextCellEditor
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; it is not intended to be subclassed.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData
 
Field Summary
private static int defaultStyle
          Default TextCellEditor style specify no borders on text widget as cell outline in table already provides the look of a border.
private  boolean isDeleteable
           
private  boolean isSelectable
           
private  boolean isSelection
          State information for updating action enablement
private  org.eclipse.swt.events.ModifyListener modifyListener
           
protected  org.eclipse.swt.widgets.Text text
          The text control; initially null.
 
Fields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
 
Constructor Summary
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.
TextCellEditor(org.eclipse.swt.widgets.Composite parent)
          Creates a new text string cell editor parented under the given control.
TextCellEditor(org.eclipse.swt.widgets.Composite parent, int style)
          Creates a new text string cell editor parented under the given control.
 
Method Summary
private  void checkDeleteable()
          Checks to see if the "deleteable" state (can delete/ nothing to delete) has changed and if so fire an enablement changed notification.
private  void checkSelectable()
          Checks to see if the "selectable" state (can select) has changed and if so fire an enablement changed notification.
private  void checkSelection()
          Checks to see if the selection state (selection / no selection) has changed and if so fire an enablement changed notification.
protected  org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
          Creates the control for this cell editor under the given parent control.
protected  java.lang.Object doGetValue()
          The TextCellEditor implementation of this CellEditor framework method returns the text string.
protected  void doSetFocus()
          Sets the focus to the cell editor's control.
protected  void doSetValue(java.lang.Object value)
          The TextCellEditor implementation of this CellEditor framework method accepts a text string (type String).
protected  void editOccured(org.eclipse.swt.events.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.
private  org.eclipse.swt.events.ModifyListener getModifyListener()
          Return the modify listener.
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.
 boolean isCopyEnabled()
          The TextCellEditor implementation of this CellEditor method returns true if the current selection is not empty.
 boolean isCutEnabled()
          The TextCellEditor implementation of this CellEditor method returns true if the current selection is not empty.
 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.
 boolean isPasteEnabled()
          The TextCellEditor implementation of this CellEditor method always returns true.
 boolean isSaveAllEnabled()
          The TextCellEditor implementation of this CellEditor method always returns true.
 boolean isSelectAllEnabled()
          Returns true if this cell editor is able to perform the select all action.
protected  void keyReleaseOccured(org.eclipse.swt.events.KeyEvent keyEvent)
          Processes a key release event that occurred in this cell editor.
 void performCopy()
          The TextCellEditor implementation of this CellEditor method copies the current selection to the clipboard.
 void performCut()
          The TextCellEditor implementation of this CellEditor method cuts the current selection to the clipboard.
 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.
 void performPaste()
          The TextCellEditor implementation of this CellEditor method pastes the the clipboard contents over the current selection.
 void performSelectAll()
          The TextCellEditor implementation of this CellEditor method selects all of the current text.
 
Methods inherited from class org.eclipse.jface.viewers.CellEditor
activate, addListener, addPropertyChangeListener, create, deactivate, dispose, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, focusLost, getControl, getErrorMessage, getStyle, getValidator, getValue, isActivated, isCorrect, isDirty, isFindEnabled, isRedoEnabled, isUndoEnabled, isValueValid, markDirty, performFind, performRedo, performUndo, removeListener, removePropertyChangeListener, setErrorMessage, setFocus, setStyle, setValidator, setValue, setValueValid, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected org.eclipse.swt.widgets.Text text
The text control; initially null.


modifyListener

private org.eclipse.swt.events.ModifyListener modifyListener

isSelection

private boolean isSelection
State information for updating action enablement


isDeleteable

private boolean isDeleteable

isSelectable

private boolean isSelectable

defaultStyle

private static final int defaultStyle
Default TextCellEditor style specify no borders on text widget as cell outline in table already provides the look of a border.

See Also:
Constant Field Values
Constructor Detail

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

public TextCellEditor(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.


TextCellEditor

public TextCellEditor(org.eclipse.swt.widgets.Composite parent,
                      int style)
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.

Since:
2.1
Method Detail

checkDeleteable

private void checkDeleteable()
Checks to see if the "deleteable" state (can delete/ nothing to delete) has changed and if so fire an enablement changed notification.


checkSelectable

private void checkSelectable()
Checks to see if the "selectable" state (can select) has changed and if so fire an enablement changed notification.


checkSelection

private void checkSelection()
Checks to see if the selection state (selection / no selection) has changed and if so fire an enablement changed notification.


createControl

protected org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
Description copied from class: CellEditor
Creates the control for this cell editor under the given parent control.

This framework method must be implemented by concrete subclasses.

Specified by:
createControl in class CellEditor

doGetValue

protected java.lang.Object doGetValue()
The TextCellEditor implementation of this CellEditor framework method returns the text string.

Specified by:
doGetValue in class CellEditor

doSetFocus

protected void doSetFocus()
Description copied from class: CellEditor
Sets the focus to the cell editor's control.

This framework method must be implemented by concrete subclasses.

Specified by:
doSetFocus in class CellEditor

doSetValue

protected void doSetValue(java.lang.Object value)
The TextCellEditor implementation of this CellEditor framework method accepts a text string (type String).

Specified by:
doSetValue in class CellEditor

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 via fireEditorValueChanged. Subclasses should call this method at appropriate times. Subclasses may extend or reimplement.


getLayoutData

public CellEditor.LayoutData getLayoutData()
Since a text editor field is scrollable we don't set a minimumSize.

Overrides:
getLayoutData in class CellEditor

getModifyListener

private org.eclipse.swt.events.ModifyListener getModifyListener()
Return the modify listener.


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.

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()
The TextCellEditor implementation of this CellEditor method always returns true.


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

keyReleaseOccured

protected void keyReleaseOccured(org.eclipse.swt.events.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

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