Commit 29458c24 authored by Simon Barner's avatar Simon Barner
Browse files

ComponentArchitectureTransformationBase.transform() Ensure that in...

ComponentArchitectureTransformationBase.transform() Ensure that in architectures derived from ComponentArchitectures, annotation are instantiated.

AnnotationUtils: Resurrect instantiateAnnotationsRecursive()
refs 3328
parent 1e2fe2a0
AngleUtils.java 6aaf8e974481e9bd5c0d813302c1f08d10d1c00d GREEN
AnnotationUtils.java 941cfdbc8c871da64f8e873ce50ed19c8f9c4b7e GREEN
AnnotationUtils.java 169d98287f1af1ace01b49f4ab0975e427a1263e YELLOW
BaseMathUtils.java 7d0e7113af72677b0a7e44fcc40e874624d3bee6 GREEN
BaseModelElementUtils.java fc0596156b9f5761759ab3a9974fe0302e9889e9 GREEN
ConstraintsBaseUtils.java ae80d8f4ad3b821b5025ef24ce34a4e6185cc67e GREEN
......
......@@ -16,6 +16,7 @@
package org.fortiss.tooling.base.utils;
import static org.fortiss.tooling.base.utils.BaseMathUtils.convertNumber;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getEClassForClass;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
......@@ -33,6 +34,7 @@ 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.IAnnotationValueService;
import org.fortiss.tooling.base.annotation.valueprovider.AnnotationInstSpec;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider;
......@@ -43,6 +45,7 @@ import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvide
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider.AnnotationActionParameters;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider.AnnotationActionReqInputParameter;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider.AnnotationActionReqInputParameters;
import org.fortiss.tooling.base.compose.HierarchicElementCompositorBase;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
......@@ -247,4 +250,23 @@ public class AnnotationUtils {
return new AnnotationAction<T>(randValuePropDescriptor, randomValuePropagation);
}
/**
* Recursively instantiates the annotations for a given {@link IModelElement} and its offspring.
* This is useful to ensure that all annotations are available for programmatically created
* models. While the {@link HierarchicElementCompositorBase} could be used to ensure the
* instantiation of annotations in model-transformations, too, this is not always possible (or
* convenient).
*
* @param element
* {@link IModelElement} for which annotations should be instantiated recursively.
*/
public static void instantiateAnnotationsRecursive(IModelElement element) {
IAnnotationValueService as = IAnnotationValueService.getInstance();
as.instantiateAnnotations(element);
for(IModelElement child : getChildrenWithType(element, IModelElement.class)) {
as.instantiateAnnotations(child);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment