/** * 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.html * * Contributors: * Obeo - initial API and implementation * */ package org.eclipse.sirius.properties.impl; import java.util.Collection; 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.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.properties.AbstractTextDescription; import org.eclipse.sirius.properties.PropertiesPackage; import org.eclipse.sirius.properties.TextDescription; import org.eclipse.sirius.properties.TextWidgetConditionalStyle; import org.eclipse.sirius.properties.TextWidgetStyle; import org.eclipse.sirius.viewpoint.description.tool.InitialOperation; /** * An implementation of the model object 'Abstract Text Description'. *

* The following features are implemented: *

* * * @generated */ public abstract class AbstractTextDescriptionImpl extends AbstractWidgetDescriptionImpl implements AbstractTextDescription { /** * The default value of the '{@link #getValueExpression() Value Expression}' attribute. * * @see #getValueExpression() * @generated * @ordered */ protected static final String VALUE_EXPRESSION_EDEFAULT = null; /** * The cached value of the '{@link #getValueExpression() Value Expression}' attribute. * * @see #getValueExpression() * @generated * @ordered */ protected String valueExpression = AbstractTextDescriptionImpl.VALUE_EXPRESSION_EDEFAULT; /** * The cached value of the '{@link #getInitialOperation() Initial Operation}' containment reference. * * @see #getInitialOperation() * @generated * @ordered */ protected InitialOperation initialOperation; /** * The cached value of the '{@link #getStyle() Style}' containment reference. * * @see #getStyle() * @generated * @ordered */ protected TextWidgetStyle style; /** * The cached value of the '{@link #getConditionalStyles() Conditional Styles}' containment reference list. * * * @see #getConditionalStyles() * @generated * @ordered */ protected EList conditionalStyles; /** * The cached value of the '{@link #getExtends() Extends}' reference. * * @see #getExtends() * @generated * @ordered */ protected TextDescription extends_; /** * The default value of the '{@link #getFilterConditionalStylesFromExtendedTextExpression() Filter Conditional * Styles From Extended Text Expression}' attribute. * * @see #getFilterConditionalStylesFromExtendedTextExpression() * @generated * @ordered */ protected static final String FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION_EDEFAULT = null; /** * The cached value of the '{@link #getFilterConditionalStylesFromExtendedTextExpression() Filter Conditional * Styles From Extended Text Expression}' attribute. * * @see #getFilterConditionalStylesFromExtendedTextExpression() * @generated * @ordered */ protected String filterConditionalStylesFromExtendedTextExpression = AbstractTextDescriptionImpl.FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION_EDEFAULT; /** * * * @generated */ protected AbstractTextDescriptionImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return PropertiesPackage.Literals.ABSTRACT_TEXT_DESCRIPTION; } /** * * * @generated */ @Override public String getValueExpression() { return valueExpression; } /** * * * @generated */ @Override public void setValueExpression(String newValueExpression) { String oldValueExpression = valueExpression; valueExpression = newValueExpression; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__VALUE_EXPRESSION, oldValueExpression, valueExpression)); } } /** * * * @generated */ @Override public InitialOperation getInitialOperation() { return initialOperation; } /** * * * @generated */ public NotificationChain basicSetInitialOperation(InitialOperation newInitialOperation, NotificationChain msgs) { InitialOperation oldInitialOperation = initialOperation; initialOperation = newInitialOperation; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION, oldInitialOperation, newInitialOperation); if (msgs == null) { msgs = notification; } else { msgs.add(notification); } } return msgs; } /** * * * @generated */ @Override public void setInitialOperation(InitialOperation newInitialOperation) { if (newInitialOperation != initialOperation) { NotificationChain msgs = null; if (initialOperation != null) { msgs = ((InternalEObject) initialOperation).eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION, null, msgs); } if (newInitialOperation != null) { msgs = ((InternalEObject) newInitialOperation).eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION, null, msgs); } msgs = basicSetInitialOperation(newInitialOperation, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION, newInitialOperation, newInitialOperation)); } } /** * * * @generated */ @Override public TextWidgetStyle getStyle() { return style; } /** * * * @generated */ public NotificationChain basicSetStyle(TextWidgetStyle newStyle, NotificationChain msgs) { TextWidgetStyle oldStyle = style; style = newStyle; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE, oldStyle, newStyle); if (msgs == null) { msgs = notification; } else { msgs.add(notification); } } return msgs; } /** * * * @generated */ @Override public void setStyle(TextWidgetStyle newStyle) { if (newStyle != style) { NotificationChain msgs = null; if (style != null) { msgs = ((InternalEObject) style).eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE, null, msgs); } if (newStyle != null) { msgs = ((InternalEObject) newStyle).eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE, null, msgs); } msgs = basicSetStyle(newStyle, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE, newStyle, newStyle)); } } /** * * * @generated */ @Override public EList getConditionalStyles() { if (conditionalStyles == null) { conditionalStyles = new EObjectContainmentEList(TextWidgetConditionalStyle.class, this, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES); } return conditionalStyles; } /** * * * @generated */ @Override public TextDescription getExtends() { if (extends_ != null && extends_.eIsProxy()) { InternalEObject oldExtends = (InternalEObject) extends_; extends_ = (TextDescription) eResolveProxy(oldExtends); if (extends_ != oldExtends) { if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.RESOLVE, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS, oldExtends, extends_)); } } } return extends_; } /** * * * @generated */ public TextDescription basicGetExtends() { return extends_; } /** * * * @generated */ @Override public void setExtends(TextDescription newExtends) { TextDescription oldExtends = extends_; extends_ = newExtends; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS, oldExtends, extends_)); } } /** * * * @generated */ @Override public String getFilterConditionalStylesFromExtendedTextExpression() { return filterConditionalStylesFromExtendedTextExpression; } /** * * * @generated */ @Override public void setFilterConditionalStylesFromExtendedTextExpression(String newFilterConditionalStylesFromExtendedTextExpression) { String oldFilterConditionalStylesFromExtendedTextExpression = filterConditionalStylesFromExtendedTextExpression; filterConditionalStylesFromExtendedTextExpression = newFilterConditionalStylesFromExtendedTextExpression; if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION, oldFilterConditionalStylesFromExtendedTextExpression, filterConditionalStylesFromExtendedTextExpression)); } } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION: return basicSetInitialOperation(null, msgs); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE: return basicSetStyle(null, msgs); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES: return ((InternalEList) getConditionalStyles()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__VALUE_EXPRESSION: return getValueExpression(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION: return getInitialOperation(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE: return getStyle(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES: return getConditionalStyles(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS: if (resolve) { return getExtends(); } return basicGetExtends(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION: return getFilterConditionalStylesFromExtendedTextExpression(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__VALUE_EXPRESSION: setValueExpression((String) newValue); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION: setInitialOperation((InitialOperation) newValue); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE: setStyle((TextWidgetStyle) newValue); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES: getConditionalStyles().clear(); getConditionalStyles().addAll((Collection) newValue); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS: setExtends((TextDescription) newValue); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION: setFilterConditionalStylesFromExtendedTextExpression((String) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__VALUE_EXPRESSION: setValueExpression(AbstractTextDescriptionImpl.VALUE_EXPRESSION_EDEFAULT); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION: setInitialOperation((InitialOperation) null); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE: setStyle((TextWidgetStyle) null); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES: getConditionalStyles().clear(); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS: setExtends((TextDescription) null); return; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION: setFilterConditionalStylesFromExtendedTextExpression(AbstractTextDescriptionImpl.FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__VALUE_EXPRESSION: return AbstractTextDescriptionImpl.VALUE_EXPRESSION_EDEFAULT == null ? valueExpression != null : !AbstractTextDescriptionImpl.VALUE_EXPRESSION_EDEFAULT.equals(valueExpression); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__INITIAL_OPERATION: return initialOperation != null; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__STYLE: return style != null; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__CONDITIONAL_STYLES: return conditionalStyles != null && !conditionalStyles.isEmpty(); case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__EXTENDS: return extends_ != null; case PropertiesPackage.ABSTRACT_TEXT_DESCRIPTION__FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION: return AbstractTextDescriptionImpl.FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION_EDEFAULT == null ? filterConditionalStylesFromExtendedTextExpression != null : !AbstractTextDescriptionImpl.FILTER_CONDITIONAL_STYLES_FROM_EXTENDED_TEXT_EXPRESSION_EDEFAULT.equals(filterConditionalStylesFromExtendedTextExpression); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) { return super.toString(); } StringBuffer result = new StringBuffer(super.toString()); result.append(" (valueExpression: "); //$NON-NLS-1$ result.append(valueExpression); result.append(", filterConditionalStylesFromExtendedTextExpression: "); //$NON-NLS-1$ result.append(filterConditionalStylesFromExtendedTextExpression); result.append(')'); return result.toString(); } } // AbstractTextDescriptionImpl