blob: bf06274af037a9909af247bf8a75fb61b8bba2f6 [file] [log] [blame]
/**
* 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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas Bros (Mia-Software) - initial API and implementation
*
*
* $Id$
*/
package org.eclipse.gmt.modisco.infra.browser.custom.emf.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.infra.browser.custom.AttributeView;
import org.eclipse.gmt.modisco.infra.browser.custom.TypeView;
import org.eclipse.gmt.modisco.infra.browser.custom.emf.UicustomPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Attribute View</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.infra.browser.custom.emf.impl.AttributeViewImpl#getAttributeName <em>Attribute Name</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.infra.browser.custom.emf.impl.AttributeViewImpl#getType <em>Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
@SuppressWarnings("all")
public class AttributeViewImpl extends CustomViewImpl implements AttributeView {
/**
* The default value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeName()
* @generated
* @ordered
*/
protected static final String ATTRIBUTE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeName()
* @generated
* @ordered
*/
protected String attributeName = ATTRIBUTE_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AttributeViewImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return UicustomPackage.eINSTANCE.getAttributeView();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAttributeName() {
return attributeName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttributeName(String newAttributeName) {
String oldAttributeName = attributeName;
attributeName = newAttributeName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UicustomPackage.ATTRIBUTE_VIEW__ATTRIBUTE_NAME, oldAttributeName, attributeName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeView getType() {
if (eContainerFeatureID() != UicustomPackage.ATTRIBUTE_VIEW__TYPE) return null;
return (TypeView)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case UicustomPackage.ATTRIBUTE_VIEW__TYPE:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd, UicustomPackage.ATTRIBUTE_VIEW__TYPE, 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 UicustomPackage.ATTRIBUTE_VIEW__TYPE:
return eBasicSetContainer(null, UicustomPackage.ATTRIBUTE_VIEW__TYPE, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case UicustomPackage.ATTRIBUTE_VIEW__TYPE:
return eInternalContainer().eInverseRemove(this, UicustomPackage.TYPE_VIEW__ATTRIBUTES, TypeView.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UicustomPackage.ATTRIBUTE_VIEW__ATTRIBUTE_NAME:
return getAttributeName();
case UicustomPackage.ATTRIBUTE_VIEW__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UicustomPackage.ATTRIBUTE_VIEW__ATTRIBUTE_NAME:
setAttributeName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case UicustomPackage.ATTRIBUTE_VIEW__ATTRIBUTE_NAME:
setAttributeName(ATTRIBUTE_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UicustomPackage.ATTRIBUTE_VIEW__ATTRIBUTE_NAME:
return ATTRIBUTE_NAME_EDEFAULT == null ? attributeName != null : !ATTRIBUTE_NAME_EDEFAULT.equals(attributeName);
case UicustomPackage.ATTRIBUTE_VIEW__TYPE:
return getType() != 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(" (attributeName: ");
result.append(attributeName);
result.append(')');
return result.toString();
}
} //AttributeViewImpl