| /******************************************************************************* |
| * Copyright (c) 2009, 2015 Xored Software Inc and others. |
| * 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: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.ecl.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.EObject; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.rcptt.ecl.core.Command; |
| import org.eclipse.rcptt.ecl.core.CorePackage; |
| import org.eclipse.rcptt.ecl.core.With; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>With</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.ecl.core.impl.WithImpl#getObject <em>Object</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.core.impl.WithImpl#getDo <em>Do</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class WithImpl extends CommandImpl implements With { |
| /** |
| * The cached value of the '{@link #getObject() <em>Object</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getObject() |
| * @generated |
| * @ordered |
| */ |
| protected EObject object; |
| |
| /** |
| * The cached value of the '{@link #getDo() <em>Do</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDo() |
| * @generated |
| * @ordered |
| */ |
| protected Command do_; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected WithImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CorePackage.Literals.WITH; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject getObject() { |
| return object; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetObject(EObject newObject, NotificationChain msgs) { |
| EObject oldObject = object; |
| object = newObject; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CorePackage.WITH__OBJECT, oldObject, newObject); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setObject(EObject newObject) { |
| if (newObject != object) { |
| NotificationChain msgs = null; |
| if (object != null) |
| msgs = ((InternalEObject)object).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CorePackage.WITH__OBJECT, null, msgs); |
| if (newObject != null) |
| msgs = ((InternalEObject)newObject).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CorePackage.WITH__OBJECT, null, msgs); |
| msgs = basicSetObject(newObject, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.WITH__OBJECT, newObject, newObject)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Command getDo() { |
| return do_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetDo(Command newDo, NotificationChain msgs) { |
| Command oldDo = do_; |
| do_ = newDo; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CorePackage.WITH__DO, oldDo, newDo); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDo(Command newDo) { |
| if (newDo != do_) { |
| NotificationChain msgs = null; |
| if (do_ != null) |
| msgs = ((InternalEObject)do_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CorePackage.WITH__DO, null, msgs); |
| if (newDo != null) |
| msgs = ((InternalEObject)newDo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CorePackage.WITH__DO, null, msgs); |
| msgs = basicSetDo(newDo, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.WITH__DO, newDo, newDo)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case CorePackage.WITH__OBJECT: |
| return basicSetObject(null, msgs); |
| case CorePackage.WITH__DO: |
| return basicSetDo(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 CorePackage.WITH__OBJECT: |
| return getObject(); |
| case CorePackage.WITH__DO: |
| return getDo(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CorePackage.WITH__OBJECT: |
| setObject((EObject)newValue); |
| return; |
| case CorePackage.WITH__DO: |
| setDo((Command)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CorePackage.WITH__OBJECT: |
| setObject((EObject)null); |
| return; |
| case CorePackage.WITH__DO: |
| setDo((Command)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CorePackage.WITH__OBJECT: |
| return object != null; |
| case CorePackage.WITH__DO: |
| return do_ != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //WithImpl |