~ubuntu-branches/ubuntu/vivid/eclipse-wtp/vivid

« back to all changes in this revision

Viewing changes to .pc/genmodel-customizations.patch/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentResourceImpl.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2013-06-28 08:42:01 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130628084201-houvqyt5uc6a3p27
Tags: 3.5.0-1
* New upstream release.
* Refreshed d/patches:
  - debian-custom-build.patch
  - regenerate-xpath2-parser.patch.
* Add patch for compatibility with rhino 1.7R4.
* Regenerate code from EMF models.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * <copyright>
 
3
 * </copyright>
 
4
 *
 
5
 * $Id: ComponentResourceImpl.java,v 1.5 2011/08/10 21:40:14 rsanchez Exp $
 
6
 */
 
7
package org.eclipse.wst.common.componentcore.internal.impl;
 
8
 
 
9
import java.util.Collection;
 
10
 
 
11
import org.eclipse.core.resources.IProject;
 
12
import org.eclipse.core.runtime.IPath;
 
13
import org.eclipse.emf.common.notify.Notification;
 
14
import org.eclipse.emf.common.notify.NotificationChain;
 
15
import org.eclipse.emf.common.util.EList;
 
16
import org.eclipse.emf.ecore.EClass;
 
17
import org.eclipse.emf.ecore.EStructuralFeature;
 
18
import org.eclipse.emf.ecore.InternalEObject;
 
19
import org.eclipse.emf.ecore.impl.ENotificationImpl;
 
20
import org.eclipse.emf.ecore.impl.EObjectImpl;
 
21
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
 
22
import org.eclipse.emf.ecore.util.EcoreUtil;
 
23
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
 
24
import org.eclipse.wst.common.componentcore.internal.ComponentcorePackage;
 
25
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
 
26
import org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil.ESynchronizedAdapterList;
 
27
 
 
28
/**
 
29
 * <!-- begin-user-doc -->
 
30
 * An implementation of the model object '<em><b>Workbench Module Resource</b></em>'.
 
31
 * <!-- end-user-doc -->
 
32
 * <p>
 
33
 * The following features are implemented:
 
34
 * <ul>
 
35
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getSourcePath <em>Source Path</em>}</li>
 
36
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getRuntimePath <em>Runtime Path</em>}</li>
 
37
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getExclusions <em>Exclusions</em>}</li>
 
38
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getComponent <em>Component</em>}</li>
 
39
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getResourceType <em>Resource Type</em>}</li>
 
40
 *   <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getTag <em>Tag</em>}</li>
 
41
 * </ul>
 
42
 * </p>
 
43
 *
 
44
 * @generated
 
45
 */
 
