Class DialogCellEditor
- java.lang.Object
-
- org.eclipse.jface.viewers.CellEditor
-
- org.eclipse.jface.viewers.DialogCellEditor
-
- Direct Known Subclasses:
ColorCellEditor
public abstract class DialogCellEditor extends CellEditor
An abstract cell editor that uses a dialog. Dialog cell editors usually have a label control on the left and a button on the right. Pressing the button opens a dialog window (for example, a color dialog or a file dialog) to change the cell editor's value. The cell editor's value is the value of the dialog.Subclasses may override the following methods:
createButton
: creates the cell editor's button controlcreateContents
: creates the cell editor's 'display value' controlupdateContents
: updates the cell editor's 'display value' control after its value has changedopenDialogBox
: opens the dialog box when the end user presses the button
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData
-
-
Field Summary
Fields Modifier and Type Field Description static String
CELL_EDITOR_IMG_DOTS_BUTTON
Image registry key for three dot image (value"cell_editor_dots_button_image"
).-
Fields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
-
-
Constructor Summary
Constructors Modifier Constructor Description DialogCellEditor()
Creates a new dialog cell editor with no controlprotected
DialogCellEditor(Composite parent)
Creates a new dialog cell editor parented under the given control.protected
DialogCellEditor(Composite parent, int style)
Creates a new dialog cell editor parented under the given control.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Button
createButton(Composite parent)
Creates the button for this cell editor under the given parent control.protected Control
createContents(Composite cell)
Creates the controls used to show the value of this cell editor.protected Control
createControl(Composite parent)
Creates the control for this cell editor under the given parent control.void
deactivate()
Hides this cell editor's control.protected Object
doGetValue()
Returns this cell editor's value.protected void
doSetFocus()
Sets the focus to the cell editor's control.protected void
doSetValue(Object value)
Sets this cell editor's value.protected Label
getDefaultLabel()
Returns the default label widget created bycreateContents
.protected abstract Object
openDialogBox(Control cellEditorWindow)
Opens a dialog box under the given parent control and returns the dialog's value when it closes, ornull
if the dialog was canceled or no selection was made in the dialog.protected void
updateContents(Object value)
Updates the controls showing the value of this cell editor.-
Methods inherited from class org.eclipse.jface.viewers.CellEditor
activate, activate, addListener, addPropertyChangeListener, create, deactivate, dependsOnExternalFocusListener, dispose, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, focusLost, getControl, getDoubleClickTimeout, getErrorMessage, getLayoutData, getStyle, getValidator, getValue, isActivated, isCopyEnabled, isCorrect, isCutEnabled, isDeleteEnabled, isDirty, isFindEnabled, isPasteEnabled, isRedoEnabled, isSelectAllEnabled, isUndoEnabled, isValueValid, keyReleaseOccured, markDirty, performCopy, performCut, performDelete, performFind, performPaste, performRedo, performSelectAll, performUndo, removeListener, removePropertyChangeListener, setErrorMessage, setFocus, setStyle, setValidator, setValue, setValueValid, valueChanged
-
-
-
-
Field Detail
-
CELL_EDITOR_IMG_DOTS_BUTTON
public static final String CELL_EDITOR_IMG_DOTS_BUTTON
Image registry key for three dot image (value"cell_editor_dots_button_image"
).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DialogCellEditor
public DialogCellEditor()
Creates a new dialog cell editor with no control- Since:
- 2.1
-
DialogCellEditor
protected DialogCellEditor(Composite parent)
Creates a new dialog cell editor parented under the given control. The cell editor value isnull
initially, and has no validator.- Parameters:
parent
- the parent control
-
DialogCellEditor
protected DialogCellEditor(Composite parent, int style)
Creates a new dialog cell editor parented under the given control. The cell editor value isnull
initially, and has no validator.- Parameters:
parent
- the parent controlstyle
- the style bits- Since:
- 2.1
-
-
Method Detail
-
createButton
protected Button createButton(Composite parent)
Creates the button for this cell editor under the given parent control.The default implementation of this framework method creates the button display on the right hand side of the dialog cell editor. Subclasses may extend or reimplement.
- Parameters:
parent
- the parent control- Returns:
- the new button control
-
createContents
protected Control createContents(Composite cell)
Creates the controls used to show the value of this cell editor.The default implementation of this framework method creates a label widget, using the same font and background color as the parent control.
Subclasses may reimplement. If you reimplement this method, you should also reimplement
updateContents
.- Parameters:
cell
- the control for this cell editor- Returns:
- the underlying control
-
createControl
protected Control createControl(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 classCellEditor
- Parameters:
parent
- the parent control- Returns:
- the new control, or
null
if this cell editor has no control
-
deactivate
public void deactivate()
Description copied from class:CellEditor
Hides this cell editor's control. Does nothing if this cell editor is not visible.- Overrides:
deactivate
in classCellEditor
-
doGetValue
protected Object doGetValue()
Description copied from class:CellEditor
Returns this cell editor's value.This framework method must be implemented by concrete subclasses.
- Specified by:
doGetValue
in classCellEditor
- Returns:
- the value of this cell editor
- See Also:
CellEditor.getValue()
-
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 classCellEditor
- See Also:
CellEditor.setFocus()
-
doSetValue
protected void doSetValue(Object value)
Description copied from class:CellEditor
Sets this cell editor's value.This framework method must be implemented by concrete subclasses.
- Specified by:
doSetValue
in classCellEditor
- Parameters:
value
- the value of this cell editor- See Also:
CellEditor.setValue(java.lang.Object)
-
getDefaultLabel
protected Label getDefaultLabel()
Returns the default label widget created bycreateContents
.- Returns:
- the default label widget
-
openDialogBox
protected abstract Object openDialogBox(Control cellEditorWindow)
Opens a dialog box under the given parent control and returns the dialog's value when it closes, ornull
if the dialog was canceled or no selection was made in the dialog.This framework method must be implemented by concrete subclasses. It is called when the user has pressed the button and the dialog box must pop up.
- Parameters:
cellEditorWindow
- the parent control cell editor's window so that a subclass can adjust the dialog box accordingly- Returns:
- the selected value, or
null
if the dialog was canceled or no selection was made in the dialog
-
updateContents
protected void updateContents(Object value)
Updates the controls showing the value of this cell editor.The default implementation of this framework method just converts the passed object to a string using
toString
and sets this as the text of the label widget.Subclasses may reimplement. If you reimplement this method, you should also reimplement
createContents
.- Parameters:
value
- the new value of this cell editor
-
-