Class SingleReferenceCellEditor
- java.lang.Object
-
- org.eclipse.jface.viewers.CellEditor
-
- org.eclipse.emf.ecp.view.internal.table.swt.cell.SingleReferenceCellEditor
-
- All Implemented Interfaces:
ECPCellEditor
,ECPElementAwareCellEditor
public class SingleReferenceCellEditor extends org.eclipse.jface.viewers.CellEditor implements ECPCellEditor, ECPElementAwareCellEditor
Single reference cell editor implementation.- Since:
- 1.22
- Author:
- Mat Hansen
, Eugen Neufeld
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
-
Fields inherited from interface org.eclipse.emf.ecp.edit.spi.swt.table.ECPCellEditor
COPY_STRING_ALTERNATIVE, CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description SingleReferenceCellEditor(org.eclipse.swt.widgets.Composite parent)
The constructor.SingleReferenceCellEditor(org.eclipse.swt.widgets.Composite parent, int style)
Alternate constructor with SWT style bits.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.widgets.Control
createControl(org.eclipse.swt.widgets.Composite parent)
void
dispose()
protected java.lang.Object
doGetValue()
protected void
doSetFocus()
protected void
doSetValue(java.lang.Object value)
int
getColumnWidthWeight()
The returned value is used for layouting the table columns.protected org.eclipse.emf.edit.domain.EditingDomain
getEditingDomain(org.eclipse.emf.ecore.EObject domainModel)
Get theEditingDomain
for the givenEObject
.java.lang.String
getFormatedString(java.lang.Object value)
This returns the String which will be shown in the table when no cell editor is open.org.eclipse.swt.graphics.Image
getImage(java.lang.Object value)
This returns the Image which will be shown in the table when no cell editor is open.int
getMinWidth()
Returns the minimum width of the cell editor.org.eclipse.core.databinding.UpdateValueStrategy
getModelToTargetStrategy(org.eclipse.core.databinding.DataBindingContext databindingContext)
ThisUpdateValueStrategy
will be used as the model to target strategy during data binding.int
getStyle()
The SWT style bits.org.eclipse.core.databinding.UpdateValueStrategy
getTargetToModelStrategy(org.eclipse.core.databinding.DataBindingContext databindingContext)
ThisUpdateValueStrategy
will be used as the target to model strategy during data binding.org.eclipse.core.databinding.property.value.SimpleValueProperty
getValueProperty()
Returns theIValueProperty
for this cell editor which is used by the table to create anIObservableValue
.void
instantiate(org.eclipse.emf.ecore.EStructuralFeature feature, ViewModelContext viewModelContext)
Instantiates this cell editor.void
setEditable(boolean editable)
Sets editable state of the cell editor.void
updateRowElement(java.lang.Object element)
Called to notify that a new element will be edited.-
Methods inherited from class org.eclipse.jface.viewers.CellEditor
activate, activate, addListener, addPropertyChangeListener, create, deactivate, deactivate, dependsOnExternalFocusListener, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, focusLost, getControl, getDoubleClickTimeout, getErrorMessage, getLayoutData, 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
-
-
-
-
Constructor Detail
-
SingleReferenceCellEditor
public SingleReferenceCellEditor(org.eclipse.swt.widgets.Composite parent)
The constructor.- Parameters:
parent
- the parent composite
-
SingleReferenceCellEditor
public SingleReferenceCellEditor(org.eclipse.swt.widgets.Composite parent, int style)
Alternate constructor with SWT style bits.- Parameters:
parent
- the parent compositestyle
- SWT style bits
-
-
Method Detail
-
getValueProperty
public org.eclipse.core.databinding.property.value.SimpleValueProperty getValueProperty()
Description copied from interface:ECPCellEditor
Returns theIValueProperty
for this cell editor which is used by the table to create anIObservableValue
.- Specified by:
getValueProperty
in interfaceECPCellEditor
- Returns:
- the
IValueProperty
for this cell editor
-
instantiate
public void instantiate(org.eclipse.emf.ecore.EStructuralFeature feature, ViewModelContext viewModelContext)
Description copied from interface:ECPCellEditor
Instantiates this cell editor. This allows the cell editor to useViewModelServices
.- Specified by:
instantiate
in interfaceECPCellEditor
- Parameters:
feature
- theEStructuralFeature
displayed in this cell editorviewModelContext
- theViewModelContext
used for the current view
-
getStyle
public int getStyle()
Description copied from interface:ECPCellEditor
The SWT style bits.- Specified by:
getStyle
in interfaceECPCellEditor
- Overrides:
getStyle
in classorg.eclipse.jface.viewers.CellEditor
- Returns:
- the style
-
getFormatedString
public java.lang.String getFormatedString(java.lang.Object value)
Description copied from interface:ECPCellEditor
This returns the String which will be shown in the table when no cell editor is open.- Specified by:
getFormatedString
in interfaceECPCellEditor
- Parameters:
value
- the Object to get the formated String for- Returns:
- the formated String
-
getImage
public org.eclipse.swt.graphics.Image getImage(java.lang.Object value)
Description copied from interface:ECPCellEditor
This returns the Image which will be shown in the table when no cell editor is open.- Specified by:
getImage
in interfaceECPCellEditor
- Parameters:
value
- the Object to get the Image for- Returns:
- the image
-
getColumnWidthWeight
public int getColumnWidthWeight()
Description copied from interface:ECPCellEditor
The returned value is used for layouting the table columns. The value is a relative column weight. A column containing text has a weight of 100. Please consider this when defining you weight. E.g if you return 200 your column will be twice the width of a text column.- Specified by:
getColumnWidthWeight
in interfaceECPCellEditor
- Returns:
- the relative column width
-
getTargetToModelStrategy
public org.eclipse.core.databinding.UpdateValueStrategy getTargetToModelStrategy(org.eclipse.core.databinding.DataBindingContext databindingContext)
Description copied from interface:ECPCellEditor
ThisUpdateValueStrategy
will be used as the target to model strategy during data binding.- Specified by:
getTargetToModelStrategy
in interfaceECPCellEditor
- Parameters:
databindingContext
- TheDataBindingContext
used by this strategy- Returns:
- the strategy
-
getModelToTargetStrategy
public org.eclipse.core.databinding.UpdateValueStrategy getModelToTargetStrategy(org.eclipse.core.databinding.DataBindingContext databindingContext)
Description copied from interface:ECPCellEditor
ThisUpdateValueStrategy
will be used as the model to target strategy during data binding.- Specified by:
getModelToTargetStrategy
in interfaceECPCellEditor
- Parameters:
databindingContext
- TheDataBindingContext
used by this strategy- Returns:
- the strategy
-
setEditable
public void setEditable(boolean editable)
Description copied from interface:ECPCellEditor
Sets editable state of the cell editor.- Specified by:
setEditable
in interfaceECPCellEditor
- Parameters:
editable
-true
if editable,false
otherwise
-
getMinWidth
public int getMinWidth()
Description copied from interface:ECPCellEditor
Returns the minimum width of the cell editor.- Specified by:
getMinWidth
in interfaceECPCellEditor
- Returns:
- the minimum width
-
createControl
protected org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
- Specified by:
createControl
in classorg.eclipse.jface.viewers.CellEditor
-
dispose
public void dispose()
- Overrides:
dispose
in classorg.eclipse.jface.viewers.CellEditor
-
getEditingDomain
protected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain(org.eclipse.emf.ecore.EObject domainModel)
Get theEditingDomain
for the givenEObject
.- Parameters:
domainModel
- the eObject- Returns:
- the
EditingDomain
-
doGetValue
protected java.lang.Object doGetValue()
- Specified by:
doGetValue
in classorg.eclipse.jface.viewers.CellEditor
-
doSetFocus
protected void doSetFocus()
- Specified by:
doSetFocus
in classorg.eclipse.jface.viewers.CellEditor
-
doSetValue
protected void doSetValue(java.lang.Object value)
- Specified by:
doSetValue
in classorg.eclipse.jface.viewers.CellEditor
-
updateRowElement
public void updateRowElement(java.lang.Object element)
Description copied from interface:ECPElementAwareCellEditor
Called to notify that a new element will be edited.- Specified by:
updateRowElement
in interfaceECPElementAwareCellEditor
- Parameters:
element
- the row element
-
-