46
public class ComponentResourceImpl extends EObjectImpl implements ComponentResource {
 
47
        /**
 
48
         * The default value of the '{@link #getSourcePath() <em>Source Path</em>}' attribute.
 
49
         * <!-- begin-user-doc -->
 
50
         * <!-- end-user-doc -->
 
51
         * @see #getSourcePath()
 
52
         * @generated
 
53
         * @ordered
 
54
         */
 
55
        protected static final IPath SOURCE_PATH_EDEFAULT = null;
 
56
 
 
57
        /**
 
58
         * The cached value of the '{@link #getSourcePath() <em>Source Path</em>}' attribute.
 
59
         * <!-- begin-user-doc -->
 
60
         * <!-- end-user-doc -->
 
61
         * @see #getSourcePath()
 
62
         * @generated
 
63
         * @ordered
 
64
         */
 
65
        protected IPath sourcePath = SOURCE_PATH_EDEFAULT;
 
66
 
 
67
        /**
 
68
         * The default value of the '{@link #getRuntimePath() <em>Runtime Path</em>}' attribute.
 
69
         * <!-- begin-user-doc -->
 
70
         * <!-- end-user-doc -->
 
71
         * @see #getRuntimePath()
 
72
         * @generated
 
73
         * @ordered
 
74
         */
 
75
        protected static final IPath RUNTIME_PATH_EDEFAULT = null;
 
76
 
 
77
        /**
 
78
         * The cached value of the '{@link #getRuntimePath() <em>Runtime Path</em>}' attribute.
 
79
         * <!-- begin-user-doc -->
 
80
         * <!-- end-user-doc -->
 
81
         * @see #getRuntimePath()
 
82
         * @generated
 
83
         * @ordered
 
84
         */
 
85
        protected IPath runtimePath = RUNTIME_PATH_EDEFAULT;
 
86
 
 
87
        /**
 
88
         * The cached value of the '{@link #getExclusions() <em>Exclusions</em>}' attribute list.
 
89
         * <!-- begin-user-doc -->
 
90
         * <!-- end-user-doc -->
 
91
         * @see #getExclusions()
 
92
         * @generated
 
93
         * @ordered
 
94
         */
 
95
        protected EList exclusions;
 
96
        
 
97
        /**
 
98
         * The default value of the '{@link #getResourceType() <em>Resource Type</em>}' attribute.
 
99
         * <!-- begin-user-doc -->
 
100
         * <!-- end-user-doc -->
 
101
         * @see #getResourceType()
 
102
         * @generated
 
103
         * @ordered
 
104
         */
 
105
        protected static final String RESOURCE_TYPE_EDEFAULT = "";
 
106
 
 
107
        /**
 
108
         * The cached value of the '{@link #getResourceType() <em>Resource Type</em>}' attribute.
 
109
         * <!-- begin-user-doc -->
 
110
         * <!-- end-user-doc -->
 
111
         * @see #getResourceType()
 
112
         * @generated
 
113
         * @ordered
 
114
         */
 
115
        protected String resourceType = RESOURCE_TYPE_EDEFAULT;
 
116
 
 
117
        /**
 
118
         * The default value of the '{@link #getTag() <em>Tag</em>}' attribute.
 
119
         * <!-- begin-user-doc -->
 
120
         * <!-- end-user-doc -->
 
121
         * @see #getTag()
 
122
         * @generated
 
123
         * @ordered
 
124
         */
 
125
        protected static final String TAG_EDEFAULT = null;
 
126
 
 
127
        /**
 
128
         * The cached value of the '{@link #getTag() <em>Tag</em>}' attribute.
 
129
         * <!-- begin-user-doc -->
 
130
         * <!-- end-user-doc -->
 
131
         * @see #getTag()
 
132
         * @generated
 
133
         * @ordered
 
134
         */
 
135
        protected String tag = TAG_EDEFAULT;
 
136
 
 
137
        protected IProject owningProject;
 
138
        protected static final int VIRTUAL = 0;
 
139
        protected static final int PERSISTED = 1;
 
140
        
 
141
        private int type = PERSISTED;
 
142
 
 
143
        /**
 
144
         * <!-- begin-user-doc -->
 
145
         * <!-- end-user-doc -->
 
146
         * @generated
 
147
         */
 
148
        protected ComponentResourceImpl() {
 
149
                super();
 
150
        }
 
151
 
 
152
        /**
 
153
         * <!-- begin-user-doc -->
 
154
         * <!-- end-user-doc -->
 
155
         * @generated
 
156
         */
 
157
        protected EClass eStaticClass() {
 
158
                return ComponentcorePackage.eINSTANCE.getComponentResource();
 
159
        }
 
160
 
 
161
        /**
 
162
         * <!-- begin-user-doc -->
 
163
         * <!-- end-user-doc -->
 
164
         * @generated
 
165
         */
 
166
        public IPath getSourcePath() {
 
167
                return sourcePath;
 
168
        }
 
169
 
 
170
        /**
 
171
         * <!-- begin-user-doc -->
 
172
         * <!-- end-user-doc -->
 
173
         * @generated
 
174
         */
 
175
        public void setSourcePath(IPath newSourcePath) {
 
176
                IPath oldSourcePath = sourcePath;
 
177
                sourcePath = newSourcePath;
 
178
                if (eNotificationRequired())
 
179
                        eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__SOURCE_PATH, oldSourcePath, sourcePath));
 
180
        }
 
181
 
 
182
        /**
 
183
         * <!-- begin-user-doc -->
 
184
         * <!-- end-user-doc -->
 
185
         * @generated
 
186
         */
 
187
        public IPath getRuntimePath() {
 
188
                return runtimePath;
 
189
        }
 
190
 
 
191
        /**
 
192
         * <!-- begin-user-doc -->
 
193
         * <!-- end-user-doc -->
 
194
         * @generated
 
195
         */
 
