ndai | 1a43356 | 2007-05-10 04:50:58 +0000 | [diff] [blame] | 1 | /*************************************************************************************************** |
| 2 | * Copyright (c) 2005-2007 Eteration A.S. and Gorkem Ercan All rights reserved. This program and the |
| 3 | * accompanying materials are made available under the terms of the Eclipse Public License v1.0 |
| 4 | * which accompanies this distribution, and is available at |
| 5 | * http://www.eclipse.org/legal/epl-v10.html |
| 6 | * |
| 7 | * Contributors: Gorkem Ercan |
| 8 | * Contributors: Naci Dai |
| 9 | * |
| 10 | **************************************************************************************************/ |
| 11 | |
| 12 | package org.eclipse.jst.server.generic.internal.servertype.definition.impl; |
| 13 | |
| 14 | import java.util.Collection; |
| 15 | |
| 16 | import org.eclipse.emf.common.notify.Notification; |
| 17 | import org.eclipse.emf.common.notify.NotificationChain; |
| 18 | import org.eclipse.emf.common.util.EList; |
| 19 | import org.eclipse.emf.ecore.EClass; |
| 20 | import org.eclipse.emf.ecore.InternalEObject; |
| 21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 22 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 23 | import org.eclipse.emf.ecore.util.BasicFeatureMap; |
| 24 | import org.eclipse.emf.ecore.util.FeatureMap; |
| 25 | import org.eclipse.emf.ecore.util.InternalEList; |
| 26 | import org.eclipse.jst.server.generic.internal.servertype.definition.ServerTypePackage; |
| 27 | import org.eclipse.jst.server.generic.servertype.definition.FilesetType; |
| 28 | |
| 29 | /** |
| 30 | * <!-- begin-user-doc --> |
| 31 | * An implementation of the model object '<em><b>Fileset Type</b></em>'. |
| 32 | * <!-- end-user-doc --> |
| 33 | * <p> |
| 34 | * The following features are implemented: |
| 35 | * <ul> |
| 36 | * <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.FilesetTypeImpl#getGroup <em>Group</em>}</li> |
| 37 | * <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.FilesetTypeImpl#getInclude <em>Include</em>}</li> |
| 38 | * <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.FilesetTypeImpl#getExclude <em>Exclude</em>}</li> |
| 39 | * <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.FilesetTypeImpl#isCasesensitive <em>Casesensitive</em>}</li> |
| 40 | * <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.FilesetTypeImpl#getDir <em>Dir</em>}</li> |
| 41 | * </ul> |
| 42 | * </p> |
| 43 | * |
| 44 | * @generated |
| 45 | */ |
| 46 | public class FilesetTypeImpl extends EObjectImpl implements FilesetType { |
| 47 | /** |
| 48 | * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @see #getGroup() |
| 52 | * @generated |
| 53 | * @ordered |
| 54 | */ |
| 55 | protected FeatureMap group; |
| 56 | |
| 57 | /** |
| 58 | * The default value of the '{@link #isCasesensitive() <em>Casesensitive</em>}' attribute. |
| 59 | * <!-- begin-user-doc --> |
| 60 | * <!-- end-user-doc --> |
| 61 | * @see #isCasesensitive() |
| 62 | * @generated |
| 63 | * @ordered |
| 64 | */ |
| 65 | protected static final boolean CASESENSITIVE_EDEFAULT = false; |
| 66 | |
| 67 | /** |
| 68 | * The cached value of the '{@link #isCasesensitive() <em>Casesensitive</em>}' attribute. |
| 69 | * <!-- begin-user-doc --> |
| 70 | * <!-- end-user-doc --> |
| 71 | * @see #isCasesensitive() |
| 72 | * @generated |
| 73 | * @ordered |
| 74 | */ |
| 75 | protected boolean casesensitive = CASESENSITIVE_EDEFAULT; |
| 76 | |
| 77 | /** |
| 78 | * This is true if the Casesensitive attribute has been set. |
| 79 | * <!-- begin-user-doc --> |
| 80 | * <!-- end-user-doc --> |
| 81 | * @generated |
| 82 | * @ordered |
| 83 | */ |
| 84 | protected boolean casesensitiveESet; |
| 85 | |
| 86 | /** |
| 87 | * The default value of the '{@link #getDir() <em>Dir</em>}' attribute. |
| 88 | * <!-- begin-user-doc --> |
| 89 | * <!-- end-user-doc --> |
| 90 | * @see #getDir() |
| 91 | * @generated |
| 92 | * @ordered |
| 93 | */ |
| 94 | protected static final String DIR_EDEFAULT = null; |
| 95 | |
| 96 | /** |
| 97 | * The cached value of the '{@link #getDir() <em>Dir</em>}' attribute. |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @see #getDir() |
| 101 | * @generated |
| 102 | * @ordered |
| 103 | */ |
| 104 | protected String dir = DIR_EDEFAULT; |
| 105 | |
| 106 | /** |
| 107 | * <!-- begin-user-doc --> |
| 108 | * <!-- end-user-doc --> |
| 109 | * @generated |
| 110 | */ |
| 111 | protected FilesetTypeImpl() { |
| 112 | super(); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * <!-- begin-user-doc --> |
| 117 | * <!-- end-user-doc --> |
| 118 | * @generated |
| 119 | */ |
| 120 | protected EClass eStaticClass() { |
| 121 | return ServerTypePackage.Literals.FILESET_TYPE; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @generated |
| 128 | */ |
| 129 | public FeatureMap getGroup() { |
| 130 | if (group == null) { |
| 131 | group = new BasicFeatureMap(this, ServerTypePackage.FILESET_TYPE__GROUP); |
| 132 | } |
| 133 | return group; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * <!-- begin-user-doc --> |
| 138 | * <!-- end-user-doc --> |
| 139 | * @generated |
| 140 | */ |
| 141 | public EList getInclude() { |
| 142 | return getGroup().list(ServerTypePackage.Literals.FILESET_TYPE__INCLUDE); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * <!-- begin-user-doc --> |
| 147 | * <!-- end-user-doc --> |
| 148 | * @generated |
| 149 | */ |
| 150 | public EList getExclude() { |
| 151 | return getGroup().list(ServerTypePackage.Literals.FILESET_TYPE__EXCLUDE); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | public boolean isCasesensitive() { |
| 160 | return casesensitive; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * <!-- begin-user-doc --> |
| 165 | * <!-- end-user-doc --> |
| 166 | * @generated |
| 167 | */ |
| 168 | public void setCasesensitive(boolean newCasesensitive) { |
| 169 | boolean oldCasesensitive = casesensitive; |
| 170 | casesensitive = newCasesensitive; |
| 171 | boolean oldCasesensitiveESet = casesensitiveESet; |
| 172 | casesensitiveESet = true; |
| 173 | if (eNotificationRequired()) |
| 174 | eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.FILESET_TYPE__CASESENSITIVE, oldCasesensitive, casesensitive, !oldCasesensitiveESet)); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | public void unsetCasesensitive() { |
| 183 | boolean oldCasesensitive = casesensitive; |
| 184 | boolean oldCasesensitiveESet = casesensitiveESet; |
| 185 | casesensitive = CASESENSITIVE_EDEFAULT; |
| 186 | casesensitiveESet = false; |
| 187 | if (eNotificationRequired()) |
| 188 | eNotify(new ENotificationImpl(this, Notification.UNSET, ServerTypePackage.FILESET_TYPE__CASESENSITIVE, oldCasesensitive, CASESENSITIVE_EDEFAULT, oldCasesensitiveESet)); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | public boolean isSetCasesensitive() { |
| 197 | return casesensitiveESet; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * <!-- begin-user-doc --> |
| 202 | * <!-- end-user-doc --> |
| 203 | * @generated |
| 204 | */ |
| 205 | public String getDir() { |
| 206 | return dir; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * <!-- begin-user-doc --> |
| 211 | * <!-- end-user-doc --> |
| 212 | * @generated |
| 213 | */ |
| 214 | public void setDir(String newDir) { |
| 215 | String oldDir = dir; |
| 216 | dir = newDir; |
| 217 | if (eNotificationRequired()) |
| 218 | eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.FILESET_TYPE__DIR, oldDir, dir)); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * <!-- begin-user-doc --> |
| 223 | * <!-- end-user-doc --> |
| 224 | * @generated |
| 225 | */ |
| 226 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 227 | switch (featureID) { |
| 228 | case ServerTypePackage.FILESET_TYPE__GROUP: |
| 229 | return ((InternalEList)getGroup()).basicRemove(otherEnd, msgs); |
| 230 | case ServerTypePackage.FILESET_TYPE__INCLUDE: |
| 231 | return ((InternalEList)getInclude()).basicRemove(otherEnd, msgs); |
| 232 | case ServerTypePackage.FILESET_TYPE__EXCLUDE: |
| 233 | return ((InternalEList)getExclude()).basicRemove(otherEnd, msgs); |
| 234 | } |
| 235 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * <!-- begin-user-doc --> |
| 240 | * <!-- end-user-doc --> |
| 241 | * @generated |
| 242 | */ |
| 243 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 244 | switch (featureID) { |
| 245 | case ServerTypePackage.FILESET_TYPE__GROUP: |
| 246 | if (coreType) return getGroup(); |
| 247 | return ((FeatureMap.Internal)getGroup()).getWrapper(); |
| 248 | case ServerTypePackage.FILESET_TYPE__INCLUDE: |
| 249 | return getInclude(); |
| 250 | case ServerTypePackage.FILESET_TYPE__EXCLUDE: |
| 251 | return getExclude(); |
| 252 | case ServerTypePackage.FILESET_TYPE__CASESENSITIVE: |
| 253 | return isCasesensitive() ? Boolean.TRUE : Boolean.FALSE; |
| 254 | case ServerTypePackage.FILESET_TYPE__DIR: |
| 255 | return getDir(); |
| 256 | } |
| 257 | return super.eGet(featureID, resolve, coreType); |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * <!-- begin-user-doc --> |
| 262 | * <!-- end-user-doc --> |
| 263 | * @generated |
| 264 | */ |
| 265 | public void eSet(int featureID, Object newValue) { |
| 266 | switch (featureID) { |
| 267 | case ServerTypePackage.FILESET_TYPE__GROUP: |
| 268 | ((FeatureMap.Internal)getGroup()).set(newValue); |
| 269 | return; |
| 270 | case ServerTypePackage.FILESET_TYPE__INCLUDE: |
| 271 | getInclude().clear(); |
| 272 | getInclude().addAll((Collection)newValue); |
| 273 | return; |
| 274 | case ServerTypePackage.FILESET_TYPE__EXCLUDE: |
| 275 | getExclude().clear(); |
| 276 | getExclude().addAll((Collection)newValue); |
| 277 | return; |
| 278 | case ServerTypePackage.FILESET_TYPE__CASESENSITIVE: |
| 279 | setCasesensitive(((Boolean)newValue).booleanValue()); |
| 280 | return; |
| 281 | case ServerTypePackage.FILESET_TYPE__DIR: |
| 282 | setDir((String)newValue); |
| 283 | return; |
| 284 | } |
| 285 | super.eSet(featureID, newValue); |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * <!-- begin-user-doc --> |
| 290 | * <!-- end-user-doc --> |
| 291 | * @generated |
| 292 | */ |
| 293 | public void eUnset(int featureID) { |
| 294 | switch (featureID) { |
| 295 | case ServerTypePackage.FILESET_TYPE__GROUP: |
| 296 | getGroup().clear(); |
| 297 | return; |
| 298 | case ServerTypePackage.FILESET_TYPE__INCLUDE: |
| 299 | getInclude().clear(); |
| 300 | return; |
| 301 | case ServerTypePackage.FILESET_TYPE__EXCLUDE: |
| 302 | getExclude().clear(); |
| 303 | return; |
| 304 | case ServerTypePackage.FILESET_TYPE__CASESENSITIVE: |
| 305 | unsetCasesensitive(); |
| 306 | return; |
| 307 | case ServerTypePackage.FILESET_TYPE__DIR: |
| 308 | setDir(DIR_EDEFAULT); |
| 309 | return; |
| 310 | } |
| 311 | super.eUnset(featureID); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * <!-- begin-user-doc --> |
| 316 | * <!-- end-user-doc --> |
| 317 | * @generated |
| 318 | */ |
| 319 | public boolean eIsSet(int featureID) { |
| 320 | switch (featureID) { |
| 321 | case ServerTypePackage.FILESET_TYPE__GROUP: |
| 322 | return group != null && !group.isEmpty(); |
| 323 | case ServerTypePackage.FILESET_TYPE__INCLUDE: |
| 324 | return !getInclude().isEmpty(); |
| 325 | case ServerTypePackage.FILESET_TYPE__EXCLUDE: |
| 326 | return !getExclude().isEmpty(); |
| 327 | case ServerTypePackage.FILESET_TYPE__CASESENSITIVE: |
| 328 | return isSetCasesensitive(); |
| 329 | case ServerTypePackage.FILESET_TYPE__DIR: |
| 330 | return DIR_EDEFAULT == null ? dir != null : !DIR_EDEFAULT.equals(dir); |
| 331 | } |
| 332 | return super.eIsSet(featureID); |
| 333 | } |
| 334 | |
| 335 | /** |
| 336 | * <!-- begin-user-doc --> |
| 337 | * <!-- end-user-doc --> |
| 338 | * @generated |
| 339 | */ |
| 340 | public String toString() { |
| 341 | if (eIsProxy()) return super.toString(); |
| 342 | |
| 343 | StringBuffer result = new StringBuffer(super.toString()); |
| 344 | result.append(" (group: "); |
| 345 | result.append(group); |
| 346 | result.append(", casesensitive: "); |
| 347 | if (casesensitiveESet) result.append(casesensitive); else result.append("<unset>"); |
| 348 | result.append(", dir: "); |
| 349 | result.append(dir); |
| 350 | result.append(')'); |
| 351 | return result.toString(); |
| 352 | } |
| 353 | |
| 354 | } //FilesetTypeImpl |