blob: 68c656031d4410094f9be52360da528e6b0d5f85 [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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
* generated from ActionDSL.xcore
*
*
*/
package org.eclipse.osbp.xtext.action.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.osbp.xtext.action.ActionCommand;
import org.eclipse.osbp.xtext.action.ActionDSLPackage;
import org.eclipse.osbp.xtext.action.ActionType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Action Command</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#getActionType <em>Action Type</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#isHasKeyBinding <em>Has Key Binding</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#getKeyBinding <em>Key Binding</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#isHasDescription <em>Has Description</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.action.impl.ActionCommandImpl#getIconURI <em>Icon URI</em>}</li>
* </ul>
*
* @generated
*/
public class ActionCommandImpl extends ActionBaseImpl implements ActionCommand {
/**
* The cached value of the '{@link #getActionType() <em>Action Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getActionType()
* @generated
* @ordered
*/
protected ActionType actionType;
/**
* The default value of the '{@link #isHasKeyBinding() <em>Has Key Binding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasKeyBinding()
* @generated
* @ordered
*/
protected static final boolean HAS_KEY_BINDING_EDEFAULT = false;
/**
* The cached value of the '{@link #isHasKeyBinding() <em>Has Key Binding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasKeyBinding()
* @generated
* @ordered
*/
protected boolean hasKeyBinding = HAS_KEY_BINDING_EDEFAULT;
/**
* The default value of the '{@link #getKeyBinding() <em>Key Binding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKeyBinding()
* @generated
* @ordered
*/
protected static final String KEY_BINDING_EDEFAULT = null;
/**
* The cached value of the '{@link #getKeyBinding() <em>Key Binding</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKeyBinding()
* @generated
* @ordered
*/
protected String keyBinding = KEY_BINDING_EDEFAULT;
/**
* The default value of the '{@link #isHasDescription() <em>Has Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasDescription()
* @generated
* @ordered
*/
protected static final boolean HAS_DESCRIPTION_EDEFAULT = false;
/**
* The cached value of the '{@link #isHasDescription() <em>Has Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasDescription()
* @generated
* @ordered
*/
protected boolean hasDescription = HAS_DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getIconURI() <em>Icon URI</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIconURI()
* @generated
* @ordered
*/
protected static final String ICON_URI_EDEFAULT = null;
/**
* The cached value of the '{@link #getIconURI() <em>Icon URI</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIconURI()
* @generated
* @ordered
*/
protected String iconURI = ICON_URI_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ActionCommandImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ActionDSLPackage.Literals.ACTION_COMMAND;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ActionType getActionType() {
return actionType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetActionType(ActionType newActionType, NotificationChain msgs) {
ActionType oldActionType = actionType;
actionType = newActionType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE, oldActionType, newActionType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setActionType(ActionType newActionType) {
if (newActionType != actionType) {
NotificationChain msgs = null;
if (actionType != null)
msgs = ((InternalEObject)actionType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE, null, msgs);
if (newActionType != null)
msgs = ((InternalEObject)newActionType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE, null, msgs);
msgs = basicSetActionType(newActionType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE, newActionType, newActionType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isHasKeyBinding() {
return hasKeyBinding;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHasKeyBinding(boolean newHasKeyBinding) {
boolean oldHasKeyBinding = hasKeyBinding;
hasKeyBinding = newHasKeyBinding;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__HAS_KEY_BINDING, oldHasKeyBinding, hasKeyBinding));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getKeyBinding() {
return keyBinding;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKeyBinding(String newKeyBinding) {
String oldKeyBinding = keyBinding;
keyBinding = newKeyBinding;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__KEY_BINDING, oldKeyBinding, keyBinding));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isHasDescription() {
return hasDescription;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHasDescription(boolean newHasDescription) {
boolean oldHasDescription = hasDescription;
hasDescription = newHasDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__HAS_DESCRIPTION, oldHasDescription, hasDescription));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getIconURI() {
return iconURI;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIconURI(String newIconURI) {
String oldIconURI = iconURI;
iconURI = newIconURI;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionDSLPackage.ACTION_COMMAND__ICON_URI, oldIconURI, iconURI));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE:
return basicSetActionType(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 ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE:
return getActionType();
case ActionDSLPackage.ACTION_COMMAND__HAS_KEY_BINDING:
return isHasKeyBinding();
case ActionDSLPackage.ACTION_COMMAND__KEY_BINDING:
return getKeyBinding();
case ActionDSLPackage.ACTION_COMMAND__HAS_DESCRIPTION:
return isHasDescription();
case ActionDSLPackage.ACTION_COMMAND__DESCRIPTION:
return getDescription();
case ActionDSLPackage.ACTION_COMMAND__ICON_URI:
return getIconURI();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE:
setActionType((ActionType)newValue);
return;
case ActionDSLPackage.ACTION_COMMAND__HAS_KEY_BINDING:
setHasKeyBinding((Boolean)newValue);
return;
case ActionDSLPackage.ACTION_COMMAND__KEY_BINDING:
setKeyBinding((String)newValue);
return;
case ActionDSLPackage.ACTION_COMMAND__HAS_DESCRIPTION:
setHasDescription((Boolean)newValue);
return;
case ActionDSLPackage.ACTION_COMMAND__DESCRIPTION:
setDescription((String)newValue);
return;
case ActionDSLPackage.ACTION_COMMAND__ICON_URI:
setIconURI((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE:
setActionType((ActionType)null);
return;
case ActionDSLPackage.ACTION_COMMAND__HAS_KEY_BINDING:
setHasKeyBinding(HAS_KEY_BINDING_EDEFAULT);
return;
case ActionDSLPackage.ACTION_COMMAND__KEY_BINDING:
setKeyBinding(KEY_BINDING_EDEFAULT);
return;
case ActionDSLPackage.ACTION_COMMAND__HAS_DESCRIPTION:
setHasDescription(HAS_DESCRIPTION_EDEFAULT);
return;
case ActionDSLPackage.ACTION_COMMAND__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case ActionDSLPackage.ACTION_COMMAND__ICON_URI:
setIconURI(ICON_URI_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ActionDSLPackage.ACTION_COMMAND__ACTION_TYPE:
return actionType != null;
case ActionDSLPackage.ACTION_COMMAND__HAS_KEY_BINDING:
return hasKeyBinding != HAS_KEY_BINDING_EDEFAULT;
case ActionDSLPackage.ACTION_COMMAND__KEY_BINDING:
return KEY_BINDING_EDEFAULT == null ? keyBinding != null : !KEY_BINDING_EDEFAULT.equals(keyBinding);
case ActionDSLPackage.ACTION_COMMAND__HAS_DESCRIPTION:
return hasDescription != HAS_DESCRIPTION_EDEFAULT;
case ActionDSLPackage.ACTION_COMMAND__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case ActionDSLPackage.ACTION_COMMAND__ICON_URI:
return ICON_URI_EDEFAULT == null ? iconURI != null : !ICON_URI_EDEFAULT.equals(iconURI);
}
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(" (hasKeyBinding: ");
result.append(hasKeyBinding);
result.append(", keyBinding: ");
result.append(keyBinding);
result.append(", hasDescription: ");
result.append(hasDescription);
result.append(", description: ");
result.append(description);
result.append(", iconURI: ");
result.append(iconURI);
result.append(')');
return result.toString();
}
} //ActionCommandImpl