blob: adf60b624a0480027dbab548dd231f8def03acb6 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.semantic.uimodel.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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.xtext.common.types.JvmTypeReference;
import org.eclipse.osbp.ecview.semantic.uimodel.UiBindingExpression;
import org.eclipse.osbp.ecview.semantic.uimodel.UiModelPackage;
import org.eclipse.osbp.ecview.semantic.uimodel.UiSetNewInstanceCommand;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Ui Set New Instance Command</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiSetNewInstanceCommandImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiSetNewInstanceCommandImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiSetNewInstanceCommandImpl#getTarget <em>Target</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiSetNewInstanceCommandImpl#getJvmType <em>Jvm Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class UiSetNewInstanceCommandImpl extends MinimalEObjectImpl.Container implements UiSetNewInstanceCommand {
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected UiBindingExpression target;
/**
* The cached value of the '{@link #getJvmType() <em>Jvm Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJvmType()
* @generated
* @ordered
*/
protected JvmTypeReference jvmType;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UiSetNewInstanceCommandImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return UiModelPackage.Literals.UI_SET_NEW_INSTANCE_COMMAND;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UiBindingExpression getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject)target;
target = (UiBindingExpression)eResolveProxy(oldTarget);
if (target != oldTarget) {
InternalEObject newTarget = (InternalEObject)target;
NotificationChain msgs = oldTarget.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, null, null);
if (newTarget.eInternalContainer() == null) {
msgs = newTarget.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UiBindingExpression basicGetTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTarget(UiBindingExpression newTarget, NotificationChain msgs) {
UiBindingExpression oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(UiBindingExpression newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET, newTarget, newTarget));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmTypeReference getJvmType() {
if (jvmType != null && jvmType.eIsProxy()) {
InternalEObject oldJvmType = (InternalEObject)jvmType;
jvmType = (JvmTypeReference)eResolveProxy(oldJvmType);
if (jvmType != oldJvmType) {
InternalEObject newJvmType = (InternalEObject)jvmType;
NotificationChain msgs = oldJvmType.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, null, null);
if (newJvmType.eInternalContainer() == null) {
msgs = newJvmType.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, oldJvmType, jvmType));
}
}
return jvmType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmTypeReference basicGetJvmType() {
return jvmType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetJvmType(JvmTypeReference newJvmType, NotificationChain msgs) {
JvmTypeReference oldJvmType = jvmType;
jvmType = newJvmType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, oldJvmType, newJvmType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setJvmType(JvmTypeReference newJvmType) {
if (newJvmType != jvmType) {
NotificationChain msgs = null;
if (jvmType != null)
msgs = ((InternalEObject)jvmType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, null, msgs);
if (newJvmType != null)
msgs = ((InternalEObject)newJvmType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, null, msgs);
msgs = basicSetJvmType(newJvmType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE, newJvmType, newJvmType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET:
return basicSetTarget(null, msgs);
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE:
return basicSetJvmType(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 UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__ID:
return getId();
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__NAME:
return getName();
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE:
if (resolve) return getJvmType();
return basicGetJvmType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__ID:
setId((String)newValue);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__NAME:
setName((String)newValue);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET:
setTarget((UiBindingExpression)newValue);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE:
setJvmType((JvmTypeReference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__ID:
setId(ID_EDEFAULT);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__NAME:
setName(NAME_EDEFAULT);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET:
setTarget((UiBindingExpression)null);
return;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE:
setJvmType((JvmTypeReference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__TARGET:
return target != null;
case UiModelPackage.UI_SET_NEW_INSTANCE_COMMAND__JVM_TYPE:
return jvmType != 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(" (id: ");
result.append(id);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //UiSetNewInstanceCommandImpl