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);
}
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();
}
}
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;
}
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;
}
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;
}
Aggregations