196
        public void setRuntimePath(IPath newRuntimePath) {
 
197
                IPath oldRuntimePath = runtimePath;
 
198
                runtimePath = newRuntimePath;
 
199
                if (eNotificationRequired())
 
200
                        eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__RUNTIME_PATH, oldRuntimePath, runtimePath));
 
201
        }
 
202
 
 
203
        /**
 
204
         * <!-- begin-user-doc -->
 
205
         * <!-- end-user-doc -->
 
206
         * @generated
 
207
         */
 
208
        public EList getExclusions() {
 
209
                if (exclusions == null) {
 
210
                        exclusions = new EDataTypeUniqueEList(String.class, this, ComponentcorePackage.COMPONENT_RESOURCE__EXCLUSIONS);
 
211
                }
 
212
                return exclusions;
 
213
        }
 
214
 
 
215
        /**
 
216
         * <!-- begin-user-doc -->
 
217
         * <!-- end-user-doc -->
 
218
         * @generated
 
219
         */
 
220
        public WorkbenchComponent getComponent() {
 
221
                if (eContainerFeatureID != ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT) return null;
 
222
                return (WorkbenchComponent)eContainer;
 
223
        }
 
224
 
 
225
        /**
 
226
         * <!-- begin-user-doc -->
 
227
         * <!-- end-user-doc -->
 
228
         * @generated
 
229
         */
 
230
        public void setComponent(WorkbenchComponent newComponent) {
 
231
                if (newComponent != eContainer || (eContainerFeatureID != ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT && newComponent != null)) {
 
232
                        if (EcoreUtil.isAncestor(this, newComponent))
 
233
                                throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
 
234
                        NotificationChain msgs = null;
 
235
                        if (eContainer != null)
 
236
                                msgs = eBasicRemoveFromContainer(msgs);
 
237
                        if (newComponent != null)
 
238
                                msgs = ((InternalEObject)newComponent).eInverseAdd(this, ComponentcorePackage.WORKBENCH_COMPONENT__RESOURCES, WorkbenchComponent.class, msgs);
 
239
                        msgs = eBasicSetContainer((InternalEObject)newComponent, ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT, msgs);
 
240
                        if (msgs != null) msgs.dispatch();
 
241
                }
 
242
                else if (eNotificationRequired())
 
243
                        eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT, newComponent, newComponent));
 
244
        }
 
245
 
 
246
        /**
 
247
         * <!-- begin-user-doc -->
 
248
         * <!-- end-user-doc -->
 
249
         * @generated
 
250
         */
 
251
        public String getResourceType() {
 
252
                return resourceType;
 
253
        }
 
254
 
 
255
        /**
 
256
         * <!-- begin-user-doc -->
 
257
         * <!-- end-user-doc -->
 
258
         * @generated
 
259
         */
 
260
        public void setResourceType(String newResourceType) {
 
261
                String oldResourceType = resourceType;
 
262
                resourceType = newResourceType;
 
263
                if (eNotificationRequired())
 
264
                        eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE, oldResourceType, resourceType));
 
265
        }
 
266
 
 
267
        /**
 
268
         * <!-- begin-user-doc -->
 
269
         * <!-- end-user-doc -->
 
270
         * @generated
 
271
         */
 
272
        public String getTag() {
 
273
                return tag;
 
274
        }
 
275
 
 
276
        /**
 
277
         * <!-- begin-user-doc -->
 
278
         * <!-- end-user-doc -->
 
279
         * @generated
 
280
         */
 
281
        public void setTag(String newTag) {
 
282
                String oldTag = tag;
 
283
                tag = newTag;
 
284
                if (eNotificationRequired())
 
285
                        eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__TAG, oldTag, tag));
 
286
        }
 
287
 
 
288
        /**
 
289
         * <!-- begin-user-doc -->
 
290
         * <!-- end-user-doc -->
 
291
         * @generated
 
292
         */
 
293
        public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
 
294
                if (featureID >= 0) {
 
295
                        switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 
296
                                case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
297
                                        if (eContainer != null)
 
298
                                                msgs = eBasicRemoveFromContainer(msgs);
 
299
                                        return eBasicSetContainer(otherEnd, ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT, msgs);
 
300
                                default:
 
301
                                        return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
 
302
                        }
 
303
                }
 
304
                if (eContainer != null)
 
305
                        msgs = eBasicRemoveFromContainer(msgs);
 
306
                return eBasicSetContainer(otherEnd, featureID, msgs);
 
307
        }
 
308
 
 
309
        /**
 
310
         * <!-- begin-user-doc -->
 
311
         * <!-- end-user-doc -->
 
312
         * @generated
 
313
         */
 
314
        public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
 
315
                if (featureID >= 0) {
 
316
                        switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
 
317
                                case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
318
                                        return eBasicSetContainer(null, ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT, msgs);
 
319
                                default:
 
320
                                        return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
 
321
                        }
 
322
                }
 
323
                return eBasicSetContainer(null, featureID, msgs);
 
324
        }
 
325
 
 
326
        /**
 
327
         * <!-- begin-user-doc -->
 
328
         * <!-- end-user-doc -->
 
329
         * @generated
 
330
         */
 
331
        public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) {
 
332
                if (eContainerFeatureID >= 0) {
 
333
                        switch (eContainerFeatureID) {
 
334
                                case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
335
                                        return eContainer.eInverseRemove(this, ComponentcorePackage.WORKBENCH_COMPONENT__RESOURCES, WorkbenchComponent.class, msgs);
 
336
                                default:
 
337
                                        return eDynamicBasicRemoveFromContainer(msgs);
 
338
                        }
 
339
                }
 
340
                return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
 
341
        }
 
342
 
 
343
        /**
 
344
         * <!-- begin-user-doc -->
 
345
         * <!-- end-user-doc -->
 
346
         * @generated
 
347
         */
 
348
        public Object eGet(EStructuralFeature eFeature, boolean resolve) {
 
349
                switch (eDerivedStructuralFeatureID(eFeature)) {
 
350
                        case ComponentcorePackage.COMPONENT_RESOURCE__SOURCE_PATH:
 
351
                                return getSourcePath();
 
352
                        case ComponentcorePackage.COMPONENT_RESOURCE__RUNTIME_PATH:
 
353
                                return getRuntimePath();
 
354
                        case ComponentcorePackage.COMPONENT_RESOURCE__EXCLUSIONS:
 
355
                                return getExclusions();
 
356
                        case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
357
                                return getComponent();
 
358
                        case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
 
359
                                return getResourceType();
 
360
                        case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
 
361
                                return getTag();
 
362
                }
 
363
                return eDynamicGet(eFeature, resolve);
 
364
        }
 
365
 
 
366
        /**
 
367
         * <!-- begin-user-doc -->
 
368
         * <!-- end-user-doc -->
 
369
         * @generated
 
370
         */
 
371
        public void eSet(EStructuralFeature eFeature, Object newValue) {
 
372
                switch (eDerivedStructuralFeatureID(eFeature)) {
 
373
                        case ComponentcorePackage.COMPONENT_RESOURCE__SOURCE_PATH:
 
374
                                setSourcePath((IPath)newValue);
 
375
                                return;
 
376
                        case ComponentcorePackage.COMPONENT_RESOURCE__RUNTIME_PATH:
 
377
                                setRuntimePath((IPath)newValue);
 
378
                                return;
 
379
                        case ComponentcorePackage.COMPONENT_RESOURCE__EXCLUSIONS:
 
380
                                getExclusions().clear();
 
381
                                getExclusions().addAll((Collection)newValue);
 
382
                                return;
 
383
                        case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
384
                                setComponent((WorkbenchComponent)newValue);
 
385
                                return;
 
386
                        case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
 
387
                                setResourceType((String)newValue);
 
388
                                return;
 
389
                        case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
 
390
                                setTag((String)newValue);
 
391
                                return;
 
392
                }
 
393
                eDynamicSet(eFeature, newValue);
 
394
        }
 
395
 
 
396
        /**
 
397
         * <!-- begin-user-doc -->
 
398
         * <!-- end-user-doc -->
 
399
         * @generated
 
400
         */
 
401
        public void eUnset(EStructuralFeature eFeature) {
 
402
                switch (eDerivedStructuralFeatureID(eFeature)) {
 
403
                        case ComponentcorePackage.COMPONENT_RESOURCE__SOURCE_PATH:
 
404
                                setSourcePath(SOURCE_PATH_EDEFAULT);
 
405
                                return;
 
406
                        case ComponentcorePackage.COMPONENT_RESOURCE__RUNTIME_PATH:
 
407
                                setRuntimePath(RUNTIME_PATH_EDEFAULT);
 
408
                                return;
 
409
                        case ComponentcorePackage.COMPONENT_RESOURCE__EXCLUSIONS:
 
410
                                getExclusions().clear();
 
411
                                return;
 
412
                        case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
413
                                setComponent((WorkbenchComponent)null);
 
414
                                return;
 
415
                        case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
 
416
                                setResourceType(RESOURCE_TYPE_EDEFAULT);
 
417
                                return;
 
418
                        case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
 
419
                                setTag(TAG_EDEFAULT);
 
420
                                return;
 
421
                }
 
422
                eDynamicUnset(eFeature);
 
423
        }
 
424
 
 
425
        /**
 
426
         * <!-- begin-user-doc -->
 
427
         * <!-- end-user-doc -->
 
428
         * @generated
 
429
         */
 
430
        public boolean eIsSet(EStructuralFeature eFeature) {
 
431
                switch (eDerivedStructuralFeatureID(eFeature)) {
 
432
                        case ComponentcorePackage.COMPONENT_RESOURCE__SOURCE_PATH:
 
433
                                return SOURCE_PATH_EDEFAULT == null ? sourcePath != null : !SOURCE_PATH_EDEFAULT.equals(sourcePath);
 
434
                        case ComponentcorePackage.COMPONENT_RESOURCE__RUNTIME_PATH:
 
435
                                return RUNTIME_PATH_EDEFAULT == null ? runtimePath != null : !RUNTIME_PATH_EDEFAULT.equals(runtimePath);
 
436
                        case ComponentcorePackage.COMPONENT_RESOURCE__EXCLUSIONS:
 
437
                                return exclusions != null && !exclusions.isEmpty();
 
438
                        case ComponentcorePackage.COMPONENT_RESOURCE__COMPONENT:
 
439
                                return getComponent() != null;
 
440
                        case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
 
441
                                return RESOURCE_TYPE_EDEFAULT == null ? resourceType != null : !RESOURCE_TYPE_EDEFAULT.equals(resourceType);
 
442
                        case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
 
443
                                return TAG_EDEFAULT == null ? tag != null : !TAG_EDEFAULT.equals(tag);
 
444
                }
 
445
                return eDynamicIsSet(eFeature);
 
446
        }
 
447
 
 
448
        /**
 
449
         * <!-- begin-user-doc -->
 
450
         * <!-- end-user-doc -->
 
451
         * @generated
 
452
         */
 
453
        public String toString() {
 
454
                if (eIsProxy()) return super.toString();
 
455
 
 
456
                StringBuffer result = new StringBuffer(super.toString());
 
457
                result.append(" (sourcePath: ");
 
458
                result.append(sourcePath);
 
459
                result.append(", runtimePath: ");
 
460
                result.append(runtimePath);
 
461
                result.append(", exclusions: ");
 
462
                result.append(exclusions);
 
463
                result.append(", resourceType: ");
 
464
                result.append(resourceType);
 
465
                result.append(", tag: ");
 
466
                result.append(tag);
 
467
                result.append(')');
 
468
                return result.toString();
 
469
        }
 
470
 
 
471
        public int getType() {
 
472
                return type;
 
473
        }
 
474
        
 
475
        
 
476
        public void setType(int type) {
 
477
                this.type = type;
 
478
        }
 
479
 
 
480
        public IProject getOwningProject() {
 
481
                return owningProject;
 
482
        }
 
483
 
 
484
        public void setOwningProject(IProject aProject) {
 
485
                owningProject = aProject;
 
486
        }
 
487
        
 
488
        @Override
 
489
        public EList eAdapters()
 
490
          {
 
491
            if (eAdapters == null)
 
492
            {
 
493
              eAdapters =  new ESynchronizedAdapterList(this);
 
494
            }
 
495
            return eAdapters;
 
496
          }
 
497
        
 
498
 
 
499
} //ComponentResourceImpl