/**
  * Computes actual grid specification (origin + single cell width and height) in the absolute
  * coordinate system. Note, in contrast to {@link #getRelativeGridSpec(EditPartViewer)} this
  * specification depends on the active zoom or scroll and can't be cached by clients.
  *
  * @param viewer
  * @return absolute grid specification, or <code>null</code> if grid is not enabled
  */
 public static PrecisionRectangle getAbsoluteGridSpec(EditPartViewer viewer) {
   PrecisionRectangle spec = getRelativeGridSpec(viewer);
   if (spec != null) {
     GraphicalEditPart diagramEP = (GraphicalEditPart) viewer.getContents();
     diagramEP.getContentPane().translateToAbsolute(spec);
   }
   return spec;
 }
  /**
   * Always returns the same instance to avoid endless creation
   *
   * @return active grid specification in absolute coordinates or <code>null</code> if not enabled
   */
  public PrecisionRectangle getAbsoluteGridSpec() {
    PrecisionRectangle result = getRelativeGridSpec();
    if (result == null) {
      return null;
    }

    if (myAbsoluteGridSpec == null) {
      myAbsoluteGridSpec = new PrecisionRectangle();
    }
    myAbsoluteGridSpec.setPreciseBounds(
        result.preciseX(), result.preciseY(), result.preciseWidth(), result.preciseHeight());
    GraphicalEditPart diagramEP = (GraphicalEditPart) myViewer.getContents();
    diagramEP.getContentPane().translateToAbsolute(myAbsoluteGridSpec);

    return myAbsoluteGridSpec;
  }
 /*
  * (non-Javadoc)
  * @see
  * org.eclipse.gef.editpolicies.XYLayoutEditPolicy#getMinimumSizeFor(org
  * .eclipse.gef.GraphicalEditPart)
  */
 @Override
 protected Dimension getMinimumSizeFor(final GraphicalEditPart child) {
   return child.getContentPane().getMinimumSize();
 }