How to retrieve list of all stereotypes i defined for a specific type of elements inside a project?

Hi guys,
Is it possible to retrieve a list of all stereotypes that i defined for a specific type of elements inside a project ?
for example all stereotypes of Usecases in a project.

You may get all stereotypes and check its .baseType == UseCase

like this:

String lSpecifiedModelType = IModelElementFactory.MODEL_TYPE_USE_CASE;

Collection<IStereotype> lSpecifiedStereotypes = new ArrayList<IStereotype>();

IProject lProject = ApplicationManager.instance().getProjectManager().getProject();
IModelElement[] lStereotypes = lProject.toAllLevelModelElementArray(IModelElementFactory.MODEL_TYPE_STEREOTYPE);
if (lStereotypes != null) {
	for (IModelElement lStereotype : lStereotypes) {
		if (lSpecifiedModelType.equals(((IStereotype) lStereotype).getBaseType())) {
			lSpecifiedStereotypes.add((IStereotype) lStereotype);
		}
	}
}

return lSpecifiedStereotypes;
1 Like

thank you :pray: