Search in sources :

Example 1 with BindingRegistry

use of org.obeonetwork.dsl.environment.BindingRegistry in project InformationSystem by ObeoNetwork.

the class BindingService method getBindingRegistry.

public BindingRegistry getBindingRegistry(Namespace namespace) {
    if (namespace.getBindingRegistries().isEmpty()) {
        BindingRegistry bindingRegistry = EnvironmentFactory.eINSTANCE.createBindingRegistry();
        namespace.getBindingRegistries().add(bindingRegistry);
        namespace.eResource().getContents().add(bindingRegistry);
        return bindingRegistry;
    } else {
        return namespace.getBindingRegistries().get(0);
    }
}
Also used : BindingRegistry(org.obeonetwork.dsl.environment.BindingRegistry)

Example 2 with BindingRegistry

use of org.obeonetwork.dsl.environment.BindingRegistry in project InformationSystem by ObeoNetwork.

the class CinematicBindingServices method getGlobalBindingRegistry.

private BindingRegistry getGlobalBindingRegistry(CinematicElement element) {
    CinematicRoot root = getCinematicRoot(element);
    if (root != null) {
        if (root.getBindingRegistries().isEmpty()) {
            BindingRegistry bindingRegistry = EnvironmentFactory.eINSTANCE.createBindingRegistry();
            root.getBindingRegistries().add(bindingRegistry);
            root.eResource().getContents().add(bindingRegistry);
            return bindingRegistry;
        } else {
            return root.getBindingRegistries().get(0);
        }
    }
    return null;
}
Also used : BindingRegistry(org.obeonetwork.dsl.environment.BindingRegistry) CinematicRoot(org.obeonetwork.dsl.cinematic.CinematicRoot)

Example 3 with BindingRegistry

use of org.obeonetwork.dsl.environment.BindingRegistry in project InformationSystem by ObeoNetwork.

the class CinematicBindingServices method createCinematicBindingInfo.

public BindingInfo createCinematicBindingInfo(AbstractViewElement viewElement, EObject boundElement) {
    if (boundElement instanceof BoundableElement) {
        BoundableElement target = (BoundableElement) boundElement;
        BindingRegistry bindingRegistry = getGlobalBindingRegistry(viewElement);
        BindingInfo newBindingInfo = EnvironmentFactory.eINSTANCE.createBindingInfo();
        newBindingInfo.setLeft(viewElement);
        newBindingInfo.setRight(target);
        bindingRegistry.getBindingInfos().add(newBindingInfo);
        return newBindingInfo;
    }
    return null;
}
Also used : BoundableElement(org.obeonetwork.dsl.environment.BoundableElement) BindingRegistry(org.obeonetwork.dsl.environment.BindingRegistry) BindingInfo(org.obeonetwork.dsl.environment.BindingInfo)

Example 4 with BindingRegistry

use of org.obeonetwork.dsl.environment.BindingRegistry in project InformationSystem by ObeoNetwork.

the class BindingService method getRelatedBindingInfos.

public Collection<BindingInfo> getRelatedBindingInfos(Namespace namespace) {
    // Use of LinkedHashSet to keep order and avoid potential lock/unlock
    // loops problems
    Set<BindingInfo> results = new LinkedHashSet<BindingInfo>();
    for (BindingRegistry bindingRegistry : namespace.getBindingRegistries()) {
        results.addAll(bindingRegistry.getBindingInfos());
    }
    for (Type containedType : namespace.getTypes()) {
        if (containedType instanceof StructuredType) {
            StructuredType containedStructuredType = (StructuredType) containedType;
            results.addAll(getRelatedBindingInfos(containedStructuredType));
        }
    }
    return results;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) StructuredType(org.obeonetwork.dsl.environment.StructuredType) Type(org.obeonetwork.dsl.environment.Type) BindingInfo(org.obeonetwork.dsl.environment.BindingInfo) BindingRegistry(org.obeonetwork.dsl.environment.BindingRegistry) StructuredType(org.obeonetwork.dsl.environment.StructuredType)

Aggregations

BindingRegistry (org.obeonetwork.dsl.environment.BindingRegistry)4 BindingInfo (org.obeonetwork.dsl.environment.BindingInfo)2 LinkedHashSet (java.util.LinkedHashSet)1 CinematicRoot (org.obeonetwork.dsl.cinematic.CinematicRoot)1 BoundableElement (org.obeonetwork.dsl.environment.BoundableElement)1 StructuredType (org.obeonetwork.dsl.environment.StructuredType)1 Type (org.obeonetwork.dsl.environment.Type)1