/** * <copyright> * </copyright> * * $Id: NewMenuEntryImpl.java,v 1.2 2011/02/11 14:16:05 cwaniek Exp $ */ package org.eclipse.uml2.diagram.codegen.u2tmap.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.uml2.diagram.codegen.u2tmap.NewMenuEntry; import org.eclipse.uml2.diagram.codegen.u2tmap.U2TMapPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>New Menu Entry</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.uml2.diagram.codegen.u2tmap.impl.NewMenuEntryImpl#getContainment <em>Containment</em>}</li> * <li>{@link org.eclipse.uml2.diagram.codegen.u2tmap.impl.NewMenuEntryImpl#getDisplayName <em>Display Name</em>}</li> * <li>{@link org.eclipse.uml2.diagram.codegen.u2tmap.impl.NewMenuEntryImpl#getChildren <em>Children</em>}</li> * </ul> * </p> * * @generated */ public class NewMenuEntryImpl extends AbstractNewMenuEntryImpl implements NewMenuEntry { /** * The cached value of the '{@link #getContainment() <em>Containment</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContainment() * @generated * @ordered */ protected EReference containment; /** * The default value of the '{@link #getDisplayName() <em>Display Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDisplayName() * @generated * @ordered */ protected static final String DISPLAY_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getDisplayName() <em>Display Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDisplayName() * @generated * @ordered */ protected String displayName = DISPLAY_NAME_EDEFAULT; /** * The cached value of the '{@link #getChildren() <em>Children</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getChildren() * @generated * @ordered */ protected EList<EClass> children; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected NewMenuEntryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return U2TMapPackage.Literals.NEW_MENU_ENTRY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getContainment() { if (containment != null && containment.eIsProxy()) { InternalEObject oldContainment = (InternalEObject)containment; containment = (EReference)eResolveProxy(oldContainment); if (containment != oldContainment) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT, oldContainment, containment)); } } return containment; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference basicGetContainment() { return containment; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setContainment(EReference newContainment) { EReference oldContainment = containment; containment = newContainment; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT, oldContainment, containment)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getDisplayName() { return displayName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDisplayName(String newDisplayName) { String oldDisplayName = displayName; displayName = newDisplayName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, U2TMapPackage.NEW_MENU_ENTRY__DISPLAY_NAME, oldDisplayName, displayName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<EClass> getChildren() { if (children == null) { children = new EObjectResolvingEList<EClass>(EClass.class, this, U2TMapPackage.NEW_MENU_ENTRY__CHILDREN); } return children; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT: if (resolve) return getContainment(); return basicGetContainment(); case U2TMapPackage.NEW_MENU_ENTRY__DISPLAY_NAME: return getDisplayName(); case U2TMapPackage.NEW_MENU_ENTRY__CHILDREN: return getChildren(); } 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 U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT: setContainment((EReference)newValue); return; case U2TMapPackage.NEW_MENU_ENTRY__DISPLAY_NAME: setDisplayName((String)newValue); return; case U2TMapPackage.NEW_MENU_ENTRY__CHILDREN: getChildren().clear(); getChildren().addAll((Collection<? extends EClass>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT: setContainment((EReference)null); return; case U2TMapPackage.NEW_MENU_ENTRY__DISPLAY_NAME: setDisplayName(DISPLAY_NAME_EDEFAULT); return; case U2TMapPackage.NEW_MENU_ENTRY__CHILDREN: getChildren().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case U2TMapPackage.NEW_MENU_ENTRY__CONTAINMENT: return containment != null; case U2TMapPackage.NEW_MENU_ENTRY__DISPLAY_NAME: return DISPLAY_NAME_EDEFAULT == null ? displayName != null : !DISPLAY_NAME_EDEFAULT.equals(displayName); case U2TMapPackage.NEW_MENU_ENTRY__CHILDREN: return children != null && !children.isEmpty(); } 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(" (displayName: "); result.append(displayName); result.append(')'); return result.toString(); } } //NewMenuEntryImpl