use of org.obeonetwork.dsl.environment.Annotation in project InformationSystem by ObeoNetwork.
the class AnnotationHelper method getAnnotations.
public static Collection<Annotation> getAnnotations(ObeoDSMObject dsmObject, String name) {
Collection<Annotation> annotations = new ArrayList<Annotation>();
MetaDataContainer metaDataContainer = dsmObject.getMetadatas();
if (metaDataContainer != null) {
for (MetaData metaData : metaDataContainer.getMetadatas()) {
if (metaData instanceof Annotation) {
Annotation annotation = (Annotation) metaData;
if (name.equals(annotation.getTitle())) {
annotations.add(annotation);
}
}
}
}
return annotations;
}
use of org.obeonetwork.dsl.environment.Annotation in project InformationSystem by ObeoNetwork.
the class AnnotationHelper method getAllConstraints.
public static Collection<String> getAllConstraints(ObeoDSMObject dsmObject) {
Collection<String> constraints = new ArrayList<String>();
Collection<Annotation> constraintsAnnotations = getAllPhysicalCheckAnnotations(dsmObject);
for (Annotation constraintAnnotation : constraintsAnnotations) {
if (constraintAnnotation.getBody() != null && constraintAnnotation.getBody().trim().length() > 0) {
// Use the separator to check if several constraints were defined in this annotation
String[] definedConstraints = constraintAnnotation.getBody().split(CONSTRAINT_DELIMITER_REGEX);
for (String definedConstraint : definedConstraints) {
if (definedConstraint != null && definedConstraint.trim().length() > 0) {
constraints.add(definedConstraint);
}
}
}
}
return constraints;
}
use of org.obeonetwork.dsl.environment.Annotation in project InformationSystem by ObeoNetwork.
the class DocumentationLinkType method loadLinks.
/**
* {@inheritDoc}
* @see org.obeonetwork.tools.linker.LinkType#loadLinks(org.eclipse.emf.ecore.EObject)
*/
public List<EObjectLink> loadLinks(EObject source) {
if (source instanceof ObeoDSMObject) {
ObeoDSMObject element = (ObeoDSMObject) source;
MetaDataContainer metadatas = element.getMetadatas();
if (metadatas != null) {
List<EObjectLink> result = new ArrayList<EObjectLink>();
for (MetaData metadata : metadatas.getMetadatas()) {
if (metadata instanceof Annotation) {
Annotation annotation = (Annotation) metadata;
if (annotation.getTitle() != null && annotation.getTitle().startsWith(DocumentationLink.DOCUMENTATION_ANNOTATION_TITLE)) {
DocumentationLink link = new DocumentationLinkImpl(annotation);
result.add(link);
}
}
}
return result;
}
}
return Collections.emptyList();
}
use of org.obeonetwork.dsl.environment.Annotation in project InformationSystem by ObeoNetwork.
the class AnnotationPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final Annotation annotation = (Annotation) elt;
final AnnotationPropertiesEditionPart annotationPart = (AnnotationPropertiesEditionPart) editingPart;
// init values
if (isAccessible(EnvironmentViewsRepository.Annotation.Properties.title_))
annotationPart.setTitle_(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, annotation.getTitle()));
if (isAccessible(EnvironmentViewsRepository.Annotation.Properties.body))
annotationPart.setBody(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, annotation.getBody()));
// init filters
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations