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 aCellEditor
and can be used e.g. in jFaceStructuredViewer
s 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 CompletionProposalAdapter
createCompletionProposalAdapter(StyledText styledText, IContentAssistant contentAssistant)
protected Control
createControl(Composite parent)
Creates anSourceViewer
and returns theStyledText
widget of the viewer as the cell editors control.protected MenuManager
createMenuManager()
protected StyledTextXtextAdapter
createXtextAdapter()
protected boolean
dependsOnExternalFocusListener()
This implementation ofCellEditor.dependsOnExternalFocusListener()
returns false if the current instance's class is TextCellEditor, and true otherwise.void
dispose()
protected void
doSetValue(Object value)
TheTextCellEditor
implementation of thisCellEditor
framework method accepts a text string (typeString
).protected void
focusLost()
protected CompletionProposalAdapter
getCompletionProposalAdapter()
protected IXtextFakeContextResourcesProvider
getContextFakeResourceProvider()
protected com.google.inject.Injector
getInjector()
StyledTextXtextAdapter
getXtextAdapter()
protected void
initContextMenu(Control control)
boolean
isFindEnabled()
protected boolean
isIgnoreNextFocusLost()
boolean
isRedoEnabled()
boolean
isUndoEnabled()
protected void
keyReleaseOccured(KeyEvent keyEvent)
Processes a key release event that occurred in this cell editor.void
performRedo()
void
performUndo()
protected void
setIgnoreNextFocusLost(boolean ignoreNextFocusLost)
void
setVisibleRegion(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 anSourceViewer
and returns theStyledText
widget of the viewer as the cell editors control. Some code is copied fromXtextEditor
.- Overrides:
createControl
in classStyledTextCellEditor
-
initContextMenu
protected void initContextMenu(Control control)
-
createMenuManager
protected MenuManager createMenuManager()
-
keyReleaseOccured
protected void keyReleaseOccured(KeyEvent keyEvent)
Description copied from class:StyledTextCellEditor
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 inhandleDefaultSelection
. 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 classStyledTextCellEditor
- Parameters:
keyEvent
- the key event
-
doSetValue
protected void doSetValue(Object value)
Description copied from class:StyledTextCellEditor
TheTextCellEditor
implementation of thisCellEditor
framework method accepts a text string (typeString
).- Overrides:
doSetValue
in classStyledTextCellEditor
- Parameters:
value
- a text string (typeString
)
-
isUndoEnabled
public boolean isUndoEnabled()
- Overrides:
isUndoEnabled
in classCellEditor
-
performUndo
public void performUndo()
- Overrides:
performUndo
in classCellEditor
-
isRedoEnabled
public boolean isRedoEnabled()
- Overrides:
isRedoEnabled
in classCellEditor
-
performRedo
public void performRedo()
- Overrides:
performRedo
in classCellEditor
-
isFindEnabled
public boolean isFindEnabled()
- Overrides:
isFindEnabled
in classCellEditor
-
focusLost
protected void focusLost()
- Overrides:
focusLost
in classCellEditor
-
dispose
public void dispose()
- Overrides:
dispose
in classCellEditor
-
dependsOnExternalFocusListener
protected boolean dependsOnExternalFocusListener()
Description copied from class:StyledTextCellEditor
This 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:
dependsOnExternalFocusListener
in 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()
-
-