/** | |
* 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: | |
* Fabien Giquel (Mia-Software) - initial API and implementation | |
* Nicolas Guyomar (Mia-Software) - initial API and implementation | |
* | |
*/ | |
package org.eclipse.modisco.java.composition.javaapplication.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.gmt.modisco.java.CompilationUnit; | |
import org.eclipse.modisco.java.composition.javaapplication.Java2Directory; | |
import org.eclipse.modisco.java.composition.javaapplication.Java2File; | |
import org.eclipse.modisco.java.composition.javaapplication.JavaapplicationPackage; | |
import org.eclipse.modisco.kdm.source.extension.impl.CodeUnit2FileImpl; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Java2 File</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.java.composition.javaapplication.impl.Java2FileImpl#getJavaUnit <em>Java Unit</em>}</li> | |
* <li>{@link org.eclipse.modisco.java.composition.javaapplication.impl.Java2FileImpl#getParent <em>Parent</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class Java2FileImpl extends CodeUnit2FileImpl implements Java2File { | |
/** | |
* The cached value of the '{@link #getParent() <em>Parent</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getParent() | |
* @generated | |
* @ordered | |
*/ | |
protected Java2Directory parent; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected Java2FileImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return JavaapplicationPackage.Literals.JAVA2_FILE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public CompilationUnit getJavaUnit() { | |
CompilationUnit javaUnit = basicGetJavaUnit(); | |
return javaUnit != null && javaUnit.eIsProxy() ? (CompilationUnit)eResolveProxy((InternalEObject)javaUnit) : javaUnit; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated NOT | |
*/ | |
public CompilationUnit basicGetJavaUnit() { | |
return (CompilationUnit) this.getUnit(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Java2Directory getParent() { | |
if (parent != null && parent.eIsProxy()) { | |
InternalEObject oldParent = (InternalEObject)parent; | |
parent = (Java2Directory)eResolveProxy(oldParent); | |
if (parent != oldParent) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaapplicationPackage.JAVA2_FILE__PARENT, oldParent, parent)); | |
} | |
} | |
return parent; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Java2Directory basicGetParent() { | |
return parent; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetParent(Java2Directory newParent, NotificationChain msgs) { | |
Java2Directory oldParent = parent; | |
parent = newParent; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaapplicationPackage.JAVA2_FILE__PARENT, oldParent, newParent); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setParent(Java2Directory newParent) { | |
if (newParent != parent) { | |
NotificationChain msgs = null; | |
if (parent != null) | |
msgs = ((InternalEObject)parent).eInverseRemove(this, JavaapplicationPackage.JAVA2_DIRECTORY__JAVA2_FILE_CHILDREN, Java2Directory.class, msgs); | |
if (newParent != null) | |
msgs = ((InternalEObject)newParent).eInverseAdd(this, JavaapplicationPackage.JAVA2_DIRECTORY__JAVA2_FILE_CHILDREN, Java2Directory.class, msgs); | |
msgs = basicSetParent(newParent, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaapplicationPackage.JAVA2_FILE__PARENT, newParent, newParent)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case JavaapplicationPackage.JAVA2_FILE__PARENT: | |
if (parent != null) | |
msgs = ((InternalEObject)parent).eInverseRemove(this, JavaapplicationPackage.JAVA2_DIRECTORY__JAVA2_FILE_CHILDREN, Java2Directory.class, msgs); | |
return basicSetParent((Java2Directory)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 JavaapplicationPackage.JAVA2_FILE__PARENT: | |
return basicSetParent(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 JavaapplicationPackage.JAVA2_FILE__JAVA_UNIT: | |
if (resolve) return getJavaUnit(); | |
return basicGetJavaUnit(); | |
case JavaapplicationPackage.JAVA2_FILE__PARENT: | |
if (resolve) return getParent(); | |
return basicGetParent(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case JavaapplicationPackage.JAVA2_FILE__PARENT: | |
setParent((Java2Directory)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case JavaapplicationPackage.JAVA2_FILE__PARENT: | |
setParent((Java2Directory)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case JavaapplicationPackage.JAVA2_FILE__JAVA_UNIT: | |
return basicGetJavaUnit() != null; | |
case JavaapplicationPackage.JAVA2_FILE__PARENT: | |
return parent != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //Java2FileImpl |