Class XtextStyledTextCellEditor
- java.lang.Object
-
- org.eclipse.jface.viewers.CellEditor
-
- org.yakindu.base.utils.jface.viewers.StyledTextCellEditor
-
- org.yakindu.base.xtext.utils.jface.viewers.XtextStyledTextCellEditor
-
- Direct Known Subclasses:
XtextStyledTextCellEditorEx
public class XtextStyledTextCellEditor extends StyledTextCellEditor
This class integrates Xtext features into aCellEditorand can be used e.g. in jFaceStructuredViewers or in GMF EditParts via DirectEditManager. The current implementation supports, code completion, syntax highlighting and validation- See Also:
XtextStyledTextProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.CellEditor
CellEditor.LayoutData
-
-
Field Summary
-
Fields inherited from class org.yakindu.base.utils.jface.viewers.StyledTextCellEditor
text
-
Fields inherited from class org.eclipse.jface.viewers.CellEditor
COPY, CUT, DELETE, FIND, PASTE, REDO, SELECT_ALL, UNDO
-
-
Constructor Summary
Constructors Constructor Description XtextStyledTextCellEditor(int style, com.google.inject.Injector injector)XtextStyledTextCellEditor(int style, com.google.inject.Injector injector, IXtextFakeContextResourcesProvider contextFakeResourceProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CompletionProposalAdaptercreateCompletionProposalAdapter(StyledText styledText, IContentAssistant contentAssistant)protected ControlcreateControl(Composite parent)Creates anSourceViewerand returns theStyledTextwidget of the viewer as the cell editors control.protected MenuManagercreateMenuManager()protected StyledTextXtextAdaptercreateXtextAdapter()protected booleandependsOnExternalFocusListener()This implementation ofCellEditor.dependsOnExternalFocusListener()returns false if the current instance's class is TextCellEditor, and true otherwise.voiddispose()protected voiddoSetValue(Object value)TheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).protected voidfocusLost()protected CompletionProposalAdaptergetCompletionProposalAdapter()protected IXtextFakeContextResourcesProvidergetContextFakeResourceProvider()protected com.google.inject.InjectorgetInjector()StyledTextXtextAdaptergetXtextAdapter()protected voidinitContextMenu(Control control)booleanisFindEnabled()protected booleanisIgnoreNextFocusLost()booleanisRedoEnabled()booleanisUndoEnabled()protected voidkeyReleaseOccured(KeyEvent keyEvent)Processes a key release event that occurred in this cell editor.voidperformRedo()voidperformUndo()protected voidsetIgnoreNextFocusLost(boolean ignoreNextFocusLost)voidsetVisibleRegion(int start, int length)-
Methods inherited from class org.yakindu.base.utils.jface.viewers.StyledTextCellEditor
createStyledText, doGetValue, doSetFocus, editOccured, getLayoutData, getVerifyKeyListener, handleDefaultSelection, isCopyEnabled, isCutEnabled, isDeleteEnabled, isPasteEnabled, isSaveAllEnabled, isSelectAllEnabled, performCopy, performCut, performDelete, performPaste, performSelectAll
-
Methods inherited from class org.eclipse.jface.viewers.CellEditor
activate, activate, addListener, addPropertyChangeListener, create, deactivate, deactivate, fireApplyEditorValue, fireCancelEditor, fireEditorValueChanged, fireEnablementChanged, getControl, getDoubleClickTimeout, getErrorMessage, getStyle, getValidator, getValue, isActivated, isCorrect, isDirty, isValueValid, markDirty, performFind, removeListener, removePropertyChangeListener, setErrorMessage, setFocus, setStyle, setValidator, setValue, setValueValid, valueChanged
-
-
-
-
Constructor Detail
-
XtextStyledTextCellEditor
public XtextStyledTextCellEditor(int style, com.google.inject.Injector injector, IXtextFakeContextResourcesProvider contextFakeResourceProvider)
-
XtextStyledTextCellEditor
public XtextStyledTextCellEditor(int style, com.google.inject.Injector injector)
-
-
Method Detail
-
createControl
protected Control createControl(Composite parent)
Creates anSourceViewerand returns theStyledTextwidget of the viewer as the cell editors control. Some code is copied fromXtextEditor.- Overrides:
createControlin classStyledTextCellEditor
-
initContextMenu
protected void initContextMenu(Control control)
-
createMenuManager
protected MenuManager createMenuManager()
-
keyReleaseOccured
protected void keyReleaseOccured(KeyEvent keyEvent)
Description copied from class:StyledTextCellEditorProcesses a key release event that occurred in this cell editor.The
TextCellEditorimplementation 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:
keyReleaseOccuredin classStyledTextCellEditor- Parameters:
keyEvent- the key event
-
doSetValue
protected void doSetValue(Object value)
Description copied from class:StyledTextCellEditorTheTextCellEditorimplementation of thisCellEditorframework method accepts a text string (typeString).- Overrides:
doSetValuein classStyledTextCellEditor- Parameters:
value- a text string (typeString)
-
isUndoEnabled
public boolean isUndoEnabled()
- Overrides:
isUndoEnabledin classCellEditor
-
performUndo
public void performUndo()
- Overrides:
performUndoin classCellEditor
-
isRedoEnabled
public boolean isRedoEnabled()
- Overrides:
isRedoEnabledin classCellEditor
-
performRedo
public void performRedo()
- Overrides:
performRedoin classCellEditor
-
isFindEnabled
public boolean isFindEnabled()
- Overrides:
isFindEnabledin classCellEditor
-
focusLost
protected void focusLost()
- Overrides:
focusLostin classCellEditor
-
dispose
public void dispose()
- Overrides:
disposein classCellEditor
-
dependsOnExternalFocusListener
protected boolean dependsOnExternalFocusListener()
Description copied from class:StyledTextCellEditorThis 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:
dependsOnExternalFocusListenerin classStyledTextCellEditor
-
setVisibleRegion
public void setVisibleRegion(int start, int length)
-
getXtextAdapter
public StyledTextXtextAdapter getXtextAdapter()
-
getCompletionProposalAdapter
protected CompletionProposalAdapter getCompletionProposalAdapter()
-
getContextFakeResourceProvider
protected IXtextFakeContextResourcesProvider getContextFakeResourceProvider()
-
createCompletionProposalAdapter
protected CompletionProposalAdapter createCompletionProposalAdapter(StyledText styledText, IContentAssistant contentAssistant)
-
createXtextAdapter
protected StyledTextXtextAdapter createXtextAdapter()
-
isIgnoreNextFocusLost
protected boolean isIgnoreNextFocusLost()
-
setIgnoreNextFocusLost
protected void setIgnoreNextFocusLost(boolean ignoreNextFocusLost)
-
getInjector
protected com.google.inject.Injector getInjector()
-
-