示例#1
0
 public boolean renderObject(Comment element, IndentedPrintWriter out, IRenderingSession context) {
   if (!context.getSettings().getBoolean(UML2DOTPreferences.SHOW_COMMENTS)) return false;
   String commentNodeId = "comment_" + UML2DOTRenderingUtils.getXMIID(element);
   out.println('"' + commentNodeId + "\" [shape=note,label=\"" + element.getBody() + "\"]");
   for (Element commented : element.getAnnotatedElements()) {
     out.print(
         "\""
             + ((NamedElement) commented).getName()
             + "\":port"
             + " -- \""
             + commentNodeId
             + "\"");
     out.println("[");
     out.enterLevel();
     DOTRenderingUtils.addAttribute(out, "head", "none");
     DOTRenderingUtils.addAttribute(out, "tail", "none");
     DOTRenderingUtils.addAttribute(out, "constraint", Boolean.TRUE.toString());
     DOTRenderingUtils.addAttribute(out, "arrowtail", "none");
     DOTRenderingUtils.addAttribute(out, "arrowhead", "none");
     DOTRenderingUtils.addAttribute(out, "style", "solid");
     out.exitLevel();
     out.println("]");
   }
   return true;
 }
示例#2
0
  public void DealComment(org.eclipse.uml2.uml.Comment c1, RefOntoUML.Comment c2) {
    // ProcessComments (c1);
    System.out.println("// " + c1.getBody() + " ");

    // body
    c2.setBody(c1.getBody());
    // annotatedElements
    for (org.eclipse.uml2.uml.Element a1 : c1.getAnnotatedElements()) {
      RefOntoUML.Element a2 = GetElement(a1);
      c2.getAnnotatedElement().add(a2);
    }

    RelateElements(c1, c2);
  }
  /**
   * Gets the owned comments.
   *
   * @param source the source
   * @return the owned comments
   */
  private static List<Comment> getOwnedComments(EObject source) {
    List<Comment> result = new LinkedList<Comment>();

    if (source instanceof Element) {

      EList<Comment> allOwnedComments = ((Element) source).getOwnedComments();

      // Filter owned comments list
      for (Comment comment : allOwnedComments) {
        if (!comment.getAnnotatedElements().contains(source)) {
          result.add(comment);
        }
      }
    }

    return result;
  }
 /** @generated */
 public boolean canCreateCommentAnnotatedElement_4010(Comment source, Element target) {
   if (source != null) {
     if (source.getAnnotatedElements().contains(target)) {
       return false;
     }
   }
   return canExistCommentAnnotatedElement_4010(source, target);
 }
示例#5
0
 public static String getDocumentationText(Element umlElement) {
   if (!umlElement.getOwnedComments().isEmpty()) {
     return umlElement.getOwnedComments().get(0).getBody();
   }
   EAnnotation topcasedDocAnnotation =
       umlElement.getEAnnotation("http://www.topcased.org/documentation");
   if (topcasedDocAnnotation != null) {
     return topcasedDocAnnotation.getDetails().get("documentation");
   }
   for (EObject obj :
       EcoreUtil2.findAllByType(umlElement.getModel().eAllContents(), Comment.class)) {
     Comment c = (Comment) obj;
     for (EObject annotatedObject : c.getAnnotatedElements()) {
       if (annotatedObject == umlElement) {
         return c.getBody();
       }
     }
   }
   return null;
 }
 public String getText(Comment comment) {
   return "Test_" + comment.getBody();
 }