/******************************************************************************* * Copyright (c) 2001, 2009 IBM Corporation 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: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.wst.dtd.core.internal.emf.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.wst.dtd.core.internal.emf.DTDElement; import org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent; import org.eclipse.wst.dtd.core.internal.emf.DTDPackage; /** * @generated */ public class DTDElementReferenceContentImpl extends DTDRepeatableContentImpl implements DTDElementReferenceContent { /** * @generated This field/method will be replaced during code generation. */ /** * @generated This field/method will be replaced during code generation. */ protected DTDElement referencedElement; public DTDElementReferenceContentImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return DTDPackage.Literals.DTD_ELEMENT_REFERENCE_CONTENT; } public String unparseRepeatableContent() { return getContentName(); } public String getContentName() { DTDElement e = getReferencedElement(); if (e == null) return ""; //$NON-NLS-1$ return e.getName(); } /** * @generated This field/method will be replaced during code generation */ public DTDElement getReferencedElement() { if (referencedElement != null && referencedElement.eIsProxy()) { InternalEObject oldReferencedElement = (InternalEObject)referencedElement; referencedElement = (DTDElement)eResolveProxy(oldReferencedElement); if (referencedElement != oldReferencedElement) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); } } return referencedElement; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public DTDElement basicGetReferencedElement() { return referencedElement; } /** * @generated This field/method will be replaced during code generation. */ public void setReferencedElement(DTDElement newReferencedElement) { DTDElement oldReferencedElement = referencedElement; referencedElement = newReferencedElement; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT: if (resolve) return getReferencedElement(); return basicGetReferencedElement(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT: setReferencedElement((DTDElement)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT: setReferencedElement((DTDElement)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case DTDPackage.DTD_ELEMENT_REFERENCE_CONTENT__REFERENCED_ELEMENT: return referencedElement != null; } return super.eIsSet(featureID); } }