/**
   * Builds a figure for the given edge and adds it to contents.
   *
   * @param contents the parent figure to add the edge to
   * @param edge the edge
   */
  private void buildEdgeFigure(final IFigure contents, final IEdge edge) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "Building edge from " + edge.getTail().getName() + " to " + edge.getHead().getName());
    }
    final DotRoute route = (DotRoute) edge.getAttr(POSITION_ATTR);

    String name = edge.getName();
    if ("".equals(name)) {
      name = null;
    }

    final PolylineConnection conn = addConnectionFromRoute(contents, name, route);

    if (edge.getAttr(DRAW2DFGCOLOR_ATTR) != null) {
      conn.setForegroundColor((Color) edge.getAttr(DRAW2DFGCOLOR_ATTR));
    }

    if (edge.getAttr(DRAW2DLINEWIDTH_ATTR) != null) {
      conn.setLineWidth(edge.getAttrInt(DRAW2DLINEWIDTH_ATTR));
    }

    final PolygonDecoration dec = new PolygonDecoration();
    conn.setTargetDecoration(dec);

    conn.setToolTip(new LinkTooltip(edge));
    conn.setCursor(Cursors.HAND);
  }