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
-
public class XtextDirectEditManager extends DirectEditManagerEx
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
Constructors Constructor Description XtextDirectEditManager(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbringDown()Cleanup is done here.protected voidcommit()Commits the current value of the cell editor by getting aCommandfrom the source edit part and executing it via theCommandStack.protected CellEditorcreateCellEditorOn(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.IFiguregetCellEditorFrame()Overridden to enlarge the cell editor frame for a control decoratorprotected IXtextAwareEditPartgetEditPart()Returns the source edit part.protected ResourceManagergetResourceManager()Gets the resource manager to remember the resources allocated for this graphical viewer.protected FontgetScaledFont(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.CellEditorLocatorgetTextCellEditorLocator(IXtextAwareEditPart source)protected voidhookListeners()protected voidinitCellEditor()Initializes the cell editor.protected voidsetCellEditor(CellEditor editor)Sets the cell editor to the given editor.voidsetEditText(String toEdit)This method is used to set the cell editors textvoidshow()Shows the cell editor when direct edit is started.voidshow(char initialChar)Performs show and sets the edit string to be the initial character or stringvoidshow(Point location)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 locationvoidshowFeedback()Asks the source edit part to show source feedback.protected voidunhookListeners()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 Detail
-
XtextDirectEditManager
public XtextDirectEditManager(IXtextAwareEditPart source, com.google.inject.Injector injector, int style)
constructor- Parameters:
source-GraphicalEditPartto support direct edit of. The figure of thesourceedit 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 Detail
-
getTextCellEditorLocator
public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(IXtextAwareEditPart source)
- Parameters:
source- theITextAwareEditPartto determine the cell editor for- Returns:
- the
CellEditorLocatorthat is appropriate for the sourceEditPart
-
createCellEditorOn
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. It will default to the super behavior if aneditorTypewas passed into the constructor.- Overrides:
createCellEditorOnin classDirectEditManagerEx- Parameters:
composite- the composite to create the cell editor on- Returns:
- the newly created cell editor
- Since:
- 2.1
-
getScaledFont
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. 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
Fontthat is scaled to the screen coordinates. Note: the returnedFontshould not be disposed since it is cached by a common resource manager.
-
initCellEditor
protected void initCellEditor()
Description copied from class:DirectEditManagerExInitializes the cell editor. Subclasses should implement this to set the initial text and add things such asVerifyListeners, if needed.- Specified by:
initCellEditorin classDirectEditManagerEx
-
commit
protected void commit()
Description copied from class:DirectEditManagerExCommits the current value of the cell editor by getting aCommandfrom the source edit part and executing it via theCommandStack. Finally,DirectEditManagerEx.bringDown()is called to perform and necessary cleanup.- Overrides:
commitin classDirectEditManagerEx- See Also:
DirectEditManager.commit()
-
bringDown
protected void bringDown()
Description copied from class:DirectEditManagerExCleanup is done here. Any feedback is erased and listeners unhooked. If the cell editor is notnull, it will bedeativated,disposed, and set tonull.- Overrides:
bringDownin classDirectEditManagerEx- See Also:
DirectEditManager.bringDown()
-
setEditText
public void setEditText(String toEdit)
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:DirectEditManagerExShows the cell editor when direct edit is started. CallsDirectEditManagerEx.initCellEditor(),CellEditor.activate(), andDirectEditManagerEx.showFeedback().- Overrides:
showin classDirectEditManagerEx
-
show
public void show(Point location)
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:
hookListenersin classDirectEditManagerEx
-
unhookListeners
protected void unhookListeners()
Description copied from class:DirectEditManagerExUnhooks listeners. Called fromDirectEditManagerEx.bringDown().- Overrides:
unhookListenersin classDirectEditManagerEx
-
setCellEditor
protected void setCellEditor(CellEditor editor)
Description copied from class:DirectEditManagerExSets the cell editor to the given editor.- Overrides:
setCellEditorin classDirectEditManagerEx- Parameters:
editor- the cell editor
-
showFeedback
public void showFeedback()
Description copied from class:DirectEditManagerExAsks the source edit part to show source feedback.- Overrides:
showFeedbackin classDirectEditManagerEx
-
getCellEditorFrame
protected org.eclipse.draw2d.IFigure getCellEditorFrame()
Overridden to enlarge the cell editor frame for a control decorator- Overrides:
getCellEditorFramein classDirectEditManagerEx
-
getEditPart
protected IXtextAwareEditPart getEditPart()
Description copied from class:DirectEditManagerExReturns the source edit part.- Overrides:
getEditPartin classDirectEditManagerEx- Returns:
- the source edit part
-
getResourceManager
protected ResourceManager 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:
-
-