| /** |
| * Copyright (c) 2010, 2012 Ericsson |
| * |
| * 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 |
| * |
| * Description: |
| * |
| * Contributors: |
| * Alvaro Sanchez-Leon - Initial API and implementation |
| * |
| */ |
| package org.eclipse.mylyn.reviews.r4e.core.model.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.mylyn.reviews.internal.core.model.Location; |
| import org.eclipse.mylyn.reviews.r4e.core.model.R4EContent; |
| import org.eclipse.mylyn.reviews.r4e.core.model.R4EPosition; |
| import org.eclipse.mylyn.reviews.r4e.core.model.RModelPackage; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>R4E Content</b></em>'. <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.R4EContentImpl#getLocation <em>Location</em>}</li> |
| * <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.R4EContentImpl#getInfo <em>Info</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class R4EContentImpl extends Location implements R4EContent { |
| /** |
| * The cached value of the '{@link #getLocation() <em>Location</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLocation() |
| * @generated |
| * @ordered |
| */ |
| protected R4EPosition location; |
| |
| /** |
| * The default value of the '{@link #getInfo() <em>Info</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getInfo() |
| * @generated |
| * @ordered |
| */ |
| protected static final String INFO_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getInfo() <em>Info</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getInfo() |
| * @generated |
| * @ordered |
| */ |
| protected String info = INFO_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected R4EContentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return RModelPackage.Literals.R4E_CONTENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public R4EPosition getLocation() { |
| if (location != null && location.eIsProxy()) { |
| InternalEObject oldLocation = (InternalEObject)location; |
| location = (R4EPosition)eResolveProxy(oldLocation); |
| if (location != oldLocation) { |
| InternalEObject newLocation = (InternalEObject)location; |
| NotificationChain msgs = oldLocation.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_CONTENT__LOCATION, null, null); |
| if (newLocation.eInternalContainer() == null) { |
| msgs = newLocation.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_CONTENT__LOCATION, null, msgs); |
| } |
| if (msgs != null) msgs.dispatch(); |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, RModelPackage.R4E_CONTENT__LOCATION, oldLocation, location)); |
| } |
| } |
| return location; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public R4EPosition basicGetLocation() { |
| return location; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetLocation(R4EPosition newLocation, NotificationChain msgs) { |
| R4EPosition oldLocation = location; |
| location = newLocation; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_CONTENT__LOCATION, oldLocation, newLocation); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setLocation(R4EPosition newLocation) { |
| if (newLocation != location) { |
| NotificationChain msgs = null; |
| if (location != null) |
| msgs = ((InternalEObject)location).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_CONTENT__LOCATION, null, msgs); |
| if (newLocation != null) |
| msgs = ((InternalEObject)newLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_CONTENT__LOCATION, null, msgs); |
| msgs = basicSetLocation(newLocation, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_CONTENT__LOCATION, newLocation, newLocation)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getInfo() { |
| return info; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setInfo(String newInfo) { |
| String oldInfo = info; |
| info = newInfo; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_CONTENT__INFO, oldInfo, info)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case RModelPackage.R4E_CONTENT__LOCATION: |
| return basicSetLocation(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 RModelPackage.R4E_CONTENT__LOCATION: |
| if (resolve) return getLocation(); |
| return basicGetLocation(); |
| case RModelPackage.R4E_CONTENT__INFO: |
| return getInfo(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case RModelPackage.R4E_CONTENT__LOCATION: |
| setLocation((R4EPosition)newValue); |
| return; |
| case RModelPackage.R4E_CONTENT__INFO: |
| setInfo((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case RModelPackage.R4E_CONTENT__LOCATION: |
| setLocation((R4EPosition)null); |
| return; |
| case RModelPackage.R4E_CONTENT__INFO: |
| setInfo(INFO_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case RModelPackage.R4E_CONTENT__LOCATION: |
| return location != null; |
| case RModelPackage.R4E_CONTENT__INFO: |
| return INFO_EDEFAULT == null ? info != null : !INFO_EDEFAULT.equals(info); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (info: "); |
| result.append(info); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //R4EContentImpl |