1 /** 2 * Copyright (c) 2010, 2015 BestSolution.at and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation 13 * IBM Corporation - initial API and implementation 14 */ 15 package org.eclipse.e4.ui.model.fragment.impl; 16 17 import java.util.Collection; 18 import java.util.List; 19 import org.eclipse.e4.ui.model.application.MApplicationElement; 20 import org.eclipse.e4.ui.model.fragment.MModelFragment; 21 import org.eclipse.e4.ui.model.fragment.MModelFragments; 22 import org.eclipse.emf.common.notify.NotificationChain; 23 import org.eclipse.emf.common.util.EList; 24 import org.eclipse.emf.ecore.EClass; 25 import org.eclipse.emf.ecore.InternalEObject; 26 import org.eclipse.emf.ecore.util.EObjectContainmentEList; 27 import org.eclipse.emf.ecore.util.InternalEList; 28 29 /** 30 * <!-- begin-user-doc --> 31 * An implementation of the model object '<em><b>Model Fragments</b></em>'. 32 * <!-- end-user-doc --> 33 * <p> 34 * The following features are implemented: 35 * </p> 36 * <ul> 37 * <li>{@link org.eclipse.e4.ui.model.fragment.impl.ModelFragmentsImpl#getImports <em>Imports</em>}</li> 38 * <li>{@link org.eclipse.e4.ui.model.fragment.impl.ModelFragmentsImpl#getFragments <em>Fragments</em>}</li> 39 * </ul> 40 * 41 * @since 1.0 42 * @generated 43 */ 44 public class ModelFragmentsImpl extends org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container 45 implements MModelFragments { 46 /** 47 * The cached value of the '{@link #getImports() <em>Imports</em>}' containment reference list. 48 * <!-- begin-user-doc --> 49 * <!-- end-user-doc --> 50 * @see #getImports() 51 * @generated 52 * @ordered 53 */ 54 protected EList<MApplicationElement> imports; 55 56 /** 57 * The cached value of the '{@link #getFragments() <em>Fragments</em>}' containment reference list. 58 * <!-- begin-user-doc --> 59 * <!-- end-user-doc --> 60 * @see #getFragments() 61 * @generated 62 * @ordered 63 */ 64 protected EList<MModelFragment> fragments; 65 66 /** 67 * <!-- begin-user-doc --> 68 * <!-- end-user-doc --> 69 * @generated 70 */ ModelFragmentsImpl()71 protected ModelFragmentsImpl() { 72 super(); 73 } 74 75 /** 76 * <!-- begin-user-doc --> 77 * <!-- end-user-doc --> 78 * @generated 79 */ 80 @Override eStaticClass()81 protected EClass eStaticClass() { 82 return FragmentPackageImpl.Literals.MODEL_FRAGMENTS; 83 } 84 85 /** 86 * <!-- begin-user-doc --> 87 * <!-- end-user-doc --> 88 * @generated 89 */ 90 @Override getImports()91 public List<MApplicationElement> getImports() { 92 if (imports == null) { 93 imports = new EObjectContainmentEList<MApplicationElement>(MApplicationElement.class, this, 94 FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS); 95 } 96 return imports; 97 } 98 99 /** 100 * <!-- begin-user-doc --> 101 * <!-- end-user-doc --> 102 * @generated 103 */ 104 @Override getFragments()105 public List<MModelFragment> getFragments() { 106 if (fragments == null) { 107 fragments = new EObjectContainmentEList<MModelFragment>(MModelFragment.class, this, 108 FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS); 109 } 110 return fragments; 111 } 112 113 /** 114 * <!-- begin-user-doc --> 115 * <!-- end-user-doc --> 116 * @generated 117 */ 118 @Override eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)119 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { 120 switch (featureID) { 121 case FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS: 122 return ((InternalEList<?>) getImports()).basicRemove(otherEnd, msgs); 123 case FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS: 124 return ((InternalEList<?>) getFragments()).basicRemove(otherEnd, msgs); 125 default: 126 return super.eInverseRemove(otherEnd, featureID, msgs); 127 } 128 } 129 130 /** 131 * <!-- begin-user-doc --> 132 * <!-- end-user-doc --> 133 * @generated 134 */ 135 @Override eGet(int featureID, boolean resolve, boolean coreType)136 public Object eGet(int featureID, boolean resolve, boolean coreType) { 137 switch (featureID) { 138 case FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS: 139 return getImports(); 140 case FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS: 141 return getFragments(); 142 default: 143 return super.eGet(featureID, resolve, coreType); 144 } 145 } 146 147 /** 148 * <!-- begin-user-doc --> 149 * <!-- end-user-doc --> 150 * @generated 151 */ 152 @SuppressWarnings("unchecked") 153 @Override eSet(int featureID, Object newValue)154 public void eSet(int featureID, Object newValue) { 155 switch (featureID) { 156 case FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS: 157 getImports().clear(); 158 getImports().addAll((Collection<? extends MApplicationElement>) newValue); 159 return; 160 case FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS: 161 getFragments().clear(); 162 getFragments().addAll((Collection<? extends MModelFragment>) newValue); 163 return; 164 default: 165 super.eSet(featureID, newValue); 166 return; 167 } 168 } 169 170 /** 171 * <!-- begin-user-doc --> 172 * <!-- end-user-doc --> 173 * @generated 174 */ 175 @Override eUnset(int featureID)176 public void eUnset(int featureID) { 177 switch (featureID) { 178 case FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS: 179 getImports().clear(); 180 return; 181 case FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS: 182 getFragments().clear(); 183 return; 184 default: 185 super.eUnset(featureID); 186 return; 187 } 188 } 189 190 /** 191 * <!-- begin-user-doc --> 192 * <!-- end-user-doc --> 193 * @generated 194 */ 195 @Override eIsSet(int featureID)196 public boolean eIsSet(int featureID) { 197 switch (featureID) { 198 case FragmentPackageImpl.MODEL_FRAGMENTS__IMPORTS: 199 return imports != null && !imports.isEmpty(); 200 case FragmentPackageImpl.MODEL_FRAGMENTS__FRAGMENTS: 201 return fragments != null && !fragments.isEmpty(); 202 default: 203 return super.eIsSet(featureID); 204 } 205 } 206 207 } //ModelFragmentsImpl 208