/**
* Copyright (c) 2016 Obeo.
* 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.htm
* Contributors: Obeo - initial API and implementation
*/
package org.eclipse.eef.ext.widgets.reference.eefextwidgetsreference.impl;
import org.eclipse.eef.ext.widgets.reference.eefextwidgetsreference.EEFExtReferenceConditionalStyle;
import org.eclipse.eef.ext.widgets.reference.eefextwidgetsreference.EEFExtReferenceWidgetStyle;
import org.eclipse.eef.ext.widgets.reference.eefextwidgetsreference.EefExtWidgetsReferencePackage;
import org.eclipse.eef.impl.EEFConditionalStyleImpl;
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;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>EEF Ext Reference Conditional Style</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>
* {@link org.eclipse.eef.ext.widgets.reference.eefextwidgetsreference.impl.EEFExtReferenceConditionalStyleImpl#getStyle
* <em>Style</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EEFExtReferenceConditionalStyleImpl extends EEFConditionalStyleImpl implements EEFExtReferenceConditionalStyle {
/**
* The cached value of the '{@link #getStyle() <em>Style</em>}' containment reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getStyle()
* @generated
* @ordered
*/
protected EEFExtReferenceWidgetStyle style;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected EEFExtReferenceConditionalStyleImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return EefExtWidgetsReferencePackage.Literals.EEF_EXT_REFERENCE_CONDITIONAL_STYLE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EEFExtReferenceWidgetStyle getStyle() {
if (style != null && style.eIsProxy()) {
InternalEObject oldStyle = (InternalEObject) style;
style = (EEFExtReferenceWidgetStyle) eResolveProxy(oldStyle);
if (style != oldStyle) {
InternalEObject newStyle = (InternalEObject) style;
NotificationChain msgs = oldStyle.eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE
- EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, null, null);
if (newStyle.eInternalContainer() == null) {
msgs = newStyle.eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE
- EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, null, msgs);
}
if (msgs != null) {
msgs.dispatch();
}
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, oldStyle, style));
}
}
}
return style;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EEFExtReferenceWidgetStyle basicGetStyle() {
return style;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetStyle(EEFExtReferenceWidgetStyle newStyle, NotificationChain msgs) {
EEFExtReferenceWidgetStyle oldStyle = style;
style = newStyle;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, oldStyle, newStyle);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setStyle(EEFExtReferenceWidgetStyle newStyle) {
if (newStyle != style) {
NotificationChain msgs = null;
if (style != null) {
msgs = ((InternalEObject) style).eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE
- EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, null, msgs);
}
if (newStyle != null) {
msgs = ((InternalEObject) newStyle).eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE
- EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, null, msgs);
}
msgs = basicSetStyle(newStyle, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE, newStyle,
newStyle));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE:
return basicSetStyle(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 EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE:
if (resolve) {
return getStyle();
}
return basicGetStyle();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE:
setStyle((EEFExtReferenceWidgetStyle) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE:
setStyle((EEFExtReferenceWidgetStyle) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EefExtWidgetsReferencePackage.EEF_EXT_REFERENCE_CONDITIONAL_STYLE__STYLE:
return style != null;
}
return super.eIsSet(featureID);
}
} // EEFExtReferenceConditionalStyleImpl