Class XtextDirectEditManager
java.lang.Object
org.eclipse.gef.tools.DirectEditManager
org.yakindu.base.xtext.utils.gmf.directedit.DirectEditManagerEx
org.yakindu.base.xtext.utils.gmf.directedit.XtextDirectEditManager
Full copy of the TextDirectEditManager for a StyledText
-
Field Summary
Fields inherited from class org.yakindu.base.xtext.utils.gmf.directedit.DirectEditManagerEx
BORDER_FRAME
-
Constructor Summary
ConstructorDescriptionXtextDirectEditManager
(org.eclipse.gef.GraphicalEditPart source, Class<?> editorType, org.eclipse.gef.tools.CellEditorLocator locator, com.google.inject.Injector injector, int style) XtextDirectEditManager
(IXtextAwareEditPart source, com.google.inject.Injector injector, int style) constructorXtextDirectEditManager
(IXtextAwareEditPart source, com.google.inject.Injector injector, int style, IXtextFakeContextResourcesProvider provider) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Cleanup is done here.protected void
commit()
Commits the current value of the cell editor by getting aCommand
from the source edit part and executing it via theCommandStack
.protected CellEditor
createCellEditorOn
(Composite composite) This method is overridden so that the editor class can have a style as the style needs to be passed into the editor class when it is created.protected org.eclipse.draw2d.IFigure
Overridden to enlarge the cell editor frame for a control decoratorprotected IXtextAwareEditPart
Returns the source edit part.protected ResourceManager
Gets the resource manager to remember the resources allocated for this graphical viewer.protected Font
getScaledFont
(org.eclipse.draw2d.IFigure label) Given a label figure object, this will calculate the correct Font needed to display into screen coordinates, taking into account the current mapmode.static org.eclipse.gef.tools.CellEditorLocator
protected void
protected void
Initializes the cell editor.protected void
setCellEditor
(CellEditor editor) Sets the cell editor to the given editor.void
setEditText
(String toEdit) This method is used to set the cell editors textvoid
show()
Shows the cell editor when direct edit is started.void
show
(char initialChar) Performs show and sets the edit string to be the initial character or stringvoid
Performs show and sends an extra mouse click to the point location so that cursor appears at the mouse click point The Text control does not allow for the cursor to appear at point location but at a character locationvoid
Asks the source edit part to show source feedback.protected void
Unhooks listeners.Methods inherited from class org.yakindu.base.xtext.utils.gmf.directedit.DirectEditManagerEx
createDirectEditRequest, eraseFeedback, getCellEditor, getDirectEditFeature, getDirectEditRequest, getLocator, handleValueChanged, isDirty, setDirty, setEditPart, setLocator
-
Constructor Details
-
XtextDirectEditManager
public XtextDirectEditManager(IXtextAwareEditPart source, com.google.inject.Injector injector, int style) constructor- Parameters:
source
-GraphicalEditPart
to support direct edit of. The figure of thesource
edit part must be of typeWrapLabel
.
-
XtextDirectEditManager
public XtextDirectEditManager(IXtextAwareEditPart source, com.google.inject.Injector injector, int style, IXtextFakeContextResourcesProvider provider) -
XtextDirectEditManager
public XtextDirectEditManager(org.eclipse.gef.GraphicalEditPart source, Class<?> editorType, org.eclipse.gef.tools.CellEditorLocator locator, com.google.inject.Injector injector, int style) - Parameters:
source
-editorType
-locator
-
-
-
Method Details
-
getTextCellEditorLocator
public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(IXtextAwareEditPart source) - Parameters:
source
- theITextAwareEditPart
to determine the cell editor for- Returns:
- the
CellEditorLocator
that is appropriate for the sourceEditPart
-
createCellEditorOn
This method is overridden so that the editor class can have a style as the style needs to be passed into the editor class when it is created. It will default to the super behavior if aneditorType
was passed into the constructor.- Overrides:
createCellEditorOn
in classDirectEditManagerEx
- Parameters:
composite
- the composite to create the cell editor on- Returns:
- the newly created cell editor
- Since:
- 2.1
-
getScaledFont
Given a label figure object, this will calculate the correct Font needed to display into screen coordinates, taking into account the current mapmode. This will typically be used by direct edit cell editors that need to display independent of the zoom or any coordinate mapping that is taking place on the drawing surface.- Parameters:
label
- the label to use for the font calculation- Returns:
- the
Font
that is scaled to the screen coordinates. Note: the returnedFont
should not be disposed since it is cached by a common resource manager.
-
initCellEditor
protected void initCellEditor()Description copied from class:DirectEditManagerEx
Initializes the cell editor. Subclasses should implement this to set the initial text and add things such asVerifyListeners
, if needed.- Specified by:
initCellEditor
in classDirectEditManagerEx
-
commit
protected void commit()Description copied from class:DirectEditManagerEx
Commits the current value of the cell editor by getting aCommand
from the source edit part and executing it via theCommandStack
. Finally,DirectEditManagerEx.bringDown()
is called to perform and necessary cleanup.- Overrides:
commit
in classDirectEditManagerEx
- See Also:
-
DirectEditManager.commit()
-
bringDown
protected void bringDown()Description copied from class:DirectEditManagerEx
Cleanup is done here. Any feedback is erased and listeners unhooked. If the cell editor is notnull
, it will bedeativated
,disposed
, and set tonull
.- Overrides:
bringDown
in classDirectEditManagerEx
- See Also:
-
DirectEditManager.bringDown()
-
setEditText
This method is used to set the cell editors text- Parameters:
toEdit
- String to be set in the cell editor
-
show
public void show(char initialChar) Performs show and sets the edit string to be the initial character or string- Parameters:
initialChar
-
-
show
public void show()Description copied from class:DirectEditManagerEx
Shows the cell editor when direct edit is started. CallsDirectEditManagerEx.initCellEditor()
,CellEditor.activate()
, andDirectEditManagerEx.showFeedback()
.- Overrides:
show
in classDirectEditManagerEx
-
show
Performs show and sends an extra mouse click to the point location so that cursor appears at the mouse click point The Text control does not allow for the cursor to appear at point location but at a character location- Parameters:
location
-
-
hookListeners
protected void hookListeners()- Overrides:
hookListeners
in classDirectEditManagerEx
-
unhookListeners
protected void unhookListeners()Description copied from class:DirectEditManagerEx
Unhooks listeners. Called fromDirectEditManagerEx.bringDown()
.- Overrides:
unhookListeners
in classDirectEditManagerEx
-
setCellEditor
Description copied from class:DirectEditManagerEx
Sets the cell editor to the given editor.- Overrides:
setCellEditor
in classDirectEditManagerEx
- Parameters:
editor
- the cell editor
-
showFeedback
public void showFeedback()Description copied from class:DirectEditManagerEx
Asks the source edit part to show source feedback.- Overrides:
showFeedback
in classDirectEditManagerEx
-
getCellEditorFrame
protected org.eclipse.draw2d.IFigure getCellEditorFrame()Overridden to enlarge the cell editor frame for a control decorator- Overrides:
getCellEditorFrame
in classDirectEditManagerEx
-
getEditPart
Description copied from class:DirectEditManagerEx
Returns the source edit part.- Overrides:
getEditPart
in classDirectEditManagerEx
- Returns:
- the source edit part
-
getResourceManager
Gets the resource manager to remember the resources allocated for this graphical viewer. All resources will be disposed when the graphical viewer is closed if they have not already been disposed.- Returns:
-