use of org.obeonetwork.dsl.environment.BindingReference in project InformationSystem by ObeoNetwork.
the class DeleteMappingCommand method doExecute.
@Override
protected void doExecute() {
if (bindingEdge.getTarget() != null && bindingEdge.getTarget() instanceof BindingReference) {
BindingReference bindingReference = (BindingReference) bindingEdge.getTarget();
Session session = SessionManager.INSTANCE.getSession(bindingReference);
ECrossReferenceAdapter crossReferencer = session.getSemanticCrossReferencer();
BindingElement left = bindingReference.getLeft();
BindingElement right = bindingReference.getRight();
if (hasNoOtherReference(left)) {
// Delete the useless element
accessor.eDelete(left, crossReferencer);
}
if (hasNoOtherReference(right)) {
// Delete the useless element
accessor.eDelete(right, crossReferencer);
} else {
}
accessor.eDelete(bindingReference, crossReferencer);
accessor.eDelete(bindingEdge, crossReferencer);
bindingEdge.setLeft(null);
bindingEdge.setRight(null);
} else {
EcoreUtil.delete(bindingEdge);
bindingEdge.setLeft(null);
bindingEdge.setRight(null);
}
}
use of org.obeonetwork.dsl.environment.BindingReference in project InformationSystem by ObeoNetwork.
the class BindingReferenceItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
String label = " ";
BindingReference bindingReference = (BindingReference) object;
if (bindingReference.getLeft() != null && bindingReference.getLeft().getBoundElement() != null) {
label += labelProvider.getText(bindingReference.getLeft().getBoundElement());
} else {
label += "undefined";
}
label += " - ";
if (bindingReference.getRight() != null && bindingReference.getRight().getBoundElement() != null) {
label += labelProvider.getText(bindingReference.getRight().getBoundElement());
} else {
label += "undefined";
}
return " ".equals(label) ? getString("_UI_BindingReference_type") : getString("_UI_BindingReference_type") + " " + label;
}
use of org.obeonetwork.dsl.environment.BindingReference in project InformationSystem by ObeoNetwork.
the class CreateMappingCommand method doExecute.
@Override
protected void doExecute() {
final BindingElement leftBindingElement = getOrCreateBindingElement(leftBoundElement);
final BindingElement rightBindingElement = getOrCreateBindingElement(rightBoundElement);
if (!areAlreadyBound(leftBindingElement, rightBindingElement)) {
BindingReference bindingReference = EnvironmentFactory.eINSTANCE.createBindingReference();
bindingReference.setLeft(leftBindingElement);
bindingReference.setRight(rightBindingElement);
bindingInfo.getReferences().add(bindingReference);
edge = BindingdialectFactory.eINSTANCE.createDBindingEdge();
edge.setTarget(bindingReference);
edge.setLeft(leftBoundElement);
edge.setRight(rightBoundElement);
}
}
use of org.obeonetwork.dsl.environment.BindingReference in project InformationSystem by ObeoNetwork.
the class TreeDataProvider method computeData.
public void computeData() {
edges = new ArrayList<DBindingEdge>();
leftRoot = BindingdialectFactory.eINSTANCE.createDBoundElement();
leftRoot.setTarget(bindingInfo.getLeft());
rightRoot = BindingdialectFactory.eINSTANCE.createDBoundElement();
rightRoot.setTarget(bindingInfo.getRight());
for (BindingReference bindingReference : bindingInfo.getReferences()) {
BindingElement leftBindingElement = bindingReference.getLeft();
BindingElement rightBindingElement = bindingReference.getRight();
List<BoundableElement> leftPathReferences = new ArrayList<BoundableElement>(leftBindingElement.getPathReferences());
leftPathReferences.add(leftBindingElement.getBoundElement());
DBoundElement leftBoundElement = getBoundElement(leftRoot, leftPathReferences);
List<BoundableElement> rightPathReferences = new ArrayList<BoundableElement>(rightBindingElement.getPathReferences());
rightPathReferences.add(rightBindingElement.getBoundElement());
DBoundElement rightBoundElement = getBoundElement(rightRoot, rightPathReferences);
DBindingEdge edge = BindingdialectFactory.eINSTANCE.createDBindingEdge();
edge.setTarget(bindingReference);
edge.setLeft(leftBoundElement);
edge.setRight(rightBoundElement);
edges.add(edge);
}
}
use of org.obeonetwork.dsl.environment.BindingReference in project InformationSystem by ObeoNetwork.
the class BindingReferenceBindingReferencePropertiesEditionComponent 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 BindingReference bindingReference = (BindingReference) elt;
final BindingReferencePropertiesEditionPart bindingReferencePart = (BindingReferencePropertiesEditionPart) editingPart;
// init values
if (isAccessible(EnvironmentViewsRepository.BindingReference.Properties.left)) {
bindingReferencePart.initLeft(EEFUtils.choiceOfValues(bindingReference, EnvironmentPackage.eINSTANCE.getBindingReference_Left()), bindingReference.getLeft());
}
if (isAccessible(EnvironmentViewsRepository.BindingReference.Properties.right)) {
bindingReferencePart.initRight(EEFUtils.choiceOfValues(bindingReference, EnvironmentPackage.eINSTANCE.getBindingReference_Right()), bindingReference.getRight());
}
if (isAccessible(EnvironmentViewsRepository.BindingReference.Properties.description))
bindingReferencePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, bindingReference.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);
}
Aggregations