| /******************************************************************************* |
| * Copyright (c) 2009, 2014 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.tesla.core.protocol.raw.impl; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.raw.RawPackage; |
| import org.eclipse.rcptt.tesla.core.protocol.raw.SetMode; |
| import org.eclipse.rcptt.tesla.core.protocol.raw.TeslaMode; |
| |
| import java.util.Collection; |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Set Mode</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.raw.impl.SetModeImpl#getMode <em>Mode</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.raw.impl.SetModeImpl#getWidgetClasses <em>Widget Classes</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class SetModeImpl extends EObjectImpl implements SetMode { |
| /** |
| * The default value of the '{@link #getMode() <em>Mode</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMode() |
| * @generated |
| * @ordered |
| */ |
| protected static final TeslaMode MODE_EDEFAULT = TeslaMode.FEATURES; |
| |
| /** |
| * The cached value of the '{@link #getMode() <em>Mode</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMode() |
| * @generated |
| * @ordered |
| */ |
| protected TeslaMode mode = MODE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getWidgetClasses() <em>Widget Classes</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWidgetClasses() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> widgetClasses; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SetModeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return RawPackage.Literals.SET_MODE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TeslaMode getMode() { |
| return mode; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMode(TeslaMode newMode) { |
| TeslaMode oldMode = mode; |
| mode = newMode == null ? MODE_EDEFAULT : newMode; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, RawPackage.SET_MODE__MODE, oldMode, mode)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getWidgetClasses() { |
| if (widgetClasses == null) |
| { |
| widgetClasses = new EDataTypeUniqueEList<String>(String.class, this, RawPackage.SET_MODE__WIDGET_CLASSES); |
| } |
| return widgetClasses; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) |
| { |
| case RawPackage.SET_MODE__MODE: |
| return getMode(); |
| case RawPackage.SET_MODE__WIDGET_CLASSES: |
| return getWidgetClasses(); |
| } |
| 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 RawPackage.SET_MODE__MODE: |
| setMode((TeslaMode) newValue); |
| return; |
| case RawPackage.SET_MODE__WIDGET_CLASSES: |
| getWidgetClasses().clear(); |
| getWidgetClasses().addAll((Collection<? extends String>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) |
| { |
| case RawPackage.SET_MODE__MODE: |
| setMode(MODE_EDEFAULT); |
| return; |
| case RawPackage.SET_MODE__WIDGET_CLASSES: |
| getWidgetClasses().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) |
| { |
| case RawPackage.SET_MODE__MODE: |
| return mode != MODE_EDEFAULT; |
| case RawPackage.SET_MODE__WIDGET_CLASSES: |
| return widgetClasses != null && !widgetClasses.isEmpty(); |
| } |
| 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(" (mode: "); |
| result.append(mode); |
| result.append(", widgetClasses: "); |
| result.append(widgetClasses); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SetModeImpl |