java.lang.Object
org.eclipse.graphiti.ui.internal.services.impl.GefService
All Implemented Interfaces:
IGefService

public class GefService extends Object implements IGefService
A collection of static helper methods regarding GEF.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Calculates and returns the size of the text ignoring any new line characters in the string.
    calculateTextSize(String text, Font font, boolean handleMultiline)
    Calculates and returns the size of the text.
    org.eclipse.draw2d.geometry.Point
    calculateTranslation(org.eclipse.gef.EditPart source, org.eclipse.gef.EditPart target)
    Returns the translation between the coordinate-systems of EditParts.
    org.eclipse.gef.EditPart
    findEditPartAt(org.eclipse.gef.EditPartViewer viewer, org.eclipse.draw2d.geometry.Point location, boolean includeConnections)
     
    org.eclipse.draw2d.geometry.Point
     
    org.eclipse.draw2d.geometry.Point
    getChopboxLocationOnBox(org.eclipse.draw2d.geometry.Point reference, org.eclipse.draw2d.geometry.Rectangle box)
    This method has to be kept in sync with ChopboxAnchorFixed.getLocation(Point).
    org.eclipse.draw2d.geometry.Point
     
    List<org.eclipse.gef.EditPart>
    getConnectionsContainedInEditPart(org.eclipse.gef.EditPart ep)
    Computes EditParts of the connections and related ConnectionDecorators which live inside the containment hierarchy of the given edit part.
    double
    getDistance(org.eclipse.draw2d.geometry.Point[] points)
     
    org.eclipse.draw2d.geometry.Point
    getDistantPoint(int startX, int startY, int endX, int endY, double distance)
     
    org.eclipse.draw2d.geometry.Point
    getDistantPoint(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double distance)
     
    List<org.eclipse.gef.EditPart>
    getEditPartChildren(org.eclipse.gef.EditPart editPart)
    Provides the direct children of the edit part.
    getLayoutConstraint(org.eclipse.gef.EditPart editPart)
    Returns the layout constraint for the given EditPart.
    org.eclipse.draw2d.geometry.Point
    getPointAt(int startX, int startY, int endX, int endY, double d)
     
    org.eclipse.draw2d.geometry.Point
    getPointAt(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double d)
     
    List<org.eclipse.gef.EditPart>
    getSelectedEditParts(org.eclipse.gef.EditPartViewer editPartViewer)
    Provides the selected edit parts of the viewer.
    List<org.eclipse.gef.GraphicalEditPart>
    getSourceConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
    Provides the source connections of the graphical edit part.
    List<org.eclipse.gef.GraphicalEditPart>
    getTargetConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
    Provides the target connections of the graphical edit part.
    void
    mirrorArray(org.eclipse.draw2d.geometry.Point[] draw2dPoints)
     
    void
    selectEditPart(org.eclipse.gef.EditPartViewer viewer, Object modelObject)
    Selects the EditPart for the given model Object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • GefService

      public GefService()
  • Method Details

    • selectEditPart

      public void selectEditPart(org.eclipse.gef.EditPartViewer viewer, Object modelObject)
      Description copied from interface: IGefService
      Selects the EditPart for the given model Object.
      Specified by:
      selectEditPart in interface IGefService
      Parameters:
      viewer - The viewer, which contains the EditParts.
      modelObject - The model Object, which EditPart to select.
    • calculateTranslation

      public org.eclipse.draw2d.geometry.Point calculateTranslation(org.eclipse.gef.EditPart source, org.eclipse.gef.EditPart target)
      Description copied from interface: IGefService
      Returns the translation between the coordinate-systems of EditParts. It will translate from the coordinate-system of the source EditPart to the coordinate-system of the target EditPart. Both EditParts must be an instance of GraphicalEditPart. Otherwise it throws an Exception.
      Specified by:
      calculateTranslation in interface IGefService
      Parameters:
      source - The EditPart with the source coordinate-system.
      target - The EditPart with the target coordinate-system.
      Returns:
      Returns the translation between the coordinate-systems of EditParts.
    • getLayoutConstraint

      public Object getLayoutConstraint(org.eclipse.gef.EditPart editPart)
      Description copied from interface: IGefService
      Returns the layout constraint for the given EditPart. It returns null, if the constraint can not be determined, for example because the child has no parent or the parent has no LayoutManager.
      Specified by:
      getLayoutConstraint in interface IGefService
      Parameters:
      editPart - The EditPart for which to return the layout constraint.
      Returns:
      Returns the layout constraint for the given EditPart.
    • findEditPartAt

      public org.eclipse.gef.EditPart findEditPartAt(org.eclipse.gef.EditPartViewer viewer, org.eclipse.draw2d.geometry.Point location, boolean includeConnections)
      Specified by:
      findEditPartAt in interface IGefService
      location - : the absolute location for the whole RootEditpart (if any, the scroll should be considered)
      Returns:
    • getConnectionsContainedInEditPart

      public List<org.eclipse.gef.EditPart> getConnectionsContainedInEditPart(org.eclipse.gef.EditPart ep)
      Description copied from interface: IGefService
      Computes EditParts of the connections and related ConnectionDecorators which live inside the containment hierarchy of the given edit part.
      Specified by:
      getConnectionsContainedInEditPart in interface IGefService
      Parameters:
      ep - the EditPart whose inner connection and ConnectionDecorators should be computed
    • getConnectionPointAt

      public org.eclipse.draw2d.geometry.Point getConnectionPointAt(Connection c, double d)
      Specified by:
      getConnectionPointAt in interface IGefService
      Returns:
    • getChopboxLocationOnBox

      public org.eclipse.draw2d.geometry.Point getChopboxLocationOnBox(org.eclipse.draw2d.geometry.Point reference, org.eclipse.draw2d.geometry.Rectangle box)
      Description copied from interface: IGefService
      This method has to be kept in sync with ChopboxAnchorFixed.getLocation(Point).
      Specified by:
      getChopboxLocationOnBox in interface IGefService
    • getAbsolutePointOnConnection

      public org.eclipse.draw2d.geometry.Point getAbsolutePointOnConnection(Connection c, double distance)
      Specified by:
      getAbsolutePointOnConnection in interface IGefService
      Returns:
    • getDistantPoint

      public org.eclipse.draw2d.geometry.Point getDistantPoint(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double distance)
      Specified by:
      getDistantPoint in interface IGefService
    • getDistantPoint

      public org.eclipse.draw2d.geometry.Point getDistantPoint(int startX, int startY, int endX, int endY, double distance)
      Specified by:
      getDistantPoint in interface IGefService
    • getPointAt

      public org.eclipse.draw2d.geometry.Point getPointAt(int startX, int startY, int endX, int endY, double d)
      Specified by:
      getPointAt in interface IGefService
      Returns:
    • getPointAt

      public org.eclipse.draw2d.geometry.Point getPointAt(org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end, double d)
      Specified by:
      getPointAt in interface IGefService
    • getDistance

      public double getDistance(org.eclipse.draw2d.geometry.Point[] points)
      Specified by:
      getDistance in interface IGefService
    • calculateTextSize

      public IDimension calculateTextSize(String text, Font font)
      Description copied from interface: IGefService
      Calculates and returns the size of the text ignoring any new line characters in the string.
      Specified by:
      calculateTextSize in interface IGefService
      Returns:
      the size of the text
      See Also:
    • calculateTextSize

      public IDimension calculateTextSize(String text, Font font, boolean handleMultiline)
      Description copied from interface: IGefService
      Calculates and returns the size of the text.
      Specified by:
      calculateTextSize in interface IGefService
      handleMultiline - Defines if line breaks in the string should be used in the calculation of the size or not. In case true, a new line character in the string will increase the size of the returned dimensions by one line, in case false a new line character will be ignored.
      Returns:
      the size of the text
    • mirrorArray

      public void mirrorArray(org.eclipse.draw2d.geometry.Point[] draw2dPoints)
      Specified by:
      mirrorArray in interface IGefService
    • getEditPartChildren

      public List<org.eclipse.gef.EditPart> getEditPartChildren(org.eclipse.gef.EditPart editPart)
      Description copied from interface: IGefService
      Provides the direct children of the edit part.
      Specified by:
      getEditPartChildren in interface IGefService
      Returns:
      the direct child edit parts
    • getSourceConnections

      public List<org.eclipse.gef.GraphicalEditPart> getSourceConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
      Description copied from interface: IGefService
      Provides the source connections of the graphical edit part.
      Specified by:
      getSourceConnections in interface IGefService
      Returns:
      the source connections of the graphical edit part
    • getTargetConnections

      public List<org.eclipse.gef.GraphicalEditPart> getTargetConnections(org.eclipse.gef.GraphicalEditPart graphicalEditPart)
      Description copied from interface: IGefService
      Provides the target connections of the graphical edit part.
      Specified by:
      getTargetConnections in interface IGefService
      Returns:
      the target connections of the graphical edit part
    • getSelectedEditParts

      public List<org.eclipse.gef.EditPart> getSelectedEditParts(org.eclipse.gef.EditPartViewer editPartViewer)
      Description copied from interface: IGefService
      Provides the selected edit parts of the viewer.
      Specified by:
      getSelectedEditParts in interface IGefService
      Returns:
      the selected edit parts of the viewer