| /* |
| * Copyright (c) 2007 Borland Software Corporation |
| * |
| * 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: |
| * Dmitry Stadnik (Borland) - initial API and implementation |
| */ |
| package org.eclipse.gmf.sketch.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EAttribute; |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| |
| import org.eclipse.gmf.sketch.SketchLabel; |
| import org.eclipse.gmf.sketch.SketchPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Label</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.gmf.sketch.impl.SketchLabelImpl#getAttributes <em>Attributes</em>}</li> |
| * <li>{@link org.eclipse.gmf.sketch.impl.SketchLabelImpl#isExternal <em>External</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class SketchLabelImpl extends SketchDiagramElementImpl implements SketchLabel { |
| |
| /** |
| * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<EAttribute> attributes; |
| |
| /** |
| * The default value of the '{@link #isExternal() <em>External</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isExternal() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean EXTERNAL_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isExternal() <em>External</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isExternal() |
| * @generated |
| * @ordered |
| */ |
| protected boolean external = EXTERNAL_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SketchLabelImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return SketchPackage.Literals.SKETCH_LABEL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<EAttribute> getAttributes() { |
| if (attributes == null) { |
| attributes = new EObjectResolvingEList<EAttribute>(EAttribute.class, this, SketchPackage.SKETCH_LABEL__ATTRIBUTES); |
| } |
| return attributes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isExternal() { |
| return external; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExternal(boolean newExternal) { |
| boolean oldExternal = external; |
| external = newExternal; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SketchPackage.SKETCH_LABEL__EXTERNAL, oldExternal, external)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case SketchPackage.SKETCH_LABEL__ATTRIBUTES: |
| return getAttributes(); |
| case SketchPackage.SKETCH_LABEL__EXTERNAL: |
| return isExternal() ? Boolean.TRUE : Boolean.FALSE; |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case SketchPackage.SKETCH_LABEL__ATTRIBUTES: |
| getAttributes().clear(); |
| getAttributes().addAll((Collection<? extends EAttribute>) newValue); |
| return; |
| case SketchPackage.SKETCH_LABEL__EXTERNAL: |
| setExternal(((Boolean) newValue).booleanValue()); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case SketchPackage.SKETCH_LABEL__ATTRIBUTES: |
| getAttributes().clear(); |
| return; |
| case SketchPackage.SKETCH_LABEL__EXTERNAL: |
| setExternal(EXTERNAL_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case SketchPackage.SKETCH_LABEL__ATTRIBUTES: |
| return attributes != null && !attributes.isEmpty(); |
| case SketchPackage.SKETCH_LABEL__EXTERNAL: |
| return external != EXTERNAL_EDEFAULT; |
| } |
| 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(" (external: "); //$NON-NLS-1$ |
| result.append(external); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SketchLabelImpl |