[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.uml2] Re: Find stereotypes applicable to instances of EClass?
|
Hi Joel,
even though it looks quite the same, I post my solution here as well,
because I think such methods should make it into the eclipse UML API:
boolean isApplicableStereotype(EClass eClass, Stereotype stereotype)
{
for(Property attribute : stereotype.getAllAttributes())
{
if(attribute.getAssociation() instanceof Extension)
{
Type type = attribute.getType();
EClassifier eClassifier = UMLPackage.eINSTANCE
.getEClassifier(type.getName());
if(eClassifier instanceof EClass &&
((EClass) eClassifier).isSuperTypeOf(eClass))
{
return true;
}
}
}
return false;
}
It assumes the Stereotype is properly defined and is inspired by
ElementOperations.isApplicableStereotype.
Greetings to Paderborn from Kassel,
Christian