/** * @see org.andromda.metafacades.uml.ModelElementFacade#getStereotypes() */ @Override protected Collection<Stereotype> handleGetStereotypes() { return this.metaObject.getAppliedStereotypes(); }
/** * @see org.andromda.metafacades.uml.StateVertexFacade#getStateMachine() */ @Override protected Element handleGetStateMachine() { Element owner = this.metaObject; while (!(owner instanceof StateMachine)) { owner = owner.getOwner(); } return owner; }
Stereotype foundStereotype = element.getAppliedStereotype(name); if (foundStereotype == null) final EList<Stereotype> stereotypes = element.getAppliedStereotypes(); if (stereotypes != null)
public static Object getTaggedValue(Element element, String qualifiedStereotypeName, String propertyName) { Stereotype stereotype = element .getAppliedStereotype(qualifiedStereotypeName); return stereotype == null ? null : element.getValue(stereotype, propertyName); }
protected static Element getOwningElement(Element element, EClass eClass, boolean resolve) { Element owningElement = null; for (Element owner = element; ((owningElement = (Element) owner.eGet( UMLPackage.Literals.ELEMENT__OWNER, resolve)) == null ? owner = owningElement = getBaseElement(owner.eContainer()) : owningElement) != null && !(eClass.isInstance(owningElement));) { owner = owner.getOwner(); } return owningElement; }
/** * Find the Model of a resource (UML2 Model) * @param element * @return (Model)EcoreUtil.getObjectByType(resource.getContents(), EcorePackage.eINSTANCE.getEObject()) */ public static Package findModel(final Element element) { if (element==null) { return null; } Package modelPackage = element.getModel(); if (modelPackage==null) { if (LOGGER.isDebugEnabled()) { LOGGER.error("getModel was null: " + element + " OWNER: " + element.getOwner()); } Element classifierOwner = element.getOwner(); Element owner = null; while (classifierOwner!=null) { owner = classifierOwner; classifierOwner = owner.getOwner(); } // Find the last owner in the chain... Top level package. modelPackage = (Package) owner; } return modelPackage; }
final Collection<Stereotype> stereotypes = element.getAppliedStereotypes(); for (final Stereotype stereo : stereotypes) final List tagNames = (List)element.getValue( stereo, "TagName"); final List tagValues = (List)element.getValue( stereo, "TagValue"); else if (element.hasValue( stereo, "value")) final Object value = element.getValue( stereo, "value"); if (!tagName.startsWith("base$") && element.hasValue(stereo, tagName)) final Object tagValue = element.getValue(stereo, tagName); if (tagValue instanceof Collection)
/** * @see org.andromda.metafacades.uml.ModelElementFacade#getPackage() */ @Override protected Package handleGetPackage() { return this.metaObject.getNearestPackage(); }
/** * Get the comments for a UML Element. This will be a string with each * comment separated by a 2 newlines. * * @param element * @return concatenated string */ public static String getComment(final Element element) { if (element==null) { return null; } final StringBuilder commentString = new StringBuilder(); final Collection<Comment> comments = element.getOwnedComments(); for (final Comment comment : comments) { if (commentString.length()>0) { commentString.append("\n\n"); } commentString.append(comment.getBody()); } return cleanText(commentString.toString()); }
.getStereotypeApplication(stereotype); .getNearestPackage(); .isStereotypeRequired(stereotype) ? element.getStereotypeApplication(stereotype) : element.applyStereotype(stereotype);
for (Element element : elements) { EList<Stereotype> stereotypes = element.getAppliedStereotypes(); for (Stereotype stereotype : stereotypes) { if (stereotype.getName().equals(STEREOTYPE_SOURCEDIRECTORY)) { if (element.eClass().getName().equals(TYPE_ENUM)) { generateEnum(element);
Stereotype foundStereotype = element.getApplicableStereotype(name); if (foundStereotype == null) final EList<Stereotype> stereotypes = element.getApplicableStereotypes(); if (stereotypes != null)
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Elements that must be owned must have an owner. * self.mustBeOwned() implies owner->notEmpty() * @param element The receiving '<em><b>Element</b></em>' model object. * @param diagnostics The chain of diagnostics to which problems are to be appended. * @param context The cache of context-specific information. * <!-- end-model-doc --> * @generated NOT */ public static boolean validateHasOwner(Element element, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = true; if (element.mustBeOwned() && element.getOwner() == null) { result = false; if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, UMLValidator.DIAGNOSTIC_SOURCE, UMLValidator.ELEMENT__HAS_OWNER, UMLPlugin.INSTANCE .getString("_UI_Element_HasOwner_diagnostic", //$NON-NLS-1$ getMessageSubstitutions(context, element)), new Object[]{element})); } } return result; }
protected static EList<Element> allOwnedElements(Element element, EList<Element> allOwnedElements) { for (Element ownedElement : element.getOwnedElements()) { if (allOwnedElements.add(ownedElement)) { allOwnedElements(ownedElement, allOwnedElements); } } return allOwnedElements; }
/** * Obtains the UML metaclass of the specified model element. The specified * element must be in a resource set, otherwise the UML metamodel is not * available. * * @param element an element in a UML model * @return the element's metaclass, or <code>null</code> if the element is * not in a resource set */ public static Class getMetaclass(Element element) { Class result = null; ResourceSet rset = null; Resource res = element.eResource(); if (res != null) { rset = res.getResourceSet(); } if (rset != null) { result = (Class) getClassifier(element.eClass(), rset); } return result; }
protected Stereotype getAppliedEcoreStereotype(Element element, String name) { return element.getAppliedStereotype("Ecore" //$NON-NLS-1$ + NamedElement.SEPARATOR + name); }
for (EReference eReference : element.eClass().getEAllReferences()) { if (!eReference.isDerived() && element.eIsSet(eReference)) { EClass eReferenceType = eReference.getEReferenceType(); @SuppressWarnings("unchecked") List<Relationship> values = (List<Relationship>) element .eGet(eReference); relationships.addAll(values); } else { relationships.add((Relationship) element .eGet(eReference)); Object value = element.eGet(eReference);
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Retrieves the stereotype with the specified qualified name that is applicable to this element, or null if no such stereotype is applicable. * @param element The receiving '<em><b>Element</b></em>' model object. * @param qualifiedName The qualified name of the applicable stereotype to retrieve. * <!-- end-model-doc --> * @generated NOT */ public static Stereotype getApplicableStereotype(Element element, String qualifiedName) { for (Stereotype applicableStereotype : element .getApplicableStereotypes()) { if (safeEquals(applicableStereotype.getQualifiedName(), qualifiedName)) { return applicableStereotype; } } return null; }
final Collection<Stereotype> stereotypes = element.getAppliedStereotypes(); for (final Stereotype stereo : stereotypes) final List tagNames = (List)element.getValue( stereo, "TagName"); final List tagValues = (List)element.getValue( stereo, "TagValue"); else if (element.hasValue( stereo, "value")) final Object value = element.getValue( stereo, "value"); if (!tagName.startsWith("base$") && element.hasValue(stereo, tagName)) final Object tagValue = element.getValue(stereo, tagName); if (tagValue instanceof Collection)