Package org.eclipse.jface.viewers
Class ComboBoxCellEditor
java.lang.Object
org.eclipse.jface.viewers.CellEditor
org.eclipse.jface.viewers.ComboBoxCellEditor
A cell editor that presents a list of items in a combo box. The cell editor's
value is the zero-based index of the selected item.
This class may be instantiated; it is not intended to be subclassed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The list is dropped down when the activation is done through the keyboardstatic final int
The list is dropped down when the activation is done through the mousestatic final int
The list is dropped down when the activation is done without ui-interactionstatic final int
The list is dropped down when the activation is done by traversing from cell to cellFields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
-
Constructor Summary
ConstructorDescriptionCreates a new cell editor with no control and no st of choices.ComboBoxCellEditor
(Composite parent, String[] items) Creates a new cell editor with a combo containing the given list of choices and parented under the given control.ComboBoxCellEditor
(Composite parent, String[] items, int style) Creates a new cell editor with a combo containing the given list of choices and parented under the given control. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ColumnViewerEditorActivationEvent activationEvent) Activate the editor but also inform the editor which event triggered its activation.protected Control
createControl
(Composite parent) Creates the control for this cell editor under the given parent control.protected Object
TheComboBoxCellEditor
implementation of thisCellEditor
framework method returns the zero-based index of the current selection.protected void
Sets the focus to the cell editor's control.protected void
doSetValue
(Object value) TheComboBoxCellEditor
implementation of thisCellEditor
framework method accepts a zero-based index of a selection.protected void
Processes a focus lost event that occurred in this cell editor.String[]
getItems()
Returns the list of choices for the combo boxTheComboBoxCellEditor
implementation of thisCellEditor
framework method sets the minimum width of the cell.protected void
keyReleaseOccured
(KeyEvent keyEvent) Processes a key release event that occurred in this cell editor.void
setActivationStyle
(int activationStyle) This method allows to control how the combo reacts when activatedvoid
Sets the list of choices for the combo boxMethods inherited from class org.eclipse.jface.viewers.CellEditor
activate, addListener, addPropertyChangeListener, create, deactivate, deactivate, dependsOnExternalFocusListener, dispose, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, getControl, getDoubleClickTimeout, getErrorMessage, getStyle, getValidator, getValue, isActivated, isCopyEnabled, isCorrect, isCutEnabled, isDeleteEnabled, isDirty, isFindEnabled, isPasteEnabled, isRedoEnabled, isSelectAllEnabled, isUndoEnabled, isValueValid, markDirty, performCopy, performCut, performDelete, performFind, performPaste, performRedo, performSelectAll, performUndo, removeListener, removePropertyChangeListener, setErrorMessage, setFocus, setStyle, setValidator, setValue, setValueValid, valueChanged
-
Field Details
-
DROP_DOWN_ON_MOUSE_ACTIVATION
public static final int DROP_DOWN_ON_MOUSE_ACTIVATIONThe list is dropped down when the activation is done through the mouse- See Also:
-
DROP_DOWN_ON_KEY_ACTIVATION
public static final int DROP_DOWN_ON_KEY_ACTIVATIONThe list is dropped down when the activation is done through the keyboard- See Also:
-
DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION
public static final int DROP_DOWN_ON_PROGRAMMATIC_ACTIVATIONThe list is dropped down when the activation is done without ui-interaction- See Also:
-
DROP_DOWN_ON_TRAVERSE_ACTIVATION
public static final int DROP_DOWN_ON_TRAVERSE_ACTIVATIONThe list is dropped down when the activation is done by traversing from cell to cell- See Also:
-
-
Constructor Details
-
ComboBoxCellEditor
public ComboBoxCellEditor()Creates a new cell editor with no control and no st of choices. Initially, the cell editor has no cell validator. -
ComboBoxCellEditor
Creates a new cell editor with a combo containing the given list of choices and parented under the given control. The cell editor value is the zero-based index of the selected item. Initially, the cell editor has no cell validator and the first item in the list is selected.- Parameters:
parent
- the parent controlitems
- the list of strings for the combo box
-
ComboBoxCellEditor
Creates a new cell editor with a combo containing the given list of choices and parented under the given control. The cell editor value is the zero-based index of the selected item. Initially, the cell editor has no cell validator and the first item in the list is selected.- Parameters:
parent
- the parent controlitems
- the list of strings for the combo boxstyle
- the style bits- Since:
- 2.1
-
-
Method Details
-
getItems
Returns the list of choices for the combo box- Returns:
- the list of choices for the combo box
-
setItems
Sets the list of choices for the combo box- Parameters:
items
- the list of choices for the combo box
-
createControl
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
-
doGetValue
TheComboBoxCellEditor
implementation of thisCellEditor
framework method returns the zero-based index of the current selection.- Specified by:
doGetValue
in classCellEditor
- Returns:
- the zero-based index of the current selection wrapped as an
Integer
- See Also:
-
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:
-
getLayoutData
TheComboBoxCellEditor
implementation of thisCellEditor
framework method sets the minimum width of the cell. The minimum width is 10 characters ifcomboBox
is notnull
ordisposed
else it is 60 pixels to make sure the arrow button and some text is visible. The list of CCombo will be wide enough to show its longest item.- Overrides:
getLayoutData
in classCellEditor
- Returns:
- the layout data object
-
doSetValue
TheComboBoxCellEditor
implementation of thisCellEditor
framework method accepts a zero-based index of a selection.- Specified by:
doSetValue
in classCellEditor
- Parameters:
value
- the zero-based index of the selection wrapped as anInteger
- See Also:
-
focusLost
protected void focusLost()Description copied from class:CellEditor
Processes a focus lost event that occurred in this cell editor.The default implementation of this framework method applies the current value and deactivates the cell editor. Subclasses should call this method at appropriate times. Subclasses may also extend or reimplement.
- Overrides:
focusLost
in classCellEditor
-
keyReleaseOccured
Description copied from class:CellEditor
Processes a key release event that occurred in this cell editor.The default implementation of this framework method cancels editing when the ESC key is pressed. When the RETURN key is pressed the current value is applied and the cell editor deactivates. Subclasses should call this method at appropriate times. Subclasses may also extend or reimplement.
- Overrides:
keyReleaseOccured
in classCellEditor
- Parameters:
keyEvent
- the key event
-
activate
Description copied from class:CellEditor
Activate the editor but also inform the editor which event triggered its activation. The default implementation simply callsCellEditor.activate()
- Overrides:
activate
in classCellEditor
- Parameters:
activationEvent
- the editor activation event
-
setActivationStyle
public void setActivationStyle(int activationStyle) This method allows to control how the combo reacts when activated- Parameters:
activationStyle
- the style used
-