/*******************************************************************************
* Copyright © 2008, 2013 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.edt.ide.ui.internal.formatting.profile.impl;
import java.util.Collection;
import org.eclipse.edt.ide.ui.internal.formatting.profile.Group;
import org.eclipse.edt.ide.ui.internal.formatting.profile.Preference;
import org.eclipse.edt.ide.ui.internal.formatting.profile.ProfilePackage;
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.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Group</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.GroupImpl#getPref <em>Pref</em>}</li>
* <li>{@link org.eclipse.edt.ide.ui.internal.formatting.profile.impl.GroupImpl#getDisplay <em>Display</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GroupImpl extends EObjectImpl implements Group {
/**
* The cached value of the '{@link #getPref() <em>Pref</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPref()
* @generated
* @ordered
*/
protected EList pref = null;
/**
* The default value of the '{@link #getDisplay() <em>Display</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplay()
* @generated
* @ordered
*/
protected static final String DISPLAY_EDEFAULT = null;
/**
* The cached value of the '{@link #getDisplay() <em>Display</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplay()
* @generated
* @ordered
*/
protected String display = DISPLAY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GroupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return ProfilePackage.Literals.GROUP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getPref() {
if (pref == null) {
pref = new EObjectContainmentEList(Preference.class, this, ProfilePackage.GROUP__PREF);
}
return pref;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDisplay() {
return display;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDisplay(String newDisplay) {
String oldDisplay = display;
display = newDisplay;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProfilePackage.GROUP__DISPLAY, oldDisplay, display));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProfilePackage.GROUP__PREF:
return ((InternalEList)getPref()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ProfilePackage.GROUP__PREF:
return getPref();
case ProfilePackage.GROUP__DISPLAY:
return getDisplay();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProfilePackage.GROUP__PREF:
getPref().clear();
getPref().addAll((Collection)newValue);
return;
case ProfilePackage.GROUP__DISPLAY:
setDisplay((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case ProfilePackage.GROUP__PREF:
getPref().clear();
return;
case ProfilePackage.GROUP__DISPLAY:
setDisplay(DISPLAY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProfilePackage.GROUP__PREF:
return pref != null && !pref.isEmpty();
case ProfilePackage.GROUP__DISPLAY:
return DISPLAY_EDEFAULT == null ? display != null : !DISPLAY_EDEFAULT.equals(display);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (display: ");
result.append(display);
result.append(')');
return result.toString();
}
} //GroupImpl