Skip to content
Snippets Groups Projects
Commit 0eca68c3 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Annotations: Add util method to get IAnnotationValueProviders.

* Useful to retrieve values, labels etc. 

Issue-Ref: 3209
Issue-Url: https://af3-developer.fortiss.org/issues/3209


Signed-off-by: default avatarAlexander Diewald <diewald@fortiss.org>
parent 28295c7e
No related branches found
No related tags found
1 merge request!43209 javafx
AngleUtils.java 462551eae71738ff51f92c9906bff9a21a375d2b GREEN
AnnotationUtils.java 51072e0c39c83fc5695db76ffaaa430c2ce51508 GREEN
AnnotationUtils.java 8381bc9190df78f69add1164b974a6cbaae09678 RED
BaseMathUtils.java d680e6f41a8986e5fb696fe303b16548108cf78b GREEN
BaseModelElementUtils.java b8775b7a462efc168cf79a017aa3377a782d10f6 GREEN
ConstraintsBaseUtils.java ef6a1178df614fc03bbdec64d4d15b1565ae8551 GREEN
......
......@@ -34,6 +34,8 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.fortiss.tooling.base.ToolingBaseActivator;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.AnnotationValueService;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.annotation.valueprovider.AnnotationInstSpec;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
......@@ -138,6 +140,22 @@ public class AnnotationUtils {
return getAnnotationInternal(modelElement, clazz);
}
/**
* Returns the {@link IAnnotationValueProvider} of the given {@code annotationType}.
*
* @param element
* {@link IModelElement} to which an annotation of the given type is bound (required
* by the service).
* @param annotationType
* Annotation type.
* @return The corresponding value provider or {@code null} if none is found.
*/
public static IAnnotationValueProvider<IAnnotatedSpecification> getAnnotationValueProvider(
IModelElement element, Class<IAnnotatedSpecification> annotationType) {
AnnotationEntry annEntry = AnnotationValueService.getInstance().getAnnotationEntry(element);
return annEntry.getAnnotationValueProvider(annotationType);
}
/**
* Returns all {@link IAnnotatedSpecification}s attached to the given {@link IModelElement}.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment