| /******************************************************************************* |
| * Copyright (c) 2009, 2019 Xored Software Inc and others. |
| * 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-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.verifications.tree.impl; |
| |
| import org.eclipse.rcptt.verifications.tree.ItemData; |
| import org.eclipse.rcptt.verifications.tree.TreePackage; |
| |
| import org.eclipse.rcptt.tesla.core.ui.Color; |
| import org.eclipse.rcptt.tesla.core.ui.Image; |
| |
| 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.emf.ecore.impl.EObjectImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Item Data</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.ItemDataImpl#getText <em>Text</em>}</li> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.ItemDataImpl#getImage <em>Image</em>}</li> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.ItemDataImpl#getForegroundColor <em>Foreground Color</em>}</li> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.ItemDataImpl#getBackgroundColor <em>Background Color</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ItemDataImpl extends EObjectImpl implements ItemData { |
| /** |
| * The default value of the '{@link #getText() <em>Text</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getText() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TEXT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getText() <em>Text</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getText() |
| * @generated |
| * @ordered |
| */ |
| protected String text = TEXT_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getImage() <em>Image</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImage() |
| * @generated |
| * @ordered |
| */ |
| protected Image image; |
| |
| /** |
| * The cached value of the '{@link #getForegroundColor() <em>Foreground Color</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getForegroundColor() |
| * @generated |
| * @ordered |
| */ |
| protected Color foregroundColor; |
| |
| /** |
| * The cached value of the '{@link #getBackgroundColor() <em>Background Color</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBackgroundColor() |
| * @generated |
| * @ordered |
| */ |
| protected Color backgroundColor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ItemDataImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return TreePackage.Literals.ITEM_DATA; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getText() { |
| return text; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setText(String newText) { |
| String oldText = text; |
| text = newText; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__TEXT, oldText, text)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Image getImage() { |
| return image; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetImage(Image newImage, NotificationChain msgs) { |
| Image oldImage = image; |
| image = newImage; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__IMAGE, oldImage, newImage); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setImage(Image newImage) { |
| if (newImage != image) { |
| NotificationChain msgs = null; |
| if (image != null) |
| msgs = ((InternalEObject)image).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__IMAGE, null, msgs); |
| if (newImage != null) |
| msgs = ((InternalEObject)newImage).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__IMAGE, null, msgs); |
| msgs = basicSetImage(newImage, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__IMAGE, newImage, newImage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Color getForegroundColor() { |
| return foregroundColor; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetForegroundColor(Color newForegroundColor, NotificationChain msgs) { |
| Color oldForegroundColor = foregroundColor; |
| foregroundColor = newForegroundColor; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__FOREGROUND_COLOR, oldForegroundColor, newForegroundColor); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setForegroundColor(Color newForegroundColor) { |
| if (newForegroundColor != foregroundColor) { |
| NotificationChain msgs = null; |
| if (foregroundColor != null) |
| msgs = ((InternalEObject)foregroundColor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__FOREGROUND_COLOR, null, msgs); |
| if (newForegroundColor != null) |
| msgs = ((InternalEObject)newForegroundColor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__FOREGROUND_COLOR, null, msgs); |
| msgs = basicSetForegroundColor(newForegroundColor, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__FOREGROUND_COLOR, newForegroundColor, newForegroundColor)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Color getBackgroundColor() { |
| return backgroundColor; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetBackgroundColor(Color newBackgroundColor, NotificationChain msgs) { |
| Color oldBackgroundColor = backgroundColor; |
| backgroundColor = newBackgroundColor; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__BACKGROUND_COLOR, oldBackgroundColor, newBackgroundColor); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBackgroundColor(Color newBackgroundColor) { |
| if (newBackgroundColor != backgroundColor) { |
| NotificationChain msgs = null; |
| if (backgroundColor != null) |
| msgs = ((InternalEObject)backgroundColor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__BACKGROUND_COLOR, null, msgs); |
| if (newBackgroundColor != null) |
| msgs = ((InternalEObject)newBackgroundColor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TreePackage.ITEM_DATA__BACKGROUND_COLOR, null, msgs); |
| msgs = basicSetBackgroundColor(newBackgroundColor, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.ITEM_DATA__BACKGROUND_COLOR, newBackgroundColor, newBackgroundColor)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case TreePackage.ITEM_DATA__IMAGE: |
| return basicSetImage(null, msgs); |
| case TreePackage.ITEM_DATA__FOREGROUND_COLOR: |
| return basicSetForegroundColor(null, msgs); |
| case TreePackage.ITEM_DATA__BACKGROUND_COLOR: |
| return basicSetBackgroundColor(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 TreePackage.ITEM_DATA__TEXT: |
| return getText(); |
| case TreePackage.ITEM_DATA__IMAGE: |
| return getImage(); |
| case TreePackage.ITEM_DATA__FOREGROUND_COLOR: |
| return getForegroundColor(); |
| case TreePackage.ITEM_DATA__BACKGROUND_COLOR: |
| return getBackgroundColor(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case TreePackage.ITEM_DATA__TEXT: |
| setText((String)newValue); |
| return; |
| case TreePackage.ITEM_DATA__IMAGE: |
| setImage((Image)newValue); |
| return; |
| case TreePackage.ITEM_DATA__FOREGROUND_COLOR: |
| setForegroundColor((Color)newValue); |
| return; |
| case TreePackage.ITEM_DATA__BACKGROUND_COLOR: |
| setBackgroundColor((Color)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case TreePackage.ITEM_DATA__TEXT: |
| setText(TEXT_EDEFAULT); |
| return; |
| case TreePackage.ITEM_DATA__IMAGE: |
| setImage((Image)null); |
| return; |
| case TreePackage.ITEM_DATA__FOREGROUND_COLOR: |
| setForegroundColor((Color)null); |
| return; |
| case TreePackage.ITEM_DATA__BACKGROUND_COLOR: |
| setBackgroundColor((Color)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case TreePackage.ITEM_DATA__TEXT: |
| return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text); |
| case TreePackage.ITEM_DATA__IMAGE: |
| return image != null; |
| case TreePackage.ITEM_DATA__FOREGROUND_COLOR: |
| return foregroundColor != null; |
| case TreePackage.ITEM_DATA__BACKGROUND_COLOR: |
| return backgroundColor != 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(" (text: "); |
| result.append(text); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ItemDataImpl |