| /** |
| * <copyright> |
| * |
| * Copyright (c) 2008 E.D.Willink 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: |
| * E.D.Willink - initial API and implementation |
| * |
| * </copyright> |
| * |
| * $Id: JavaLabelElementImpl.java,v 1.1 2008/08/24 18:56:21 ewillink Exp $ |
| */ |
| package org.eclipse.qvt.declarative.editor.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.qvt.declarative.editor.EditorPackage; |
| import org.eclipse.qvt.declarative.editor.JavaLabelElement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Java Label Element</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.JavaLabelElementImpl#getClass_ <em>Class</em>}</li> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.JavaLabelElementImpl#getMethod <em>Method</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class JavaLabelElementImpl extends AbstractLabelElementImpl implements JavaLabelElement { |
| /** |
| * The default value of the '{@link #getClass_() <em>Class</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClass_() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CLASS_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getClass_() <em>Class</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClass_() |
| * @generated |
| * @ordered |
| */ |
| protected String class_ = CLASS_EDEFAULT; |
| |
| /** |
| * This is true if the Class attribute has been set. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| protected boolean classESet; |
| |
| /** |
| * The default value of the '{@link #getMethod() <em>Method</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMethod() |
| * @generated |
| * @ordered |
| */ |
| protected static final String METHOD_EDEFAULT = "toString"; |
| |
| /** |
| * The cached value of the '{@link #getMethod() <em>Method</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMethod() |
| * @generated |
| * @ordered |
| */ |
| protected String method = METHOD_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected JavaLabelElementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EditorPackage.Literals.JAVA_LABEL_ELEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getClass_() { |
| return class_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClass(String newClass) { |
| String oldClass = class_; |
| class_ = newClass; |
| boolean oldClassESet = classESet; |
| classESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.JAVA_LABEL_ELEMENT__CLASS, oldClass, class_, !oldClassESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void unsetClass() { |
| String oldClass = class_; |
| boolean oldClassESet = classESet; |
| class_ = CLASS_EDEFAULT; |
| classESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, EditorPackage.JAVA_LABEL_ELEMENT__CLASS, oldClass, CLASS_EDEFAULT, oldClassESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isSetClass() { |
| return classESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getMethod() { |
| return method; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMethod(String newMethod) { |
| String oldMethod = method; |
| method = newMethod; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.JAVA_LABEL_ELEMENT__METHOD, oldMethod, method)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case EditorPackage.JAVA_LABEL_ELEMENT__CLASS: |
| return getClass_(); |
| case EditorPackage.JAVA_LABEL_ELEMENT__METHOD: |
| return getMethod(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case EditorPackage.JAVA_LABEL_ELEMENT__CLASS: |
| setClass((String)newValue); |
| return; |
| case EditorPackage.JAVA_LABEL_ELEMENT__METHOD: |
| setMethod((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EditorPackage.JAVA_LABEL_ELEMENT__CLASS: |
| unsetClass(); |
| return; |
| case EditorPackage.JAVA_LABEL_ELEMENT__METHOD: |
| setMethod(METHOD_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EditorPackage.JAVA_LABEL_ELEMENT__CLASS: |
| return isSetClass(); |
| case EditorPackage.JAVA_LABEL_ELEMENT__METHOD: |
| return METHOD_EDEFAULT == null ? method != null : !METHOD_EDEFAULT.equals(method); |
| } |
| 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(" (class: "); |
| if (classESet) result.append(class_); else result.append("<unset>"); |
| result.append(", method: "); |
| result.append(method); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //JavaLabelElementImpl |