blob: 2b677e3b43091bf05d3fe8ae9f613beb1e5950c0 [file] [log] [blame]
/*******************************************************************************
* 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.ecl.core.impl;
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.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.rcptt.ecl.core.Binding;
import org.eclipse.rcptt.ecl.core.Command;
import org.eclipse.rcptt.ecl.core.CorePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Binding</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.ecl.core.impl.BindingImpl#getFeature <em>Feature</em>}</li>
* <li>{@link org.eclipse.rcptt.ecl.core.impl.BindingImpl#getCommand <em>Command</em>}</li>
* </ul>
*
* @generated
*/
public class BindingImpl extends EObjectImpl implements Binding {
/**
* The cached value of the '{@link #getFeature() <em>Feature</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeature()
* @generated
* @ordered
*/
protected EStructuralFeature feature;
/**
* The cached value of the '{@link #getCommand() <em>Command</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCommand()
* @generated
* @ordered
*/
protected Command command;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BindingImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CorePackage.Literals.BINDING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EStructuralFeature getFeature() {
if (feature != null && feature.eIsProxy()) {
InternalEObject oldFeature = (InternalEObject)feature;
feature = (EStructuralFeature)eResolveProxy(oldFeature);
if (feature != oldFeature) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.BINDING__FEATURE, oldFeature, feature));
}
}
return feature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EStructuralFeature basicGetFeature() {
return feature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setFeature(EStructuralFeature newFeature) {
EStructuralFeature oldFeature = feature;
feature = newFeature;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BINDING__FEATURE, oldFeature, feature));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Command getCommand() {
return command;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCommand(Command newCommand, NotificationChain msgs) {
Command oldCommand = command;
command = newCommand;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CorePackage.BINDING__COMMAND, oldCommand, newCommand);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setCommand(Command newCommand) {
if (newCommand != command) {
NotificationChain msgs = null;
if (command != null)
msgs = ((InternalEObject)command).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CorePackage.BINDING__COMMAND, null, msgs);
if (newCommand != null)
msgs = ((InternalEObject)newCommand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CorePackage.BINDING__COMMAND, null, msgs);
msgs = basicSetCommand(newCommand, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.BINDING__COMMAND, newCommand, newCommand));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CorePackage.BINDING__COMMAND:
return basicSetCommand(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 CorePackage.BINDING__FEATURE:
if (resolve) return getFeature();
return basicGetFeature();
case CorePackage.BINDING__COMMAND:
return getCommand();
}
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.BINDING__FEATURE:
setFeature((EStructuralFeature)newValue);
return;
case CorePackage.BINDING__COMMAND:
setCommand((Command)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CorePackage.BINDING__FEATURE:
setFeature((EStructuralFeature)null);
return;
case CorePackage.BINDING__COMMAND:
setCommand((Command)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CorePackage.BINDING__FEATURE:
return feature != null;
case CorePackage.BINDING__COMMAND:
return command != null;
}
return super.eIsSet(featureID);
}
} //BindingImpl