Class XtextDirectEditManager


  • public class XtextDirectEditManager
    extends DirectEditManagerEx
    Full copy of the TextDirectEditManager for a StyledText
    • Constructor Detail

      • XtextDirectEditManager

        public XtextDirectEditManager​(IXtextAwareEditPart source,
                                      com.google.inject.Injector injector,
                                      int style)
        constructor
        Parameters:
        source - GraphicalEditPart to support direct edit of. The figure of the source edit part must be of type WrapLabel.
      • 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 - the ITextAwareEditPart to determine the cell editor for
        Returns:
        the CellEditorLocator that is appropriate for the source EditPart
      • 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 an editorType was passed into the constructor.
        Overrides:
        createCellEditorOn in class DirectEditManagerEx
        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 Font that is scaled to the screen coordinates. Note: the returned Font should not be disposed since it is cached by a common resource manager.
      • commit

        protected void commit()
        Description copied from class: DirectEditManagerEx
        Commits the current value of the cell editor by getting a Command from the source edit part and executing it via the CommandStack. Finally, DirectEditManagerEx.bringDown() is called to perform and necessary cleanup.
        Overrides:
        commit in class DirectEditManagerEx
        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 not null, it will be deativated, disposed, and set to null.
        Overrides:
        bringDown in class DirectEditManagerEx
        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​(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 -
      • getCellEditorFrame

        protected org.eclipse.draw2d.IFigure getCellEditorFrame()
        Overridden to enlarge the cell editor frame for a control decorator
        Overrides:
        getCellEditorFrame in class DirectEditManagerEx
      • 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: