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