示例#1
0
 /**
  * this method returns the shape image that represents the first applied stereotype.
  *
  * @param elt the stereotyped element
  * @return {@link image} of the shape
  */
 public static Image getShapeElement(Element elt) {
   // getStereotypeImage can return null
   org.eclipse.uml2.uml.Image shape = ElementUtil.getStereotypeImage(elt, "shape");
   if (shape != null) {
     return getImageInRegistry(shape, null);
   } else {
     return null;
   }
 }
示例#2
0
  /** get the imageassociated to a image uml element * */
  public static Image getShape(
      Element elt, Stereotype stereotype, boolean withVisibilityDecorator) {

    VisibilityKind vis = null;
    if ((elt instanceof NamedElement) && (withVisibilityDecorator)) {

      vis = ((NamedElement) elt).getVisibility();
    }

    // getStereotypeImage can return null
    org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(elt, stereotype, "shape");
    if (icon != null) {
      return getImageInRegistry(icon, vis);
    } else {
      return null;
    }
  }
示例#3
0
  /**
   * this method returns the collection of icon images that represents the applied stereotypes.
   *
   * @param elt the stereotyped element
   * @param stereotypes the collection of stereotypes which icon has to be displayed
   * @param kind the kind of display "icon" or "shape"
   * @return {@link image} of the icon
   */
  public static Collection<Image> getIconElements(
      Element elt, Collection<Stereotype> stereotypes, boolean withVisibilityDecorator) {
    Collection<Image> images = new ArrayList<Image>();
    VisibilityKind vis = null;
    if ((elt instanceof NamedElement) && (withVisibilityDecorator)) {
      vis = ((NamedElement) elt).getVisibility();
    }

    // look in each stereotype and get the image for each of them
    for (Stereotype stereotype : stereotypes) {
      // getStereotypeImage can return null
      org.eclipse.uml2.uml.Image icon = ElementUtil.getStereotypeImage(elt, stereotype, "icon");
      if (icon != null) {
        images.add(getImageInRegistry(icon, vis));
      }
    }
    return images;
  }