Search in sources :

Example 1 with BindingInfo

use of org.obeonetwork.dsl.environment.BindingInfo 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 2 with BindingInfo

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

the class BindingService method getRelatedBindingInfos.

private Collection<BindingInfo> getRelatedBindingInfos(StructuredType structuredType) {
    EObjectQuery query = new EObjectQuery(structuredType);
    Collection<EObject> targets = new HashSet<EObject>();
    targets.addAll(query.getInverseReferences(EnvironmentPackage.Literals.BINDING_INFO__LEFT));
    targets.addAll(query.getInverseReferences(EnvironmentPackage.Literals.BINDING_INFO__RIGHT));
    Collection<BindingInfo> bindingInfos = new ArrayList<BindingInfo>();
    for (EObject target : targets) {
        if (target instanceof BindingInfo) {
            bindingInfos.add((BindingInfo) target);
        }
    }
    return bindingInfos;
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) EObject(org.eclipse.emf.ecore.EObject) BindingInfo(org.obeonetwork.dsl.environment.BindingInfo) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 3 with BindingInfo

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

the class BindingService method getAllBindableElements.

public Collection<StructuredType> getAllBindableElements(DSemanticDiagram diagram, StructuredType structuredType) {
    // Collect all structured types
    Collection<StructuredType> bindableElements = new ArrayList<StructuredType>();
    // First get all structured types
    bindableElements.addAll(getAllStructuredTypes(structuredType));
    // Remove the target element
    bindableElements.remove(structuredType);
    // Remove elements already bound with the target
    for (BindingInfo bindingInfo : getAllBindingInfosOnDiagram(diagram)) {
        if (bindingInfo.getLeft() == structuredType) {
            bindableElements.remove(bindingInfo.getRight());
        }
        if (bindingInfo.getRight() == structuredType) {
            bindableElements.remove(bindingInfo.getLeft());
        }
    }
    return bindableElements;
}
Also used : BindingInfo(org.obeonetwork.dsl.environment.BindingInfo) ArrayList(java.util.ArrayList) StructuredType(org.obeonetwork.dsl.environment.StructuredType)

Example 4 with BindingInfo

use of org.obeonetwork.dsl.environment.BindingInfo 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)

Example 5 with BindingInfo

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

the class BindingInfoBindingInfoPropertiesEditionComponent 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 BindingInfo bindingInfo = (BindingInfo) elt;
        final BindingInfoPropertiesEditionPart bindingInfoPart = (BindingInfoPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.left)) {
            bindingInfoPart.initLeft(EEFUtils.choiceOfValues(bindingInfo, EnvironmentPackage.eINSTANCE.getBindingInfo_Left()), bindingInfo.getLeft());
        }
        if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.right)) {
            bindingInfoPart.initRight(EEFUtils.choiceOfValues(bindingInfo, EnvironmentPackage.eINSTANCE.getBindingInfo_Right()), bindingInfo.getRight());
        }
        if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.description))
            bindingInfoPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, bindingInfo.getDescription()));
    // init filters
    // Start of user code for additional businessfilters for left
    // End of user code
    // Start of user code for additional businessfilters for right
    // End of user code
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : BindingInfoPropertiesEditionPart(org.obeonetwork.dsl.environment.parts.BindingInfoPropertiesEditionPart) BindingInfo(org.obeonetwork.dsl.environment.BindingInfo)

Aggregations

BindingInfo (org.obeonetwork.dsl.environment.BindingInfo)6 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 BindingRegistry (org.obeonetwork.dsl.environment.BindingRegistry)2 StructuredType (org.obeonetwork.dsl.environment.StructuredType)2 HashSet (java.util.HashSet)1 EObject (org.eclipse.emf.ecore.EObject)1 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)1 BoundableElement (org.obeonetwork.dsl.environment.BoundableElement)1 Type (org.obeonetwork.dsl.environment.Type)1 BindingInfoPropertiesEditionPart (org.obeonetwork.dsl.environment.parts.BindingInfoPropertiesEditionPart)1