blob: bb68dc1c2e1b9e8d90aeaf57d6e6018f5053d326 [file] [log] [blame]
/**
* Copyright (c) 2015, 2018 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors: Obeo - initial API and implementation
*/
package org.eclipse.eef.impl;
import org.eclipse.eef.EEFTextConditionalStyle;
import org.eclipse.eef.EEFTextStyle;
import org.eclipse.eef.EefPackage;
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 Text Conditional Style</b></em>'. <!--
* end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.eef.impl.EEFTextConditionalStyleImpl#getStyle <em>Style</em>}</li>
* </ul>
*
* @generated
*/
public class EEFTextConditionalStyleImpl extends EEFConditionalStyleImpl implements EEFTextConditionalStyle {
/**
* The cached value of the '{@link #getStyle() <em>Style</em>}' containment reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getStyle()
* @generated
* @ordered
*/
protected EEFTextStyle style;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected EEFTextConditionalStyleImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return EefPackage.Literals.EEF_TEXT_CONDITIONAL_STYLE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EEFTextStyle getStyle() {
if (style != null && style.eIsProxy()) {
InternalEObject oldStyle = (InternalEObject) style;
style = (EEFTextStyle) eResolveProxy(oldStyle);
if (style != oldStyle) {
InternalEObject newStyle = (InternalEObject) style;
NotificationChain msgs = oldStyle.eInverseRemove(this,
InternalEObject.EOPPOSITE_FEATURE_BASE - EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE, null, null);
if (newStyle.eInternalContainer() == null) {
msgs = newStyle.eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE, null,
msgs);
}
if (msgs != null) {
msgs.dispatch();
}
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE, oldStyle, style));
}
}
}
return style;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EEFTextStyle basicGetStyle() {
return style;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetStyle(EEFTextStyle newStyle, NotificationChain msgs) {
EEFTextStyle oldStyle = style;
style = newStyle;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EefPackage.EEF_TEXT_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(EEFTextStyle newStyle) {
if (newStyle != style) {
NotificationChain msgs = null;
if (style != null) {
msgs = ((InternalEObject) style).eInverseRemove(this,
InternalEObject.EOPPOSITE_FEATURE_BASE - EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE, null, msgs);
}
if (newStyle != null) {
msgs = ((InternalEObject) newStyle).eInverseAdd(this,
InternalEObject.EOPPOSITE_FEATURE_BASE - EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE, null, msgs);
}
msgs = basicSetStyle(newStyle, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, EefPackage.EEF_TEXT_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 EefPackage.EEF_TEXT_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 EefPackage.EEF_TEXT_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 EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE:
setStyle((EEFTextStyle) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE:
setStyle((EEFTextStyle) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EefPackage.EEF_TEXT_CONDITIONAL_STYLE__STYLE:
return style != null;
}
return super.eIsSet(featureID);
}
} // EEFTextConditionalStyleImpl