| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.ecview.core.common.model.core.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.osbp.ecview.core.common.model.binding.impl.YValueBindingEndpointImpl; |
| import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage; |
| import org.eclipse.osbp.ecview.core.common.model.core.YElement; |
| import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint; |
| import org.eclipse.osbp.ecview.core.common.model.core.YValueBindable; |
| import org.eclipse.osbp.ecview.core.common.model.core.util.BindingIdUtil; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' |
| * <em><b>YEmbeddable Value Endpoint</b></em>'. <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YEmbeddableValueEndpointImpl#getElement <em>Element</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class YEmbeddableValueEndpointImpl extends YValueBindingEndpointImpl |
| implements YEmbeddableValueEndpoint { |
| /** |
| * The cached value of the '{@link #getElement() <em>Element</em>}' reference. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @see #getElement() |
| * @generated |
| * @ordered |
| */ |
| protected YValueBindable element; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected YEmbeddableValueEndpointImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CoreModelPackage.Literals.YEMBEDDABLE_VALUE_ENDPOINT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public YValueBindable getElement() { |
| if (element != null && element.eIsProxy()) { |
| InternalEObject oldElement = (InternalEObject)element; |
| element = (YValueBindable)eResolveProxy(oldElement); |
| if (element != oldElement) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT, oldElement, element)); |
| } |
| } |
| return element; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public YValueBindable basicGetElement() { |
| return element; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetElement(YValueBindable newElement, |
| NotificationChain msgs) { |
| YValueBindable oldElement = element; |
| element = newElement; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT, oldElement, newElement); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setElement(YValueBindable newElement) { |
| if (newElement != element) { |
| NotificationChain msgs = null; |
| if (element != null) |
| msgs = ((InternalEObject)element).eInverseRemove(this, CoreModelPackage.YVALUE_BINDABLE__VALUE_BINDING_ENDPOINT, YValueBindable.class, msgs); |
| if (newElement != null) |
| msgs = ((InternalEObject)newElement).eInverseAdd(this, CoreModelPackage.YVALUE_BINDABLE__VALUE_BINDING_ENDPOINT, YValueBindable.class, msgs); |
| msgs = basicSetElement(newElement, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT, newElement, newElement)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| if (element != null) |
| msgs = ((InternalEObject)element).eInverseRemove(this, CoreModelPackage.YVALUE_BINDABLE__VALUE_BINDING_ENDPOINT, YValueBindable.class, msgs); |
| return basicSetElement((YValueBindable)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| return basicSetElement(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| if (resolve) return getElement(); |
| return basicGetElement(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| setElement((YValueBindable)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| setElement((YValueBindable)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CoreModelPackage.YEMBEDDABLE_VALUE_ENDPOINT__ELEMENT: |
| return element != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| public boolean isBindsElement(YElement element) { |
| return element == getElement(); |
| } |
| |
| @Override |
| public String getBindingIdString() { |
| |
| if (!(getElement() instanceof YElement)) { |
| throw new IllegalArgumentException( |
| "not a valid element to create a binding id string"); |
| } |
| |
| YElement yElement = (YElement) getElement(); |
| return BindingIdUtil.getEmbeddableValueId(yElement.getId()); |
| } |
| |
| } // YEmbeddableValueEndpointImpl |