| /******************************************************************************* |
| * Copyright (c) 2009, 2015 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.ecl.core.impl; |
| |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.rcptt.ecl.core.Command; |
| import org.eclipse.rcptt.ecl.core.CorePackage; |
| import org.eclipse.rcptt.ecl.core.Listen; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Listen</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.ecl.core.impl.ListenImpl#getSource <em>Source</em>}</li> |
| * <li>{@link org.eclipse.rcptt.ecl.core.impl.ListenImpl#getWhile <em>While</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ListenImpl extends CommandImpl implements Listen { |
| /** |
| * The default value of the '{@link #getSource() <em>Source</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SOURCE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected String source = SOURCE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getWhile() <em>While</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWhile() |
| * @generated |
| * @ordered |
| */ |
| protected Command while_; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ListenImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CorePackage.Literals.LISTEN; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setSource(String newSource) { |
| String oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.LISTEN__SOURCE, oldSource, source)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Command getWhile() { |
| if (while_ != null && while_.eIsProxy()) { |
| InternalEObject oldWhile = (InternalEObject)while_; |
| while_ = (Command)eResolveProxy(oldWhile); |
| if (while_ != oldWhile) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.LISTEN__WHILE, oldWhile, while_)); |
| } |
| } |
| return while_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Command basicGetWhile() { |
| return while_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setWhile(Command newWhile) { |
| Command oldWhile = while_; |
| while_ = newWhile; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.LISTEN__WHILE, oldWhile, while_)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CorePackage.LISTEN__SOURCE: |
| return getSource(); |
| case CorePackage.LISTEN__WHILE: |
| if (resolve) return getWhile(); |
| return basicGetWhile(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CorePackage.LISTEN__SOURCE: |
| setSource((String)newValue); |
| return; |
| case CorePackage.LISTEN__WHILE: |
| setWhile((Command)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CorePackage.LISTEN__SOURCE: |
| setSource(SOURCE_EDEFAULT); |
| return; |
| case CorePackage.LISTEN__WHILE: |
| setWhile((Command)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CorePackage.LISTEN__SOURCE: |
| return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT.equals(source); |
| case CorePackage.LISTEN__WHILE: |
| return while_ != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (source: "); |
| result.append(source); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ListenImpl |