| /******************************************************************************* |
| * Copyright (c) 2009, 2019 Xored Software Inc and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.debug.impl; |
| |
| import org.eclipse.rcptt.core.scenario.impl.NamedElementImpl; |
| |
| import org.eclipse.rcptt.debug.DebugPackage; |
| import org.eclipse.rcptt.debug.LaunchConfiguration; |
| import org.eclipse.rcptt.debug.LaunchType; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Launch Type</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.debug.impl.LaunchTypeImpl#getImage <em>Image</em>}</li> |
| * <li>{@link org.eclipse.rcptt.debug.impl.LaunchTypeImpl#getConfigurations <em>Configurations</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class LaunchTypeImpl extends NamedElementImpl implements LaunchType { |
| /** |
| * The default value of the '{@link #getImage() <em>Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImage() |
| * @generated |
| * @ordered |
| */ |
| protected static final byte[] IMAGE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getImage() <em>Image</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImage() |
| * @generated |
| * @ordered |
| */ |
| protected byte[] image = IMAGE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getConfigurations() <em>Configurations</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getConfigurations() |
| * @generated |
| * @ordered |
| */ |
| protected EList<LaunchConfiguration> configurations; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LaunchTypeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DebugPackage.Literals.LAUNCH_TYPE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public byte[] getImage() { |
| return image; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setImage(byte[] newImage) { |
| byte[] oldImage = image; |
| image = newImage; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DebugPackage.LAUNCH_TYPE__IMAGE, oldImage, image)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<LaunchConfiguration> getConfigurations() { |
| if (configurations == null) { |
| configurations = new EObjectContainmentEList<LaunchConfiguration>(LaunchConfiguration.class, this, DebugPackage.LAUNCH_TYPE__CONFIGURATIONS); |
| } |
| return configurations; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DebugPackage.LAUNCH_TYPE__CONFIGURATIONS: |
| return ((InternalEList<?>)getConfigurations()).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 DebugPackage.LAUNCH_TYPE__IMAGE: |
| return getImage(); |
| case DebugPackage.LAUNCH_TYPE__CONFIGURATIONS: |
| return getConfigurations(); |
| } |
| 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 DebugPackage.LAUNCH_TYPE__IMAGE: |
| setImage((byte[])newValue); |
| return; |
| case DebugPackage.LAUNCH_TYPE__CONFIGURATIONS: |
| getConfigurations().clear(); |
| getConfigurations().addAll((Collection<? extends LaunchConfiguration>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DebugPackage.LAUNCH_TYPE__IMAGE: |
| setImage(IMAGE_EDEFAULT); |
| return; |
| case DebugPackage.LAUNCH_TYPE__CONFIGURATIONS: |
| getConfigurations().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DebugPackage.LAUNCH_TYPE__IMAGE: |
| return IMAGE_EDEFAULT == null ? image != null : !IMAGE_EDEFAULT.equals(image); |
| case DebugPackage.LAUNCH_TYPE__CONFIGURATIONS: |
| return configurations != null && !configurations.isEmpty(); |
| } |
| 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(" (image: "); |
| result.append(image); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LaunchTypeImpl |