| /** |
| * <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: OutlineBehaviorImpl.java,v 1.6 2009/02/17 21:48:07 ewillink Exp $ |
| */ |
| package org.eclipse.qvt.declarative.editor.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.qvt.declarative.editor.AbstractOutlineElement; |
| import org.eclipse.qvt.declarative.editor.EditorPackage; |
| import org.eclipse.qvt.declarative.editor.OutlineBehavior; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Outline Behavior</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.OutlineBehaviorImpl#getElements <em>Elements</em>}</li> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.OutlineBehaviorImpl#isHidden <em>Hidden</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class OutlineBehaviorImpl extends BehaviorImpl implements OutlineBehavior { |
| /** |
| * The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getElements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<AbstractOutlineElement> elements; |
| |
| /** |
| * The default value of the '{@link #isHidden() <em>Hidden</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHidden() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean HIDDEN_EDEFAULT = false; |
| /** |
| * The cached value of the '{@link #isHidden() <em>Hidden</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isHidden() |
| * @generated |
| * @ordered |
| */ |
| protected boolean hidden = HIDDEN_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected OutlineBehaviorImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EditorPackage.Literals.OUTLINE_BEHAVIOR; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<AbstractOutlineElement> getElements() { |
| if (elements == null) { |
| elements = new EObjectContainmentEList.Unsettable<AbstractOutlineElement>(AbstractOutlineElement.class, this, EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS); |
| } |
| return elements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void unsetElements() { |
| if (elements != null) ((InternalEList.Unsettable<?>)elements).unset(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isSetElements() { |
| return elements != null && ((InternalEList.Unsettable<?>)elements).isSet(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isHidden() { |
| return hidden; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setHidden(boolean newHidden) { |
| boolean oldHidden = hidden; |
| hidden = newHidden; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.OUTLINE_BEHAVIOR__HIDDEN, oldHidden, hidden)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS: |
| return ((InternalEList<?>)getElements()).basicRemove(otherEnd, 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 EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS: |
| return getElements(); |
| case EditorPackage.OUTLINE_BEHAVIOR__HIDDEN: |
| return isHidden(); |
| } |
| 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 EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS: |
| getElements().clear(); |
| getElements().addAll((Collection<? extends AbstractOutlineElement>)newValue); |
| return; |
| case EditorPackage.OUTLINE_BEHAVIOR__HIDDEN: |
| setHidden((Boolean)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS: |
| unsetElements(); |
| return; |
| case EditorPackage.OUTLINE_BEHAVIOR__HIDDEN: |
| setHidden(HIDDEN_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EditorPackage.OUTLINE_BEHAVIOR__ELEMENTS: |
| return isSetElements(); |
| case EditorPackage.OUTLINE_BEHAVIOR__HIDDEN: |
| return hidden != HIDDEN_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(" (hidden: "); |
| result.append(hidden); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //OutlineBehaviorImpl |