コード例 #1
0
  @Override
  protected boolean isCompatibleMetaclass(Object containerElement, Object metaclass) {
    Element semanticElement = UMLUtil.resolveUMLElement(containerElement);

    if (semanticElement == null) {
      return false;
    }

    if (metaclass instanceof Stereotype) {
      Stereotype stereotype = (Stereotype) metaclass;
      boolean res = semanticElement.getAppliedStereotype(stereotype.getQualifiedName()) != null;
      if (!res) {
        EClass definition = stereotype.getDefinition();
        for (EObject e : semanticElement.getStereotypeApplications()) {
          EClass c = e.eClass();
          if (definition != null && definition.isSuperTypeOf(c)) {
            res = true;
            break;
          }
        }
      }
      return res;
    }

    // TODO : We should use super.isCompatibleMetaclass(), but the super-implementation
    // may not be compatible with our implementation of getAdaptedValue()
    if (metaclass instanceof EClassifier) {
      return ((EClassifier) metaclass).isInstance(semanticElement);
    }

    return false;
  }
コード例 #2
0
  public List<NavigableElement> getNavigableElements(Object fromElement) {
    List<NavigableElement> result = new LinkedList<NavigableElement>();

    Element element = UMLUtil.resolveUMLElement(fromElement);
    if (element instanceof CallBehaviorAction) {
      result.add(new CBANavigableElement(((CallBehaviorAction) element).getBehavior()));
    }
    return result;
  }
コード例 #3
0
 /** {@inheritDoc} */
 public Element getUMLElement(GraphicalEditPart editPart) {
   return UMLUtil.resolveUMLElement(editPart);
 }