blob: de93e138774f9aee43c61d297beda69d37cd4bbc [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 Mia-Software.
* 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:
* Frederic Madiot (Mia-Software) - initial API and implementation
*******************************************************************************/
package org.eclipse.modisco.manifest.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.emf.ecore.impl.EObjectImpl;
import org.eclipse.modisco.manifest.ManifestPackage;
import org.eclipse.modisco.manifest.RequiredBundle;
import org.eclipse.modisco.manifest.Version;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Required Bundle</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.modisco.manifest.impl.RequiredBundleImpl#getSymbolicName <em>Symbolic Name</em>}</li>
* <li>{@link org.eclipse.modisco.manifest.impl.RequiredBundleImpl#getVersion <em>Version</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class RequiredBundleImpl extends EObjectImpl implements RequiredBundle {
/**
* The default value of the '{@link #getSymbolicName() <em>Symbolic Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSymbolicName()
* @generated
* @ordered
*/
protected static final String SYMBOLIC_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getSymbolicName() <em>Symbolic Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSymbolicName()
* @generated
* @ordered
*/
protected String symbolicName = SYMBOLIC_NAME_EDEFAULT;
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected Version version;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RequiredBundleImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ManifestPackage.Literals.REQUIRED_BUNDLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSymbolicName() {
return symbolicName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSymbolicName(String newSymbolicName) {
String oldSymbolicName = symbolicName;
symbolicName = newSymbolicName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ManifestPackage.REQUIRED_BUNDLE__SYMBOLIC_NAME, oldSymbolicName, symbolicName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Version getVersion() {
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVersion(Version newVersion, NotificationChain msgs) {
Version oldVersion = version;
version = newVersion;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ManifestPackage.REQUIRED_BUNDLE__VERSION, oldVersion, newVersion);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(Version newVersion) {
if (newVersion != version) {
NotificationChain msgs = null;
if (version != null)
msgs = ((InternalEObject)version).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ManifestPackage.REQUIRED_BUNDLE__VERSION, null, msgs);
if (newVersion != null)
msgs = ((InternalEObject)newVersion).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ManifestPackage.REQUIRED_BUNDLE__VERSION, null, msgs);
msgs = basicSetVersion(newVersion, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ManifestPackage.REQUIRED_BUNDLE__VERSION, newVersion, newVersion));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ManifestPackage.REQUIRED_BUNDLE__VERSION:
return basicSetVersion(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 ManifestPackage.REQUIRED_BUNDLE__SYMBOLIC_NAME:
return getSymbolicName();
case ManifestPackage.REQUIRED_BUNDLE__VERSION:
return getVersion();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ManifestPackage.REQUIRED_BUNDLE__SYMBOLIC_NAME:
setSymbolicName((String)newValue);
return;
case ManifestPackage.REQUIRED_BUNDLE__VERSION:
setVersion((Version)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ManifestPackage.REQUIRED_BUNDLE__SYMBOLIC_NAME:
setSymbolicName(SYMBOLIC_NAME_EDEFAULT);
return;
case ManifestPackage.REQUIRED_BUNDLE__VERSION:
setVersion((Version)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ManifestPackage.REQUIRED_BUNDLE__SYMBOLIC_NAME:
return SYMBOLIC_NAME_EDEFAULT == null ? symbolicName != null : !SYMBOLIC_NAME_EDEFAULT.equals(symbolicName);
case ManifestPackage.REQUIRED_BUNDLE__VERSION:
return version != null;
}
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(" (symbolicName: ");
result.append(symbolicName);
result.append(')');
return result.toString();
}
} //RequiredBundleImpl