Search in sources :

Example 6 with DBoundElement

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

the class BindingGroupDetails method setBoundElements.

public void setBoundElements(Set<DBoundElement> boundElements) {
    this.boundElements = boundElements;
    for (BoundElementComposite composite : composites) {
        composite.remove();
    }
    composites.clear();
    if (this.boundElements.isEmpty()) {
        composites.add(new NoBoundElementComposite(group, LBL_EMPTY_SELECTION));
    } else {
        for (DBoundElement boundElement : boundElements) {
            composites.add(new BoundElementComposite(group, boundElement));
        }
    }
    group.layout(true);
}
Also used : DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 7 with DBoundElement

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

the class BindingTreeEditor method autoBind.

private void autoBind() {
    TreeRoot leftRoot = (TreeRoot) treeMapper.getLeftTreeViewer().getInput();
    DBoundElement leftRootElement = leftRoot.getElement();
    TreeRoot rightRoot = (TreeRoot) treeMapper.getRightTreeViewer().getInput();
    DBoundElement rightRootElement = rightRoot.getElement();
    // collect candidates to auto bind
    List<DBoundElement> leftCandidates = new ArrayList<DBoundElement>();
    for (DBoundElement leftItem : leftRootElement.getChildren()) {
        if (leftItem.getEdgesAsLeft().isEmpty()) {
            leftCandidates.add(leftItem);
        }
    }
    List<DBoundElement> rightCandidates = new ArrayList<DBoundElement>();
    for (DBoundElement rightItem : rightRootElement.getChildren()) {
        if (rightItem.getEdgesAsRight().isEmpty()) {
            rightCandidates.add(rightItem);
        }
    }
    List<DBoundElement> leftElementsToBind = new ArrayList<DBoundElement>();
    List<DBoundElement> rightElementsToBind = new ArrayList<DBoundElement>();
    while (leftCandidates.isEmpty() == false && rightCandidates.isEmpty() == false) {
        DBoundElement left = leftCandidates.remove(0);
        for (DBoundElement right : rightCandidates) {
            if (getPropertyLabel(left.getTarget()).equals(getPropertyLabel(right.getTarget()))) {
                leftElementsToBind.add(left);
                rightElementsToBind.add(right);
                rightCandidates.remove(right);
                break;
            }
        }
    }
    if (leftElementsToBind.size() > 0) {
        editorManager.execute(new CreateMappingsCommand(getEditingDomain(), getBindingInfo(), leftElementsToBind, rightElementsToBind));
        doRefresh();
    }
}
Also used : CreateMappingsCommand(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.commands.CreateMappingsCommand) TreeRoot(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.TreeRoot) ArrayList(java.util.ArrayList) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 8 with DBoundElement

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

the class DBindingEdgeImpl method basicSetRight.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetRight(DBoundElement newRight, NotificationChain msgs) {
    DBoundElement oldRight = right;
    right = newRight;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BindingdialectPackage.DBINDING_EDGE__RIGHT, oldRight, newRight);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 9 with DBoundElement

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

the class DBoundElementImpl method basicSetParent.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetParent(DBoundElement newParent, NotificationChain msgs) {
    DBoundElement oldParent = parent;
    parent = newParent;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BindingdialectPackage.DBOUND_ELEMENT__PARENT, oldParent, newParent);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 10 with DBoundElement

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

the class TreeDataProvider method getBoundElement.

private DBoundElement getBoundElement(DBoundElement root, List<BoundableElement> path) {
    List<BoundableElement> remainingPath = new ArrayList<BoundableElement>(path);
    BoundableElement currentTarget = remainingPath.remove(0);
    if (EcoreUtil.equals(currentTarget, root.getTarget())) {
        if (remainingPath.isEmpty()) {
            return root;
        } else {
            return getBoundElementWithinChildren((DBoundElement[]) contentProvider.getChildren(root), remainingPath);
        }
    }
    return null;
}
Also used : BoundableElement(org.obeonetwork.dsl.environment.BoundableElement) ArrayList(java.util.ArrayList) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Aggregations

DBoundElement (org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)11 ArrayList (java.util.ArrayList)5 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 BoundableElement (org.obeonetwork.dsl.environment.BoundableElement)3 TreeRoot (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.TreeRoot)3 DBindingEdge (org.obeonetwork.dsl.environment.bindingdialect.DBindingEdge)3 TreeDataProvider (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.provider.TreeDataProvider)2 Collection (java.util.Collection)1 EObject (org.eclipse.emf.ecore.EObject)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SashForm (org.eclipse.swt.custom.SashForm)1 GridData (org.eclipse.swt.layout.GridData)1 BindingElement (org.obeonetwork.dsl.environment.BindingElement)1 BindingReference (org.obeonetwork.dsl.environment.BindingReference)1 BindingTreeMapper (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeMapper)1 BindingTreeSemanticSupport (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeSemanticSupport)1 CreateMappingsCommand (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.commands.CreateMappingsCommand)1