| /******************************************************************************* |
| * 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.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; |
| import org.eclipse.rcptt.verifications.tree.Cell; |
| 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.rcptt.tesla.core.ui.StyleRangeEntry; |
| import java.util.Collection; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' |
| * <em><b>Cell</b></em>'. <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.CellImpl#getStyle <em>Style</em>}</li> |
| * <li>{@link org.eclipse.rcptt.verifications.tree.impl.CellImpl#getData <em>Data</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class CellImpl extends EObjectImpl implements Cell { |
| /** |
| * The cached value of the '{@link #getStyle() <em>Style</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStyle() |
| * @generated |
| * @ordered |
| */ |
| protected EList<StyleRangeEntry> style; |
| |
| /** |
| * The cached value of the '{@link #getData() <em>Data</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getData() |
| * @generated |
| * @ordered |
| */ |
| protected ItemData data; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CellImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return TreePackage.Literals.CELL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<StyleRangeEntry> getStyle() { |
| if (style == null) { |
| style = new EObjectContainmentEList<StyleRangeEntry>(StyleRangeEntry.class, this, TreePackage.CELL__STYLE); |
| } |
| return style; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ItemData getData() { |
| return data; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetData(ItemData newData, NotificationChain msgs) { |
| ItemData oldData = data; |
| data = newData; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TreePackage.CELL__DATA, oldData, newData); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setData(ItemData newData) { |
| if (newData != data) { |
| NotificationChain msgs = null; |
| if (data != null) |
| msgs = ((InternalEObject)data).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TreePackage.CELL__DATA, null, msgs); |
| if (newData != null) |
| msgs = ((InternalEObject)newData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TreePackage.CELL__DATA, null, msgs); |
| msgs = basicSetData(newData, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.CELL__DATA, newData, newData)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case TreePackage.CELL__STYLE: |
| return ((InternalEList<?>)getStyle()).basicRemove(otherEnd, msgs); |
| case TreePackage.CELL__DATA: |
| return basicSetData(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.CELL__STYLE: |
| return getStyle(); |
| case TreePackage.CELL__DATA: |
| return getData(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case TreePackage.CELL__STYLE: |
| getStyle().clear(); |
| getStyle().addAll((Collection<? extends StyleRangeEntry>)newValue); |
| return; |
| case TreePackage.CELL__DATA: |
| setData((ItemData)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case TreePackage.CELL__STYLE: |
| getStyle().clear(); |
| return; |
| case TreePackage.CELL__DATA: |
| setData((ItemData)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case TreePackage.CELL__STYLE: |
| return style != null && !style.isEmpty(); |
| case TreePackage.CELL__DATA: |
| return data != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // CellImpl |