/** | |
* ******************************************************************************* | |
* Copyright (c) 2009 Mia-Software. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* | |
* Fabien Giquel (Mia-Software) - initial API and implementation | |
* Gregoire DUPE (Mia-Software) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.modisco.java.nousages.impl; | |
import java.util.Collection; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.common.notify.NotificationChain; | |
import org.eclipse.emf.common.util.EList; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.java.Archive; | |
import org.eclipse.modisco.java.ClassFile; | |
import org.eclipse.modisco.java.ImportDeclaration; | |
import org.eclipse.modisco.java.Manifest; | |
import org.eclipse.modisco.java.nousages.meta.JavaPackage; | |
/** | |
* <!-- begin-user-doc --> An implementation of the model object ' | |
* <em><b>Archive</b></em>'. <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li> | |
* {@link org.eclipse.modisco.java.nousages.impl.ArchiveImpl#getOriginalFilePath | |
* <em>Original File Path</em>}</li> | |
* <li> | |
* {@link org.eclipse.modisco.java.nousages.impl.ArchiveImpl#getClassFiles | |
* <em>Class Files</em>}</li> | |
* <li> | |
* {@link org.eclipse.modisco.java.nousages.impl.ArchiveImpl#getManifest | |
* <em>Manifest</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class ArchiveImpl extends NamedElementImpl implements Archive { | |
/** | |
* The default value of the '{@link #getOriginalFilePath() | |
* <em>Original File Path</em>}' attribute. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @see #getOriginalFilePath() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String ORIGINAL_FILE_PATH_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getOriginalFilePath() | |
* <em>Original File Path</em>}' attribute. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @see #getOriginalFilePath() | |
* @generated | |
* @ordered | |
*/ | |
protected String originalFilePath = ORIGINAL_FILE_PATH_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getClassFiles() <em>Class Files</em>}' | |
* containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @see #getClassFiles() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<ClassFile> classFiles; | |
/** | |
* The cached value of the '{@link #getManifest() <em>Manifest</em>}' | |
* containment reference. <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @see #getManifest() | |
* @generated | |
* @ordered | |
*/ | |
protected Manifest manifest; | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
protected ArchiveImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return JavaPackage.eINSTANCE.getArchive(); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public String getOriginalFilePath() { | |
return originalFilePath; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public void setOriginalFilePath(String newOriginalFilePath) { | |
String oldOriginalFilePath = originalFilePath; | |
originalFilePath = newOriginalFilePath; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, | |
JavaPackage.ARCHIVE__ORIGINAL_FILE_PATH, | |
oldOriginalFilePath, originalFilePath)); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public EList<ClassFile> getClassFiles() { | |
if (classFiles == null) { | |
classFiles = new EObjectContainmentEList<ClassFile>( | |
ClassFile.class, this, JavaPackage.ARCHIVE__CLASS_FILES); | |
} | |
return classFiles; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public Manifest getManifest() { | |
return manifest; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public NotificationChain basicSetManifest(Manifest newManifest, | |
NotificationChain msgs) { | |
Manifest oldManifest = manifest; | |
manifest = newManifest; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, | |
Notification.SET, JavaPackage.ARCHIVE__MANIFEST, | |
oldManifest, newManifest); | |
if (msgs == null) | |
msgs = notification; | |
else | |
msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public void setManifest(Manifest newManifest) { | |
if (newManifest != manifest) { | |
NotificationChain msgs = null; | |
if (manifest != null) | |
msgs = ((InternalEObject) manifest).eInverseRemove(this, | |
EOPPOSITE_FEATURE_BASE - JavaPackage.ARCHIVE__MANIFEST, | |
null, msgs); | |
if (newManifest != null) | |
msgs = ((InternalEObject) newManifest).eInverseAdd(this, | |
EOPPOSITE_FEATURE_BASE - JavaPackage.ARCHIVE__MANIFEST, | |
null, msgs); | |
msgs = basicSetManifest(newManifest, msgs); | |
if (msgs != null) | |
msgs.dispatch(); | |
} else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, | |
JavaPackage.ARCHIVE__MANIFEST, newManifest, newManifest)); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, | |
int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case JavaPackage.ARCHIVE__CLASS_FILES: | |
return ((InternalEList<?>) getClassFiles()).basicRemove(otherEnd, | |
msgs); | |
case JavaPackage.ARCHIVE__MANIFEST: | |
return basicSetManifest(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 JavaPackage.ARCHIVE__ORIGINAL_FILE_PATH: | |
return getOriginalFilePath(); | |
case JavaPackage.ARCHIVE__CLASS_FILES: | |
return getClassFiles(); | |
case JavaPackage.ARCHIVE__MANIFEST: | |
return getManifest(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case JavaPackage.ARCHIVE__ORIGINAL_FILE_PATH: | |
setOriginalFilePath((String) newValue); | |
return; | |
case JavaPackage.ARCHIVE__CLASS_FILES: | |
getClassFiles().clear(); | |
getClassFiles().addAll((Collection<? extends ClassFile>) newValue); | |
return; | |
case JavaPackage.ARCHIVE__MANIFEST: | |
setManifest((Manifest) newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case JavaPackage.ARCHIVE__ORIGINAL_FILE_PATH: | |
setOriginalFilePath(ORIGINAL_FILE_PATH_EDEFAULT); | |
return; | |
case JavaPackage.ARCHIVE__CLASS_FILES: | |
getClassFiles().clear(); | |
return; | |
case JavaPackage.ARCHIVE__MANIFEST: | |
setManifest((Manifest) null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case JavaPackage.ARCHIVE__ORIGINAL_FILE_PATH: | |
return ORIGINAL_FILE_PATH_EDEFAULT == null ? originalFilePath != null | |
: !ORIGINAL_FILE_PATH_EDEFAULT.equals(originalFilePath); | |
case JavaPackage.ARCHIVE__CLASS_FILES: | |
return classFiles != null && !classFiles.isEmpty(); | |
case JavaPackage.ARCHIVE__MANIFEST: | |
return manifest != 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(" (originalFilePath: "); //$NON-NLS-1$ | |
result.append(originalFilePath); | |
result.append(')'); | |
return result.toString(); | |
} | |
public EList<ImportDeclaration> getUsagesInImports() { | |
// no usage references | |
return null; | |
} | |
} // ArchiveImpl |