Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 255469 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/emf/test/core/dynamic/SimpleModelTest.java (-1 / +33 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2007 IBM Corporation and others.
4
 * Copyright (c) 2002-2009 IBM Corporation and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 33-38 Link Here
33
import org.eclipse.emf.common.EMFPlugin;
33
import org.eclipse.emf.common.EMFPlugin;
34
import org.eclipse.emf.common.util.BasicEList;
34
import org.eclipse.emf.common.util.BasicEList;
35
import org.eclipse.emf.common.util.URI;
35
import org.eclipse.emf.common.util.URI;
36
import org.eclipse.emf.ecore.EAnnotation;
36
import org.eclipse.emf.ecore.EAttribute;
37
import org.eclipse.emf.ecore.EAttribute;
37
import org.eclipse.emf.ecore.EClass;
38
import org.eclipse.emf.ecore.EClass;
38
import org.eclipse.emf.ecore.EFactory;
39
import org.eclipse.emf.ecore.EFactory;
Lines 62-67 Link Here
62
63
63
  private EAttribute employeeName;
64
  private EAttribute employeeName;
64
65
66
  private EAttribute derivedEmployeeName;
67
65
  private EAttribute employeeManager;
68
  private EAttribute employeeManager;
66
69
67
  private EClass departmentClass;
70
  private EClass departmentClass;
Lines 82-87 Link Here
82
    TestSuite ts = new TestSuite("SimpleModelTest");
85
    TestSuite ts = new TestSuite("SimpleModelTest");
83
    ts.addTest(new SimpleModelTest("testPackageAndFactory"));
86
    ts.addTest(new SimpleModelTest("testPackageAndFactory"));
84
    ts.addTest(new SimpleModelTest("testAttributes"));
87
    ts.addTest(new SimpleModelTest("testAttributes"));
88
    ts.addTest(new SimpleModelTest("testDerivedAttributes"));
85
    ts.addTest(new SimpleModelTest("testReference"));
89
    ts.addTest(new SimpleModelTest("testReference"));
86
    ts.addTest(new SimpleModelTest("testMetaData"));
90
    ts.addTest(new SimpleModelTest("testMetaData"));
87
    ts.addTest(new SimpleModelTest("testSaveAndLoad"));
91
    ts.addTest(new SimpleModelTest("testSaveAndLoad"));
Lines 111-116 Link Here
111
    employeeName.setEType(ecorePackage.getEString());
115
    employeeName.setEType(ecorePackage.getEString());
112
    employeeClass.getEStructuralFeatures().add(employeeName);
116
    employeeClass.getEStructuralFeatures().add(employeeName);
113
117
118
    derivedEmployeeName = ecoreFactory.createEAttribute();
119
    derivedEmployeeName.setName("derivedName");
120
    derivedEmployeeName.setEType(ecorePackage.getEString());
121
    derivedEmployeeName.setDerived(true);
122
    derivedEmployeeName.setTransient(true);
123
    EAnnotation eAnnotation = ecoreFactory.createEAnnotation();
124
    eAnnotation.setSource(EcorePackage.eNS_URI);
125
    eAnnotation.getDetails().put("settingDelegate", "xxx");
126
    eAnnotation.getDetails().put("path", "name");
127
    derivedEmployeeName.getEAnnotations().add(eAnnotation);
128
    employeeClass.getEStructuralFeatures().add(derivedEmployeeName);
129
114
    employeeManager = ecoreFactory.createEAttribute();
130
    employeeManager = ecoreFactory.createEAttribute();
115
    employeeManager.setName("manager");
131
    employeeManager.setName("manager");
116
    employeeManager.setEType(ecorePackage.getEBoolean());
132
    employeeManager.setEType(ecorePackage.getEBoolean());
Lines 204-209 Link Here
204
    assertEquals(123, department.eGet(departmentNumber));
220
    assertEquals(123, department.eGet(departmentNumber));
205
  }
221
  }
206
222
223
  public void testDerivedAttributes()
224
  {
225
    EFactory companyFactory = companyPackage.getEFactoryInstance();
226
227
    EObject employee1 = companyFactory.create(employeeClass);
228
    employee1.eSet(employeeName, "John");
229
    assertEquals("John", employee1.eGet(derivedEmployeeName));
230
    assertEquals(Boolean.FALSE, employee1.eGet(employeeManager));
231
232
    EObject employee2 = companyFactory.create(employeeClass);
233
    employee2.eSet(derivedEmployeeName, "Katherine");
234
    assertEquals("Katherine", employee2.eGet(employeeName));
235
    employee2.eSet(employeeManager, Boolean.TRUE);
236
    assertEquals(Boolean.TRUE, employee2.eGet(employeeManager));
237
  }
238
207
  public void testReference()
239
  public void testReference()
208
  {
240
  {
209
    EFactory companyFactory = companyPackage.getEFactoryInstance();
241
    EFactory companyFactory = companyPackage.getEFactoryInstance();
(-)src/org/eclipse/emf/ecore/EObject.java (-1 / +28 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2006 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore;
18
package org.eclipse.emf.ecore;
18
19
19
20
21
import java.lang.reflect.InvocationTargetException;
22
20
import org.eclipse.emf.common.notify.Notifier;
23
import org.eclipse.emf.common.notify.Notifier;
21
import org.eclipse.emf.common.util.EList;
24
import org.eclipse.emf.common.util.EList;
22
import org.eclipse.emf.common.util.TreeIterator;
25
import org.eclipse.emf.common.util.TreeIterator;
Lines 427-430 Link Here
427
   */
430
   */
428
  void eUnset(EStructuralFeature feature);
431
  void eUnset(EStructuralFeature feature);
429
432
433
  /**
434
   * <!-- begin-user-doc -->
435
   * <p>
436
   * Calls the specified operation of the object.  If the operation has
437
   * parameters, then corresponding arguments must be supplied.  There are no
438
   * optional parameters in Ecore operations.
439
   * </p><p>
440
   * If the operation is a void operation, then on successful execution, the
441
   * result of this call is <code>null</code>.  Otherwise, if the operation is
442
   * {@linkplain ETypedElement#isMany() nulti-valued}, then an {@link EList}
443
   * is returned (possibly empty).  If single-valued, then an instance of the
444
   * operation's {@linkplain ETypedElement#getEType() type} is returned, or
445
   * possibly <code>null</code>.
446
   * </p><p>
447
   * If the called operation fails with an
448
   * {@linkplain EOperation#getEExceptions() exception}, then it is re-thrown,
449
   * wrapped in an {@link InvocationTargetException}.
450
   * </p>
451
   * <!-- end-user-doc -->
452
   * @model exceptions="org.eclipse.emf.ecore.EInvocationTargetException" argumentsMany="false"
453
   * @generated
454
   */
455
  Object eCall(EOperation operation, EList<?> arguments) throws InvocationTargetException;
456
430
}
457
}
(-)src/org/eclipse/emf/ecore/EcorePackage.java (-1 / +33 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2006 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 2389-2394 Link Here
2389
2390
2390
2391
2391
  /**
2392
  /**
2393
   * The meta object id for the '<em>EInvocation Target Exception</em>' data type.
2394
   * <!-- begin-user-doc -->
2395
   * <!-- end-user-doc -->
2396
   * @see java.lang.reflect.InvocationTargetException
2397
   * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEInvocationTargetException()
2398
   * @generated
2399
   */
2400
  int EINVOCATION_TARGET_EXCEPTION = 52;
2401
2402
  /**
2392
   * The meta object id for the '<em>EFeature Map Entry</em>' data type.
2403
   * The meta object id for the '<em>EFeature Map Entry</em>' data type.
2393
   * <!-- begin-user-doc -->
2404
   * <!-- begin-user-doc -->
2394
   * <!-- end-user-doc -->
2405
   * <!-- end-user-doc -->
Lines 3877-3882 Link Here
3877
  EDataType getETreeIterator();
3888
  EDataType getETreeIterator();
3878
3889
3879
  /**
3890
  /**
3891
   * Returns the meta object for data type '{@link java.lang.reflect.InvocationTargetException <em>EInvocation Target Exception</em>}'.
3892
   * <!-- begin-user-doc -->
3893
   * <!-- end-user-doc -->
3894
   * @return the meta object for data type '<em>EInvocation Target Exception</em>'.
3895
   * @see java.lang.reflect.InvocationTargetException
3896
   * @model instanceClass="java.lang.reflect.InvocationTargetException"
3897
   * @generated
3898
   */
3899
  EDataType getEInvocationTargetException();
3900
3901
  /**
3880
   * Returns the meta object for data type '{@link org.eclipse.emf.ecore.util.FeatureMap.Entry <em>EFeature Map Entry</em>}'.
3902
   * Returns the meta object for data type '{@link org.eclipse.emf.ecore.util.FeatureMap.Entry <em>EFeature Map Entry</em>}'.
3881
   * <!-- begin-user-doc -->
3903
   * <!-- begin-user-doc -->
3882
   * <!-- end-user-doc -->
3904
   * <!-- end-user-doc -->
Lines 5103-5108 Link Here
5103
     */
5125
     */
5104
    EDataType ETREE_ITERATOR = eINSTANCE.getETreeIterator();
5126
    EDataType ETREE_ITERATOR = eINSTANCE.getETreeIterator();
5105
5127
5128
    /**
5129
     * The meta object literal for the '<em>EInvocation Target Exception</em>' data type.
5130
     * <!-- begin-user-doc -->
5131
     * <!-- end-user-doc -->
5132
     * @see java.lang.reflect.InvocationTargetException
5133
     * @see org.eclipse.emf.ecore.impl.EcorePackageImpl#getEInvocationTargetException()
5134
     * @generated
5135
     */
5136
    EDataType EINVOCATION_TARGET_EXCEPTION = eINSTANCE.getEInvocationTargetException();
5137
5106
  }
5138
  }
5107
5139
5108
  // Internal bootstrap uses Literals constants, so we must force initialization this inner interface first.
5140
  // Internal bootstrap uses Literals constants, so we must force initialization this inner interface first.
(-)src/org/eclipse/emf/ecore/EOperation.java (-1 / +96 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2006 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore;
18
package org.eclipse.emf.ecore;
18
19
19
20
21
import java.lang.reflect.InvocationTargetException;
22
import java.util.HashMap;
23
20
import org.eclipse.emf.common.util.EList;
24
import org.eclipse.emf.common.util.EList;
21
25
22
26
Lines 126-129 Link Here
126
   */
130
   */
127
  EList<ETypeParameter> getETypeParameters();
131
  EList<ETypeParameter> getETypeParameters();
128
132
133
  /**
134
   * Internal API implemented by all operations.
135
   * 
136
   * @since 2.5
137
   */
138
  interface Internal extends EOperation, InternalEObject
139
  {
140
	/**
141
	 * A pluggable, dynamic implementation of operation behaviour.
142
	 */
143
    interface CallDelegate
144
    {
145
      /**
146
       * A factory for creating call delegates.
147
       */
148
      interface Factory
149
      {
150
        /**
151
         * Creates the call delegate for the specified <tt>operation</tt>.
152
         * 
153
         * @param operation the operation
154
         * @return its call delegate
155
         */
156
        CallDelegate createCallDelegate(EOperation operation);
157
        
158
        /**
159
         * A registry of call-delegate factories.
160
         */
161
        interface Registry
162
        {
163
          Registry INSTANCE = new Impl();
164
          
165
          Factory getFactory(String key);
166
          
167
          void registerFactory(String key, Factory factory);
168
          
169
          void deregisterFactory(String key);
170
          
171
          class Impl extends HashMap<String, Factory> implements Registry
172
          {
173
            private static final long serialVersionUID = 1L;
174
            
175
            public Factory getFactory(String key)
176
            {
177
              return get(key);
178
            }
179
            
180
            public void registerFactory(String key, Factory factory)
181
            {
182
              put(key, factory);
183
            }
184
            
185
            public void deregisterFactory(String key)
186
            {
187
              remove(key);
188
            }
189
          }
190
        }
191
      }
192
      
193
      /**
194
       * Invokes the operation behaviour for the specified <tt>target</tt>
195
       * object.
196
       * 
197
       * @param target the object on which to call the operation
198
       * @param arguments the arguments for the operation parameters (an
199
       *    empty list if the operation has no parameters)
200
       * @return the operation's return result, or <code>null</code> if it is
201
       *    a void operation
202
       * @throws InvocationTargetException in case of failure to execute the
203
       *    operation behaviour, usually because of an exception
204
       */
205
      Object dynamicCall(InternalEObject target, EList<?> arguments) throws InvocationTargetException;
206
    }
207
    
208
    /**
209
     * Obtains the delegate for this operation.
210
     * A default delegate is always available, so this should not return
211
     * <code>null</code>.
212
     * 
213
     * @return the operation delegate
214
     */
215
    CallDelegate getCallDelegate();
216
    
217
    /**
218
     * Assigns a delegate to this operation.
219
     * 
220
     * @param callDelegate the new operation delegate
221
     */
222
    void setCallDelegate(CallDelegate callDelegate);
223
  }
129
} //EOperation
224
} //EOperation
(-)src/org/eclipse/emf/ecore/EStructuralFeature.java (-1 / +65 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2006 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc. and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 216701 Add support for mutating the delegate-factory registry
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-23 Link Here
17
package org.eclipse.emf.ecore;
18
package org.eclipse.emf.ecore;
18
19
19
20
21
import java.util.HashMap;
22
20
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.ecore.util.PathSettingDelegate;
21
import org.eclipse.emf.ecore.util.FeatureMap;
25
import org.eclipse.emf.ecore.util.FeatureMap;
22
26
23
27
Lines 365-370 Link Here
365
    interface SettingDelegate
369
    interface SettingDelegate
366
    {
370
    {
367
      /**
371
      /**
372
       * A factory for creating setting delegates.
373
       * @since 2.5
374
       */
375
      interface Factory
376
      {
377
        /**
378
         * Creates a setting delegate for the given feature.
379
         * @param eStructuralFeature the feature for which a setting delegate is to be created.
380
         * @return a new a setting delegate for the given feature.
381
         */
382
        SettingDelegate createSettingDelegate(EStructuralFeature eStructuralFeature);
383
384
        /**
385
         * A registry of factories for creating setting delegates.
386
         */
387
        interface Registry
388
        {
389
          Registry INSTANCE = new Impl();
390
391
          Factory getFactory(String key);
392
          
393
          void registerFactory(String key, Factory factory);
394
          
395
          void deregisterFactory(String key);
396
397
          class Impl extends HashMap<String, Factory> implements Registry
398
          {
399
            private static final long serialVersionUID = 1L;
400
401
            {
402
              put
403
                ("org.eclipse.emf.ecore.Path", 
404
                 new Factory() 
405
                 { 
406
                    public SettingDelegate createSettingDelegate(EStructuralFeature eStructuralFeature)
407
                    {
408
                      return new PathSettingDelegate(eStructuralFeature);
409
                    }
410
                 });
411
            }
412
413
            public Factory getFactory(String key)
414
            {
415
              return get(key);
416
            }
417
            
418
            public void registerFactory(String key, Factory factory)
419
            {
420
              put(key, factory);
421
            }
422
            
423
            public void deregisterFactory(String key)
424
            {
425
              remove(key);
426
            }
427
          }
428
        }
429
      }
430
431
      /**
368
       * Returns a setting that can be used to access the owner's feature.
432
       * Returns a setting that can be used to access the owner's feature.
369
       * @param owner the owner of the feature.
433
       * @param owner the owner of the feature.
370
       * @param settings the owner's array of cached values.
434
       * @param settings the owner's array of cached values.
(-)model/Ecore.ecore (+9 lines)
Lines 221-226 Link Here
221
    <eOperations name="eUnset">
221
    <eOperations name="eUnset">
222
      <eParameters name="feature" eType="#//EStructuralFeature"/>
222
      <eParameters name="feature" eType="#//EStructuralFeature"/>
223
    </eOperations>
223
    </eOperations>
224
    <eOperations name="eCall" eType="#//EJavaObject" eExceptions="#//EInvocationTargetException">
225
      <eParameters name="operation" eType="#//EOperation"/>
226
      <eParameters name="arguments">
227
        <eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
228
          <eTypeArguments/>
229
        </eGenericType>
230
      </eParameters>
231
    </eOperations>
224
  </eClassifiers>
232
  </eClassifiers>
225
  <eClassifiers xsi:type="ecore:EClass" name="EOperation" eSuperTypes="#//ETypedElement">
233
  <eClassifiers xsi:type="ecore:EClass" name="EOperation" eSuperTypes="#//ETypedElement">
226
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
234
    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
Lines 495-498 Link Here
495
    <eStructuralFeatures xsi:type="ecore:EReference" name="eBounds" upperBound="-1"
503
    <eStructuralFeatures xsi:type="ecore:EReference" name="eBounds" upperBound="-1"
496
        eType="#//EGenericType" containment="true" resolveProxies="false"/>
504
        eType="#//EGenericType" containment="true" resolveProxies="false"/>
497
  </eClassifiers>
505
  </eClassifiers>
506
  <eClassifiers xsi:type="ecore:EDataType" name="EInvocationTargetException" instanceClassName="java.lang.reflect.InvocationTargetException"/>
498
</ecore:EPackage>
507
</ecore:EPackage>
(-)model/EcoreAnnotations.ecorediag (-1 / +61 lines)
Lines 14-20 Link Here
14
    </children>
14
    </children>
15
    <styles xmi:type="notation:ShapeStyle" xmi:id="_sFlvLT-OEd2DT6rVsxRmdQ" fontName="Microsoft Sans Serif" fontHeight="10" fillColor="13761016" lineColor="0"/>
15
    <styles xmi:type="notation:ShapeStyle" xmi:id="_sFlvLT-OEd2DT6rVsxRmdQ" fontName="Microsoft Sans Serif" fontHeight="10" fillColor="13761016" lineColor="0"/>
16
    <element xmi:type="ecore:EClass" href="Ecore.ecore#//EAnnotation"/>
16
    <element xmi:type="ecore:EClass" href="Ecore.ecore#//EAnnotation"/>
17
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sFlvLj-OEd2DT6rVsxRmdQ" x="114" y="312"/>
17
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_sFlvLj-OEd2DT6rVsxRmdQ" x="108" y="333"/>
18
  </children>
18
  </children>
19
  <children xmi:type="notation:Node" xmi:id="_sFlvLz-OEd2DT6rVsxRmdQ" type="1001">
19
  <children xmi:type="notation:Node" xmi:id="_sFlvLz-OEd2DT6rVsxRmdQ" type="1001">
20
    <children xmi:type="notation:Node" xmi:id="_sFlvMD-OEd2DT6rVsxRmdQ" type="4001"/>
20
    <children xmi:type="notation:Node" xmi:id="_sFlvMD-OEd2DT6rVsxRmdQ" type="4001"/>
Lines 40-45 Link Here
40
      <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvRD-OEd2DT6rVsxRmdQ"/>
40
      <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvRD-OEd2DT6rVsxRmdQ"/>
41
    </children>
41
    </children>
42
    <children xmi:type="notation:Node" xmi:id="_sFlvRT-OEd2DT6rVsxRmdQ" type="5002">
42
    <children xmi:type="notation:Node" xmi:id="_sFlvRT-OEd2DT6rVsxRmdQ" type="5002">
43
      <children xmi:type="notation:Node" xmi:id="_qywyMLP2Ed2JrdFLh2Y_ww" type="2002">
44
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eClass"/>
45
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qywyMbP2Ed2JrdFLh2Y_ww"/>
46
      </children>
47
      <children xmi:type="notation:Node" xmi:id="_qyxZQLP2Ed2JrdFLh2Y_ww" type="2002">
48
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eIsProxy"/>
49
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZQbP2Ed2JrdFLh2Y_ww"/>
50
      </children>
51
      <children xmi:type="notation:Node" xmi:id="_qyxZQrP2Ed2JrdFLh2Y_ww" type="2002">
52
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eResource"/>
53
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZQ7P2Ed2JrdFLh2Y_ww"/>
54
      </children>
55
      <children xmi:type="notation:Node" xmi:id="_qyxZRLP2Ed2JrdFLh2Y_ww" type="2002">
56
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainer"/>
57
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZRbP2Ed2JrdFLh2Y_ww"/>
58
      </children>
59
      <children xmi:type="notation:Node" xmi:id="_qyxZRrP2Ed2JrdFLh2Y_ww" type="2002">
60
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainingFeature"/>
61
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyxZR7P2Ed2JrdFLh2Y_ww"/>
62
      </children>
63
      <children xmi:type="notation:Node" xmi:id="_qyyAULP2Ed2JrdFLh2Y_ww" type="2002">
64
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContainmentFeature"/>
65
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAUbP2Ed2JrdFLh2Y_ww"/>
66
      </children>
67
      <children xmi:type="notation:Node" xmi:id="_qyyAUrP2Ed2JrdFLh2Y_ww" type="2002">
68
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eContents"/>
69
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAU7P2Ed2JrdFLh2Y_ww"/>
70
      </children>
71
      <children xmi:type="notation:Node" xmi:id="_qyyAVLP2Ed2JrdFLh2Y_ww" type="2002">
72
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eAllContents"/>
73
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAVbP2Ed2JrdFLh2Y_ww"/>
74
      </children>
75
      <children xmi:type="notation:Node" xmi:id="_qyyAVrP2Ed2JrdFLh2Y_ww" type="2002">
76
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eCrossReferences"/>
77
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyyAV7P2Ed2JrdFLh2Y_ww"/>
78
      </children>
79
      <children xmi:type="notation:Node" xmi:id="_qyynYLP2Ed2JrdFLh2Y_ww" type="2002">
80
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eGet"/>
81
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyynYbP2Ed2JrdFLh2Y_ww"/>
82
      </children>
83
      <children xmi:type="notation:Node" xmi:id="_qyynYrP2Ed2JrdFLh2Y_ww" type="2002">
84
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eGet.1"/>
85
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyynY7P2Ed2JrdFLh2Y_ww"/>
86
      </children>
87
      <children xmi:type="notation:Node" xmi:id="_qyzOcLP2Ed2JrdFLh2Y_ww" type="2002">
88
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eSet"/>
89
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOcbP2Ed2JrdFLh2Y_ww"/>
90
      </children>
91
      <children xmi:type="notation:Node" xmi:id="_qyzOcrP2Ed2JrdFLh2Y_ww" type="2002">
92
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eIsSet"/>
93
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOc7P2Ed2JrdFLh2Y_ww"/>
94
      </children>
95
      <children xmi:type="notation:Node" xmi:id="_qyzOdLP2Ed2JrdFLh2Y_ww" type="2002">
96
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eUnset"/>
97
        <layoutConstraint xmi:type="notation:Location" xmi:id="_qyzOdbP2Ed2JrdFLh2Y_ww"/>
98
      </children>
99
      <children xmi:type="notation:Node" xmi:id="_xxmzoLP2Ed2JrdFLh2Y_ww" type="2002">
100
        <element xmi:type="ecore:EOperation" href="Ecore.ecore#//EObject/eCall"/>
101
        <layoutConstraint xmi:type="notation:Location" xmi:id="_xxmzobP2Ed2JrdFLh2Y_ww"/>
102
      </children>
43
      <styles xmi:type="notation:DrawerStyle" xmi:id="_sFlvRj-OEd2DT6rVsxRmdQ"/>
103
      <styles xmi:type="notation:DrawerStyle" xmi:id="_sFlvRj-OEd2DT6rVsxRmdQ"/>
44
      <styles xmi:type="notation:SortingStyle" xmi:id="_sFlvRz-OEd2DT6rVsxRmdQ"/>
104
      <styles xmi:type="notation:SortingStyle" xmi:id="_sFlvRz-OEd2DT6rVsxRmdQ"/>
45
      <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvSD-OEd2DT6rVsxRmdQ"/>
105
      <styles xmi:type="notation:FilteringStyle" xmi:id="_sFlvSD-OEd2DT6rVsxRmdQ"/>
(-)model/EcoreDataTypes.ecorediag (+7 lines)
Lines 224-229 Link Here
224
    <element xmi:type="ecore:EDataType" href="Ecore.ecore#//ETreeIterator"/>
224
    <element xmi:type="ecore:EDataType" href="Ecore.ecore#//ETreeIterator"/>
225
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n9W90D-IEd2DT6rVsxRmdQ" x="408" y="228"/>
225
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n9W90D-IEd2DT6rVsxRmdQ" x="408" y="228"/>
226
  </children>
226
  </children>
227
  <children xmi:type="notation:Node" xmi:id="_z-RYILP5Ed2JrdFLh2Y_ww" type="1004">
228
    <children xmi:type="notation:Node" xmi:id="_z-VpkLP5Ed2JrdFLh2Y_ww" type="4008"/>
229
    <children xmi:type="notation:Node" xmi:id="_z-VpkbP5Ed2JrdFLh2Y_ww" type="4009"/>
230
    <styles xmi:type="notation:ShapeStyle" xmi:id="_z-RYIbP5Ed2JrdFLh2Y_ww" fontName="Lucida Grande" fontHeight="10" fillColor="13420443" lineColor="8421504"/>
231
    <element xmi:type="ecore:EDataType" href="Ecore.ecore#//EInvocationTargetException"/>
232
    <layoutConstraint xmi:type="notation:Bounds" xmi:id="_z-RYIrP5Ed2JrdFLh2Y_ww" x="-216" y="585"/>
233
  </children>
227
  <styles xmi:type="notation:DiagramStyle" xmi:id="_n9W90T-IEd2DT6rVsxRmdQ"/>
234
  <styles xmi:type="notation:DiagramStyle" xmi:id="_n9W90T-IEd2DT6rVsxRmdQ"/>
228
  <element xmi:type="ecore:EPackage" href="Ecore.ecore#/"/>
235
  <element xmi:type="ecore:EPackage" href="Ecore.ecore#/"/>
229
</notation:Diagram>
236
</notation:Diagram>
(-)src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java (-1 / +30 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2007 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore.impl;
18
package org.eclipse.emf.ecore.impl;
18
19
19
20
21
import java.lang.reflect.InvocationTargetException;
20
import java.math.BigDecimal;
22
import java.math.BigDecimal;
21
import java.math.BigInteger;
23
import java.math.BigInteger;
22
import java.util.ArrayList;
24
import java.util.ArrayList;
Lines 410-415 Link Here
410
   * <!-- end-user-doc -->
412
   * <!-- end-user-doc -->
411
   * @generated
413
   * @generated
412
   */
414
   */
415
  private EDataType eInvocationTargetExceptionEDataType = null;
416
417
  /**
418
   * <!-- begin-user-doc -->
419
   * <!-- end-user-doc -->
420
   * @generated
421
   */
413
  private EDataType eFeatureMapEntryEDataType = null;
422
  private EDataType eFeatureMapEntryEDataType = null;
414
423
415
  /**
424
  /**
Lines 1828-1833 Link Here
1828
   * <!-- end-user-doc -->
1837
   * <!-- end-user-doc -->
1829
   * @generated
1838
   * @generated
1830
   */
1839
   */
1840
  public EDataType getEInvocationTargetException()
1841
  {
1842
    return eInvocationTargetExceptionEDataType;
1843
  }
1844
1845
  /**
1846
   * <!-- begin-user-doc -->
1847
   * <!-- end-user-doc -->
1848
   * @generated
1849
   */
1831
  public EDataType getEFeatureMapEntry()
1850
  public EDataType getEFeatureMapEntry()
1832
  {
1851
  {
1833
    return eFeatureMapEntryEDataType;
1852
    return eFeatureMapEntryEDataType;
Lines 2067-2072 Link Here
2067
    eShortObjectEDataType = createEDataType(ESHORT_OBJECT);
2086
    eShortObjectEDataType = createEDataType(ESHORT_OBJECT);
2068
    eStringEDataType = createEDataType(ESTRING);
2087
    eStringEDataType = createEDataType(ESTRING);
2069
    eTreeIteratorEDataType = createEDataType(ETREE_ITERATOR);
2088
    eTreeIteratorEDataType = createEDataType(ETREE_ITERATOR);
2089
    eInvocationTargetExceptionEDataType = createEDataType(EINVOCATION_TARGET_EXCEPTION);
2070
  }
2090
  }
2071
2091
2072
  /**
2092
  /**
Lines 2275-2280 Link Here
2275
    op = addEOperation(eObjectEClass, null, "eUnset", 0, 1, IS_UNIQUE, IS_ORDERED);
2295
    op = addEOperation(eObjectEClass, null, "eUnset", 0, 1, IS_UNIQUE, IS_ORDERED);
2276
    addEParameter(op, this.getEStructuralFeature(), "feature", 0, 1, IS_UNIQUE, IS_ORDERED);
2296
    addEParameter(op, this.getEStructuralFeature(), "feature", 0, 1, IS_UNIQUE, IS_ORDERED);
2277
2297
2298
    op = addEOperation(eObjectEClass, this.getEJavaObject(), "eCall", 0, 1, IS_UNIQUE, IS_ORDERED);
2299
    addEParameter(op, this.getEOperation(), "operation", 0, 1, IS_UNIQUE, IS_ORDERED);
2300
    g1 = createEGenericType(ecorePackage.getEEList());
2301
    g2 = createEGenericType();
2302
    g1.getETypeArguments().add(g2);
2303
    addEParameter(op, g1, "arguments", 0, 1, IS_UNIQUE, IS_ORDERED);
2304
    addEException(op, this.getEInvocationTargetException());
2305
2278
    initEClass(eOperationEClass, EOperation.class, "EOperation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2306
    initEClass(eOperationEClass, EOperation.class, "EOperation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2279
    initEReference(getEOperation_EContainingClass(), this.getEClass(), this.getEClass_EOperations(), "eContainingClass", null, 0, 1, EOperation.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2307
    initEReference(getEOperation_EContainingClass(), this.getEClass(), this.getEClass_EOperations(), "eContainingClass", null, 0, 1, EOperation.class, IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2280
    initEReference(getEOperation_ETypeParameters(), this.getETypeParameter(), null, "eTypeParameters", null, 0, -1, EOperation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2308
    initEReference(getEOperation_ETypeParameters(), this.getETypeParameter(), null, "eTypeParameters", null, 0, -1, EOperation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
Lines 2380-2385 Link Here
2380
    initEDataType(eShortObjectEDataType, Short.class, "EShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2408
    initEDataType(eShortObjectEDataType, Short.class, "EShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2381
    initEDataType(eStringEDataType, String.class, "EString", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2409
    initEDataType(eStringEDataType, String.class, "EString", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2382
    initEDataType(eTreeIteratorEDataType, TreeIterator.class, "ETreeIterator", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2410
    initEDataType(eTreeIteratorEDataType, TreeIterator.class, "ETreeIterator", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2411
    initEDataType(eInvocationTargetExceptionEDataType, InvocationTargetException.class, "EInvocationTargetException", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
2383
2412
2384
    // Create resource
2413
    // Create resource
2385
    createResource(eNS_URI);
2414
    createResource(eNS_URI);
(-)src/org/eclipse/emf/ecore/impl/EcoreFactoryImpl.java (-1 / +27 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2006 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore.impl;
18
package org.eclipse.emf.ecore.impl;
18
19
19
20
21
import java.lang.reflect.InvocationTargetException;
20
import java.math.BigDecimal;
22
import java.math.BigDecimal;
21
import java.math.BigInteger;
23
import java.math.BigInteger;
22
import java.text.ParseException;
24
import java.text.ParseException;
Lines 161-166 Link Here
161
        return createEShortObjectFromString(eDataType, initialValue);
163
        return createEShortObjectFromString(eDataType, initialValue);
162
      case EcorePackage.ESTRING:
164
      case EcorePackage.ESTRING:
163
        return createEStringFromString(eDataType, initialValue);
165
        return createEStringFromString(eDataType, initialValue);
166
      case EcorePackage.EINVOCATION_TARGET_EXCEPTION:
167
        return createEInvocationTargetExceptionFromString(eDataType, initialValue);
164
      default:
168
      default:
165
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
169
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
166
    }
170
    }
Lines 222-227 Link Here
222
        return convertEShortObjectToString(eDataType, instanceValue);
226
        return convertEShortObjectToString(eDataType, instanceValue);
223
      case EcorePackage.ESTRING:
227
      case EcorePackage.ESTRING:
224
        return convertEStringToString(eDataType, instanceValue);
228
        return convertEStringToString(eDataType, instanceValue);
229
      case EcorePackage.EINVOCATION_TARGET_EXCEPTION:
230
        return convertEInvocationTargetExceptionToString(eDataType, instanceValue);
225
      default:
231
      default:
226
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
232
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
227
    }
233
    }
Lines 654-659 Link Here
654
  /**
660
  /**
655
   * <!-- begin-user-doc -->
661
   * <!-- begin-user-doc -->
656
   * <!-- end-user-doc -->
662
   * <!-- end-user-doc -->
663
   * @generated
664
   */
665
  public InvocationTargetException createEInvocationTargetExceptionFromString(EDataType eDataType, String initialValue)
666
  {
667
    return (InvocationTargetException)super.createFromString(eDataType, initialValue);
668
  }
669
670
  /**
671
   * <!-- begin-user-doc -->
672
   * <!-- end-user-doc -->
673
   * @generated
674
   */
675
  public String convertEInvocationTargetExceptionToString(EDataType eDataType, Object instanceValue)
676
  {
677
    return super.convertToString(eDataType, instanceValue);
678
  }
679
680
		/**
681
   * <!-- begin-user-doc -->
682
   * <!-- end-user-doc -->
657
   * @generated NOT
683
   * @generated NOT
658
   */
684
   */
659
  public Integer createEIntFromString(EDataType metaObject, String initialValue) 
685
  public Integer createEIntFromString(EDataType metaObject, String initialValue) 
(-)src/org/eclipse/emf/ecore/impl/EOperationImpl.java (-2 / +39 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2002-2007 IBM Corporation and others.
4
 * Copyright (c) 2002-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 28-33 Link Here
28
import org.eclipse.emf.common.notify.NotificationChain;
29
import org.eclipse.emf.common.notify.NotificationChain;
29
import org.eclipse.emf.common.notify.impl.NotificationImpl;
30
import org.eclipse.emf.common.notify.impl.NotificationImpl;
30
import org.eclipse.emf.common.util.EList;
31
import org.eclipse.emf.common.util.EList;
32
import org.eclipse.emf.common.util.URI;
31
import org.eclipse.emf.ecore.EAnnotation;
33
import org.eclipse.emf.ecore.EAnnotation;
32
import org.eclipse.emf.ecore.EClass;
34
import org.eclipse.emf.ecore.EClass;
33
import org.eclipse.emf.ecore.EClassifier;
35
import org.eclipse.emf.ecore.EClassifier;
Lines 38-46 Link Here
38
import org.eclipse.emf.ecore.EcoreFactory;
40
import org.eclipse.emf.ecore.EcoreFactory;
39
import org.eclipse.emf.ecore.EcorePackage;
41
import org.eclipse.emf.ecore.EcorePackage;
40
import org.eclipse.emf.ecore.InternalEObject;
42
import org.eclipse.emf.ecore.InternalEObject;
43
import org.eclipse.emf.ecore.util.BasicCallDelegate;
41
import org.eclipse.emf.ecore.util.DelegatingEcoreEList;
44
import org.eclipse.emf.ecore.util.DelegatingEcoreEList;
42
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
45
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
43
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
46
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
47
import org.eclipse.emf.ecore.util.EcoreUtil;
44
// import org.eclipse.emf.ecore.util.EObjectResolvingEList;
48
// import org.eclipse.emf.ecore.util.EObjectResolvingEList;
45
import org.eclipse.emf.ecore.util.InternalEList;
49
import org.eclipse.emf.ecore.util.InternalEList;
46
50
Lines 48-53 Link Here
48
/**
52
/**
49
 * <!-- begin-user-doc -->
53
 * <!-- begin-user-doc -->
50
 * An implementation of the model object '<em><b>EOperation</b></em>'.
54
 * An implementation of the model object '<em><b>EOperation</b></em>'.
55
 * @extends EOperation.Internal
51
 * <!-- end-user-doc -->
56
 * <!-- end-user-doc -->
52
 * <p>
57
 * <p>
53
 * The following features are implemented:
58
 * The following features are implemented:
Lines 62-68 Link Here
62
 *
67
 *
63
 * @generated
68
 * @generated
64
 */
69
 */
65
public class EOperationImpl extends ETypedElementImpl implements EOperation
70
public class EOperationImpl extends ETypedElementImpl implements EOperation, EOperation.Internal
66
{
71
{
67
  /**
72
  /**
68
   * The cached value of the '{@link #getETypeParameters() <em>EType Parameters</em>}' containment reference list.
73
   * The cached value of the '{@link #getETypeParameters() <em>EType Parameters</em>}' containment reference list.
Lines 1007-1010 Link Here
1007
    return eDynamicIsSet(featureID);
1012
    return eDynamicIsSet(featureID);
1008
  }
1013
  }
1009
1014
1015
  protected EOperation.Internal.CallDelegate callDelegate;
1016
  
1017
  public CallDelegate getCallDelegate()
1018
  {
1019
    if (callDelegate == null)
1020
    {
1021
      CallDelegate.Factory factory = null;
1022
      String callDelegateKey = EcoreUtil.getAnnotation(this, EcorePackage.eNS_URI,
1023
    	  "callDelegate");
1024
      if (callDelegateKey != null)
1025
      {
1026
        factory = CallDelegate.Factory.Registry.INSTANCE.getFactory(
1027
        	URI.createURI(callDelegateKey).trimFragment().trimQuery().toString());
1028
      }
1029
      if (factory != null)
1030
      {
1031
        callDelegate = factory.createCallDelegate(this);
1032
      }
1033
      if (callDelegate == null)
1034
      {
1035
         callDelegate = new BasicCallDelegate(this);
1036
      }
1037
    }
1038
    
1039
    return callDelegate;
1040
  }
1041
  
1042
  public void setCallDelegate(CallDelegate callDelegate)
1043
  {
1044
    this.callDelegate = callDelegate;
1045
  }
1046
  
1010
}
1047
}
(-)src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java (+9 lines)
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore.impl;
18
package org.eclipse.emf.ecore.impl;
18
19
19
20
21
import java.lang.reflect.InvocationTargetException;
20
import java.util.ArrayList;
22
import java.util.ArrayList;
21
import java.util.Iterator;
23
import java.util.Iterator;
22
import java.util.List;
24
import java.util.List;
Lines 36-41 Link Here
36
import org.eclipse.emf.ecore.EDataType;
38
import org.eclipse.emf.ecore.EDataType;
37
import org.eclipse.emf.ecore.EFactory;
39
import org.eclipse.emf.ecore.EFactory;
38
import org.eclipse.emf.ecore.EObject;
40
import org.eclipse.emf.ecore.EObject;
41
import org.eclipse.emf.ecore.EOperation;
39
import org.eclipse.emf.ecore.EReference;
42
import org.eclipse.emf.ecore.EReference;
40
import org.eclipse.emf.ecore.EStructuralFeature;
43
import org.eclipse.emf.ecore.EStructuralFeature;
41
import org.eclipse.emf.ecore.ETypedElement;
44
import org.eclipse.emf.ecore.ETypedElement;
Lines 1995-2000 Link Here
1995
    }
1998
    }
1996
  }
1999
  }
1997
  
2000
  
2001
  public Object eCall(EOperation operation, EList<?> arguments) throws InvocationTargetException
2002
  {
2003
	return ((EOperation.Internal) operation).getCallDelegate().dynamicCall(this,
2004
		arguments);
2005
  }
2006
  
1998
  @Override
2007
  @Override
1999
  public String toString()
2008
  public String toString()
2000
  {
2009
  {
(-)src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java (-5 / +71 lines)
Lines 17-22 Link Here
17
package org.eclipse.emf.ecore.impl;
17
package org.eclipse.emf.ecore.impl;
18
18
19
19
20
import java.io.Externalizable;
21
import java.io.IOException;
22
import java.io.ObjectInput;
23
import java.io.ObjectOutput;
24
import java.io.ObjectStreamException;
25
import java.io.Serializable;
20
import java.util.Collection;
26
import java.util.Collection;
21
import java.util.List;
27
import java.util.List;
22
import java.util.Map;
28
import java.util.Map;
Lines 26-31 Link Here
26
import org.eclipse.emf.common.notify.impl.NotificationChainImpl;
32
import org.eclipse.emf.common.notify.impl.NotificationChainImpl;
27
import org.eclipse.emf.common.util.BasicEMap;
33
import org.eclipse.emf.common.util.BasicEMap;
28
import org.eclipse.emf.common.util.EMap;
34
import org.eclipse.emf.common.util.EMap;
35
import org.eclipse.emf.common.util.URI;
29
import org.eclipse.emf.ecore.EAnnotation;
36
import org.eclipse.emf.ecore.EAnnotation;
30
import org.eclipse.emf.ecore.EClass;
37
import org.eclipse.emf.ecore.EClass;
31
import org.eclipse.emf.ecore.EClassifier;
38
import org.eclipse.emf.ecore.EClassifier;
Lines 33-38 Link Here
33
import org.eclipse.emf.ecore.EDataType;
40
import org.eclipse.emf.ecore.EDataType;
34
import org.eclipse.emf.ecore.EFactory;
41
import org.eclipse.emf.ecore.EFactory;
35
import org.eclipse.emf.ecore.EObject;
42
import org.eclipse.emf.ecore.EObject;
43
import org.eclipse.emf.ecore.EPackage;
36
import org.eclipse.emf.ecore.EReference;
44
import org.eclipse.emf.ecore.EReference;
37
import org.eclipse.emf.ecore.EStructuralFeature;
45
import org.eclipse.emf.ecore.EStructuralFeature;
38
import org.eclipse.emf.ecore.EcorePackage;
46
import org.eclipse.emf.ecore.EcorePackage;
Lines 52-57 Link Here
52
import org.eclipse.emf.ecore.util.EcoreUtil;
60
import org.eclipse.emf.ecore.util.EcoreUtil;
53
import org.eclipse.emf.ecore.util.ExtendedMetaData;
61
import org.eclipse.emf.ecore.util.ExtendedMetaData;
54
import org.eclipse.emf.ecore.util.FeatureMap;
62
import org.eclipse.emf.ecore.util.FeatureMap;
63
import org.eclipse.emf.ecore.util.FeatureMapUtil;
55
import org.eclipse.emf.ecore.util.InternalEList;
64
import org.eclipse.emf.ecore.util.InternalEList;
56
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
65
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
57
66
Lines 816-825 Link Here
816
      Object intrinsicDefaultValue = eType.getDefaultValue();
825
      Object intrinsicDefaultValue = eType.getDefaultValue();
817
826
818
      EStructuralFeature featureMapFeature;
827
      EStructuralFeature featureMapFeature;
819
      if (isDerived() && 
828
      EAnnotation eAnnotation;
820
            (((featureMapFeature = ExtendedMetaData.INSTANCE.getMixedFeature(eClass)) != null && 
829
      String settingDelegateKey;
821
               featureMapFeature != this) ||
830
      SettingDelegate.Factory settingDelegateFactory;
822
              ((featureMapFeature = ExtendedMetaData.INSTANCE.getGroup(this)) != null)))
831
      boolean derived = isDerived();
832
      if (derived && 
833
            (eAnnotation = getEAnnotation(EcorePackage.eNS_URI)) != null && 
834
            (settingDelegateKey = eAnnotation.getDetails().get("settingDelegate")) != null &&
835
            (settingDelegateFactory = 
836
               SettingDelegate.Factory.Registry.INSTANCE.getFactory
837
                 (URI.createURI(settingDelegateKey).trimFragment().trimQuery().toString())) != null)
838
      {
839
        settingDelegate = settingDelegateFactory.createSettingDelegate(this);
840
      }
841
      else if (derived && 
842
                 (((featureMapFeature = ExtendedMetaData.INSTANCE.getMixedFeature(eClass)) != null && 
843
                    featureMapFeature != this) ||
844
                    ((featureMapFeature = ExtendedMetaData.INSTANCE.getGroup(this)) != null)))
823
      {
845
      {
824
        settingDelegate = new InternalSettingDelegateFeatureMapDelegator(this, featureMapFeature);
846
        settingDelegate = new InternalSettingDelegateFeatureMapDelegator(this, featureMapFeature);
825
      }
847
      }
Lines 2892-2898 Link Here
2892
    return cachedIsFeatureMap;
2914
    return cachedIsFeatureMap;
2893
  }
2915
  }
2894
  
2916
  
2895
  public static abstract class BasicFeatureMapEntry implements FeatureMap.Entry.Internal
2917
  public static abstract class BasicFeatureMapEntry implements FeatureMap.Entry.Internal, Serializable
2896
  {
2918
  {
2897
    protected final EStructuralFeature.Internal eStructuralFeature;
2919
    protected final EStructuralFeature.Internal eStructuralFeature;
2898
2920
Lines 2973-2978 Link Here
2973
            eStructuralFeature.getName()) + 
2995
            eStructuralFeature.getName()) + 
2974
           "=" + getValue();
2996
           "=" + getValue();
2975
    }
2997
    }
2998
    
2999
    protected static class WriteReplacement implements Externalizable
3000
    {
3001
      FeatureMap.Entry featureMapEntry;
3002
3003
      public WriteReplacement()
3004
      {
3005
        super();
3006
      }
3007
3008
      public WriteReplacement(FeatureMap.Entry featureMapEntry)
3009
      {
3010
        this.featureMapEntry = featureMapEntry;
3011
      }
3012
          
3013
      public void writeExternal(ObjectOutput out) throws IOException
3014
      {
3015
        EStructuralFeature eStructuralFeature = featureMapEntry.getEStructuralFeature();
3016
        EClass eClass = eStructuralFeature.getEContainingClass();
3017
        out.writeUTF(eClass.getEPackage().getNsURI());
3018
        out.writeUTF(eClass.getName());
3019
        out.writeUTF(eStructuralFeature.getName());
3020
        out.writeObject(featureMapEntry.getValue());
3021
      }
3022
          
3023
      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
3024
      {
3025
        EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(in.readUTF());
3026
        EClass eClass =  (EClass)ePackage.getEClassifier(in.readUTF());
3027
        EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(in.readUTF());
3028
        Object value = in.readObject();
3029
        featureMapEntry = FeatureMapUtil.createRawEntry(eStructuralFeature, value);
3030
      }
3031
3032
      private Object readResolve()
3033
      {
3034
        return featureMapEntry;
3035
      }
3036
    }
3037
3038
    public Object writeReplace() throws ObjectStreamException
3039
    {
3040
      return  new WriteReplacement(this);
3041
    }
2976
  }
3042
  }
2977
3043
2978
  public final static class SimpleFeatureMapEntry extends BasicFeatureMapEntry
3044
  public final static class SimpleFeatureMapEntry extends BasicFeatureMapEntry
(-)src/org/eclipse/emf/ecore/util/EcoreValidator.java (-1 / +15 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright>
2
 * <copyright>
3
 *
3
 *
4
 * Copyright (c) 2006-2007 IBM Corporation and others.
4
 * Copyright (c) 2006-2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 9-14 Link Here
9
 *
9
 *
10
 * Contributors:
10
 * Contributors:
11
 *   IBM - Initial API and implementation
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 255469 Implement basic eCall support
12
 *
13
 *
13
 * </copyright>
14
 * </copyright>
14
 *
15
 *
Lines 16-21 Link Here
16
 */
17
 */
17
package org.eclipse.emf.ecore.util;
18
package org.eclipse.emf.ecore.util;
18
19
20
import java.lang.reflect.InvocationTargetException;
19
import java.math.BigDecimal;
21
import java.math.BigDecimal;
20
import java.math.BigInteger;
22
import java.math.BigInteger;
21
23
Lines 501-506 Link Here
501
        return validateEString((String)value, diagnostics, context);
503
        return validateEString((String)value, diagnostics, context);
502
      case EcorePackage.ETREE_ITERATOR:
504
      case EcorePackage.ETREE_ITERATOR:
503
        return validateETreeIterator((TreeIterator<?>)value, diagnostics, context);
505
        return validateETreeIterator((TreeIterator<?>)value, diagnostics, context);
506
      case EcorePackage.EINVOCATION_TARGET_EXCEPTION:
507
        return validateEInvocationTargetException((InvocationTargetException)value, diagnostics, context);
504
      default:
508
      default:
505
        return true;
509
        return true;
506
    }
510
    }
Lines 4087-4092 Link Here
4087
  }
4091
  }
4088
4092
4089
  /**
4093
  /**
4094
   * <!-- begin-user-doc -->
4095
   * <!-- end-user-doc -->
4096
   * @generated
4097
   */
4098
  public boolean validateEInvocationTargetException(InvocationTargetException eInvocationTargetException, DiagnosticChain diagnostics, Map<Object, Object> context)
4099
  {
4100
    return true;
4101
  }
4102
4103
  /**
4090
   * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
4104
   * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
4091
   * <!-- begin-user-doc -->
4105
   * <!-- begin-user-doc -->
4092
   * <!-- end-user-doc -->
4106
   * <!-- end-user-doc -->
(-)src/org/eclipse/emf/ecore/util/BasicSettingDelegate.java (+306 lines)
Added Link Here
1
/**
2
 * <copyright>
3
 *
4
 * Copyright (c) 2008 IBM Corporation, Zeligsoft Inc., and others.
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
8
 * http://www.eclipse.org/legal/epl-v10.html
9
 * 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
12
 *   Zeligsoft - 216701 Removed redundant eStructuralFeature field from Stateless
13
 *
14
 * </copyright>
15
 *
16
 * $Id$
17
 */
18
package org.eclipse.emf.ecore.util;
19
20
import org.eclipse.emf.common.notify.NotificationChain;
21
import org.eclipse.emf.ecore.EObject;
22
import org.eclipse.emf.ecore.EStructuralFeature;
23
import org.eclipse.emf.ecore.InternalEObject;
24
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
25
import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder;
26
27
/**
28
 * A basic implementation of a stateful setting delegate.
29
 * At least the first two of these methods needs to be overridden.
30
 * <ul>
31
 *   <li>{@link #dynamicGet(InternalEObject, DynamicValueHolder, int, boolean, boolean)}</li>
32
 *   <li>{@link #dynamicIsSet(InternalEObject, DynamicValueHolder, int)}</li>
33
 *   <li>{@link #dynamicSet(InternalEObject, DynamicValueHolder, int, Object)}</li>
34
 *   <li>{@link #dynamicUnset(InternalEObject, DynamicValueHolder, int)}</li>
35
 *   <li>{@link #dynamicInverseAdd(InternalEObject, DynamicValueHolder, int, InternalEObject, NotificationChain)}</li>
36
 *   <li>{@link #dynamicInverseRemove(InternalEObject, DynamicValueHolder, int, InternalEObject, NotificationChain)}</li>
37
 * </ul>
38
 */
39
public abstract class BasicSettingDelegate implements EStructuralFeature.Internal.SettingDelegate
40
{
41
  protected EStructuralFeature eStructuralFeature;
42
43
  public BasicSettingDelegate(EStructuralFeature eStructuralFeature)
44
  {
45
    this.eStructuralFeature = eStructuralFeature;
46
  }
47
48
  public Setting dynamicSetting(final InternalEObject owner, final DynamicValueHolder settings, final int dynamicFeatureID)
49
  {
50
    return 
51
      new EStructuralFeature.Setting()
52
      {
53
        public EObject getEObject()
54
        {
55
          return owner;
56
        }
57
58
        public EStructuralFeature getEStructuralFeature()
59
        {
60
          return eStructuralFeature;
61
        }
62
63
        public Object get(boolean resolve)
64
        {
65
          return BasicSettingDelegate.this.dynamicGet(owner, settings, dynamicFeatureID, resolve, true);
66
        }
67
68
        public boolean isSet()
69
        {
70
          return BasicSettingDelegate.this.dynamicIsSet(owner, settings, dynamicFeatureID);
71
        }
72
73
        public void set(Object newValue)
74
        {
75
          BasicSettingDelegate.this.dynamicSet(owner, settings, dynamicFeatureID, newValue);
76
        }
77
78
        public void unset()
79
        {
80
          BasicSettingDelegate.this.dynamicUnset(owner, settings, dynamicFeatureID);
81
        }
82
      };
83
  }
84
85
  public abstract Object dynamicGet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, boolean resolve, boolean coreType);
86
87
88
  public abstract boolean dynamicIsSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID);
89
  
90
91
  public void dynamicSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, Object newValue)
92
  {
93
    throw new UnsupportedOperationException();
94
  }
95
96
  public void dynamicUnset(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID)
97
  {
98
    throw new UnsupportedOperationException();
99
  }
100
101
  public NotificationChain dynamicInverseAdd
102
   (InternalEObject owner,
103
    DynamicValueHolder settings,
104
    int dynamicFeatureID,
105
    InternalEObject otherEnd,
106
    NotificationChain notifications)
107
  {
108
    throw new UnsupportedOperationException();
109
  }
110
111
  public NotificationChain dynamicInverseRemove
112
   (InternalEObject owner,
113
    DynamicValueHolder settings,
114
    int dynamicFeatureID,
115
    InternalEObject otherEnd,
116
    NotificationChain notifications)
117
  {
118
    throw new UnsupportedOperationException();
119
  }
120
121
  /**
122
   * A basic implementation of a stateless setting delegate.
123
   * At least the first two of these methods should be overridden.
124
   * <ul>
125
   *   <li>{@link #setting(InternalEObject)}</li>
126
   *   <li>{@link #get(InternalEObject, boolean, boolean)}</li>
127
   *   <li>{@link #set(InternalEObject, Object)}</li>
128
   *   <li>{@link #isSet(InternalEObject)}</li>
129
   *   <li>{@link #unset(InternalEObject)}</li>
130
   *   <li>{@link #inverseAdd(InternalEObject, InternalEObject, NotificationChain)}</li>
131
   *   <li>{@link #inverseRemove(InternalEObject, InternalEObject, NotificationChain)}</li>
132
   * </ul>
133
   */
134
  public static abstract class Stateless extends BasicSettingDelegate
135
  {
136
    public Stateless(EStructuralFeature eStructuralFeature)
137
    {
138
      super(eStructuralFeature);
139
    }
140
141
    @Override
142
    public final Setting dynamicSetting(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID)
143
    {
144
      return setting(owner);
145
    }
146
147
    /**
148
     * Creates a setting for the owner and this delegate's feature.
149
     * @param owner the owner for the setting.
150
     * @return a new setting.
151
     */
152
    protected Setting setting(final InternalEObject owner)
153
    {
154
      return 
155
        new EStructuralFeature.Setting()
156
        {
157
          public EObject getEObject()
158
          {
159
            return owner;
160
          }
161
  
162
          public EStructuralFeature getEStructuralFeature()
163
          {
164
            return eStructuralFeature;
165
          }
166
  
167
          public Object get(boolean resolve)
168
          {
169
            return Stateless.this.get(owner, resolve, true);
170
          }
171
  
172
          public boolean isSet()
173
          {
174
            return Stateless.this.isSet(owner);
175
          }
176
  
177
          public void set(Object newValue)
178
          {
179
            Stateless.this.set(owner, newValue);
180
          }
181
  
182
          public void unset()
183
          {
184
            Stateless.this.unset(owner);
185
          }
186
        };
187
    }
188
  
189
    @Override
190
    public final Object dynamicGet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, boolean resolve, boolean coreType)
191
    {
192
      return get(owner, resolve, coreType);
193
    }
194
  
195
    /**
196
     * Returns the value of this delegate's feature for the owner.
197
     * @param owner the object for with to fetch the value.
198
     * @param resolve whether the returned object should be resolved it if is a proxy.
199
     * @param coreType whether to return the core type value or the API type value.
200
     * @return the value of this delegate's feature for the owner.
201
     * @see InternalEObject#eGet(EStructuralFeature, boolean, boolean)
202
     */
203
    protected abstract Object get(InternalEObject owner, boolean resolve, boolean coreType);
204
  
205
    @Override
206
    public final boolean dynamicIsSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID)
207
    {
208
      return isSet(owner);
209
    }
210
  
211
    /**
212
     * Returns whether the value of this delegate's feature is considered set for the owner.
213
     * @param owner the object for with to test is set.
214
     * @return whether the value of this delegate's feature is considered set for the owner.
215
     * @see EObject#eIsSet(EStructuralFeature)
216
     */
217
    protected abstract boolean isSet(InternalEObject owner);
218
  
219
    @Override
220
    public final void dynamicSet(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID, Object newValue)
221
    {
222
      set(owner, newValue);
223
    }
224
  
225
    /**
226
     * Sets this new value of this delegate's feature for the owner.
227
     * @param owner the owner for which to set the value
228
     * @param newValue the new value for the feature.
229
     * @see EObject#eSet(EStructuralFeature, Object)
230
     */
231
    protected void set(InternalEObject owner, Object newValue)
232
    {
233
      throw new UnsupportedOperationException();
234
    }
235
  
236
    @Override
237
    public final void dynamicUnset(InternalEObject owner, DynamicValueHolder settings, int dynamicFeatureID)
238
    {
239
      unset(owner);
240
    }
241
  
242
    /**
243
     * Unsets the values of this delegate's feature for the owner.
244
     * @param owner the owner for which to unset the value.
245
     * @see EObject#eUnset(EStructuralFeature)
246
     */
247
    protected void unset(InternalEObject owner)
248
    {
249
      throw new UnsupportedOperationException();
250
    }
251
  
252
    @Override
253
    public final NotificationChain dynamicInverseAdd
254
     (InternalEObject owner,
255
      DynamicValueHolder settings,
256
      int dynamicFeatureID,
257
      InternalEObject otherEnd,
258
      NotificationChain notifications)
259
    {
260
      return inverseAdd(owner, otherEnd, notifications);
261
    }
262
  
263
    /**
264
     * Adds the object at the other end of a bidirectional reference to this delegate's feature
265
     * and returns accumulated notifications.
266
     * @param owner the owner for which to do the inverse add.
267
     * @param otherEnd the object to inverse add.
268
     * @param notifications the notifications accumulated so far.
269
     * @return the accumulated notifications.
270
     */
271
    protected NotificationChain inverseAdd
272
     (InternalEObject owner,
273
      InternalEObject otherEnd,
274
      NotificationChain notifications)
275
    {
276
      throw new UnsupportedOperationException();
277
    }
278
  
279
    @Override
280
    public final NotificationChain dynamicInverseRemove
281
     (InternalEObject owner,
282
      DynamicValueHolder settings,
283
      int dynamicFeatureID,
284
      InternalEObject otherEnd,
285
      NotificationChain notifications)
286
    {
287
      return inverseRemove(owner, otherEnd, notifications);
288
    }
289
  
290
    /**
291
     * Remove the object at the other end of a bidirectional reference from this delegate's feature
292
     * and returns accumulated notifications.
293
     * @param owner the owner for which to do the inverse remove.
294
     * @param otherEnd the object to inverse remove.
295
     * @param notifications the notifications accumulated so far.
296
     * @return the accumulated notifications.
297
     */
298
    protected NotificationChain inverseRemove
299
     (InternalEObject owner,
300
      InternalEObject otherEnd,
301
      NotificationChain notifications)
302
    {
303
      throw new UnsupportedOperationException();
304
    }
305
  }
306
}
(-)src/org/eclipse/emf/ecore/util/PathSettingDelegate.java (+115 lines)
Added Link Here
1
/**
2
 * <copyright>
3
 *
4
 * Copyright (c) 2008 IBM Corporation and others.
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
8
 * http://www.eclipse.org/legal/epl-v10.html
9
 * 
10
 * Contributors: 
11
 *   IBM - Initial API and implementation
12
 *
13
 * </copyright>
14
 *
15
 * $Id$
16
 */
17
package org.eclipse.emf.ecore.util;
18
19
20
import java.util.ArrayList;
21
import java.util.List;
22
23
import org.eclipse.emf.common.util.URI;
24
import org.eclipse.emf.ecore.EClass;
25
import org.eclipse.emf.ecore.EObject;
26
import org.eclipse.emf.ecore.EStructuralFeature;
27
import org.eclipse.emf.ecore.EcorePackage;
28
import org.eclipse.emf.ecore.InternalEObject;
29
30
public class PathSettingDelegate extends BasicSettingDelegate.Stateless
31
{
32
  protected EStructuralFeature[] path;
33
34
  public PathSettingDelegate(EStructuralFeature eStructuralFeature)
35
  {
36
    super(eStructuralFeature);
37
    String namePath = URI.createURI(eStructuralFeature.getEAnnotation(EcorePackage.eNS_URI).getDetails().get("settingDelegate")).fragment();
38
    String[] segments = namePath.split("/");
39
    path = new EStructuralFeature[segments.length];
40
    for (int i = 0; i < segments.length; ++i)
41
    {
42
      String featureName = segments[i];
43
      EClass eClass = i == 0 ? eStructuralFeature.getEContainingClass() : (EClass)path[i - 1].getEType();
44
      path[i] = eClass.getEStructuralFeature(featureName);
45
    }
46
  }
47
48
  public PathSettingDelegate(EStructuralFeature eStructuralFeature, EStructuralFeature[] path)
49
  {
50
    super(eStructuralFeature);
51
    this.path = path;
52
  }
53
54
  @Override
55
  protected Object get(InternalEObject owner, boolean resolve, boolean coreType)
56
  {
57
    InternalEObject eObject = owner;
58
    for (int i = 0, limit = path.length - 1; i < limit; ++i)
59
    {
60
      EStructuralFeature feature = path[i];
61
      if (feature.isMany())
62
      {
63
        ArrayList<Object> result = new ArrayList<Object>();
64
        @SuppressWarnings("unchecked")
65
        List<EObject> elements = (List<EObject>)eObject.eGet(feature, resolve, coreType);
66
        for (EObject element : elements)
67
        {
68
          Object value = element.eGet(path[i + 1]);
69
          result.add(value);
70
        }
71
        return
72
          new EcoreEList.UnmodifiableEList.FastCompare<Object>
73
            (owner, eStructuralFeature, result.size(), result.toArray());
74
      }
75
      else
76
      {
77
        eObject = (InternalEObject)eObject.eGet(feature);
78
      }
79
    }
80
    return eObject.eGet(path[path.length - 1], resolve, coreType);
81
  }
82
83
  @Override
84
  protected boolean isSet(InternalEObject owner)
85
  {
86
    InternalEObject eObject = owner;
87
    for (int i = 0, limit = path.length - 1; i < limit; ++i)
88
    {
89
      eObject = (InternalEObject)eObject.eGet(path[i]);
90
    }
91
    return eObject.eIsSet(path[path.length - 1]);
92
  }
93
94
  @Override
95
  protected void set(InternalEObject owner, Object newValue)
96
  {
97
    InternalEObject eObject = owner;
98
    for (int i = 0, limit = path.length - 1; i < limit; ++i)
99
    {
100
      eObject = (InternalEObject)eObject.eGet(path[i]);
101
    }
102
    eObject.eSet(path[path.length - 1], newValue);
103
  }
104
105
  @Override
106
  protected void unset(InternalEObject owner)
107
  {
108
    InternalEObject eObject = owner;
109
    for (int i = 0, limit = path.length - 1; i < limit; ++i)
110
    {
111
      eObject = (InternalEObject)eObject.eGet(path[i]);
112
    }
113
    eObject.eUnset(path[path.length - 1]);
114
  }
115
}
(-)src/org/eclipse/emf/ecore/util/BasicCallDelegate.java (+99 lines)
Added Link Here
1
/**
2
 * <copyright>
3
 * 
4
 * Copyright (c) 2008 Zeligsoft Inc. and others.
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
8
 * http://www.eclipse.org/legal/epl-v10.html
9
 * 
10
 * Contributors:
11
 *   Zeligsoft - Initial API and implementation
12
 * 
13
 * </copyright>
14
 *
15
 * $Id$
16
 */
17
18
package org.eclipse.emf.ecore.util;
19
20
import java.lang.reflect.InvocationTargetException;
21
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.ecore.EObject;
24
import org.eclipse.emf.ecore.EStructuralFeature;
25
import org.eclipse.emf.ecore.EcorePackage;
26
import org.eclipse.emf.ecore.InternalEObject;
27
import org.eclipse.emf.ecore.EOperation;
28
29
30
/**
31
 * A basic implementation of the dynamic operation-call delegate API.  In fact,
32
 * it is so basic that it isn't much an implementation at all, but merely
33
 * throws {@link UnsupportedOperationException} on every invocation, except for
34
 * the operations define for the {@link EObject} class.
35
 * Subclasses should override the {@link #dynamicCall(InternalEObject, EList)}
36
 * method to not do that.
37
 */
38
public class BasicCallDelegate implements EOperation.Internal.CallDelegate
39
{
40
  protected EOperation eOperation;
41
  
42
  /**
43
   * Initializes me with the operation that delegates calls to me.
44
   * 
45
   * @param operation my operation
46
   */
47
  public BasicCallDelegate(EOperation operation)
48
  {
49
    this.eOperation = operation;
50
  }
51
52
  public Object dynamicCall(InternalEObject target, EList<?> arguments)	throws InvocationTargetException
53
  {
54
    if (eOperation.getEContainingClass() == EcorePackage.Literals.EOBJECT)
55
    {
56
      //TODO: EOperations should have IDs, like structural features.
57
      // These IDs should be listed in the generated package interface
58
      int id = eOperation.getEContainingClass().getEAllOperations().indexOf(eOperation);
59
      
60
      switch (id) {
61
      case 0: // EcorePackage.EOBJECT___ECLASS
62
        return target.eClass();
63
      case 1: // EcorePackage.EOBJECT___EIS_PROXY
64
        return target.eIsProxy();
65
      case 2: // EcorePackage.EOBJECT___ERESOURCE
66
        return target.eResource();
67
      case 3: // EcorePackage.EOBJECT___ECONTAINER
68
        return target.eContainer();
69
      case 4: // EcorePackage.EOBJECT___ECONTAINING_FEATURE
70
        return target.eContainingFeature();
71
      case 5: // EcorePackage.EOBJECT___ECONTAINMENT_FEATURE
72
        return target.eContainmentFeature();
73
      case 6: // EcorePackage.EOBJECT___ECONTENTS
74
        return target.eContents();
75
      case 7: // EcorePackage.EOBJECT___EALL_CONTENTS
76
        return target.eAllContents();
77
      case 8: // EcorePackage.EOBJECT___ECROSS_REFERENCES
78
        return target.eCrossReferences();
79
      case 9: // EcorePackage.EOBJECT___EGET__FEATURE
80
        return target.eGet((EStructuralFeature) arguments.get(0));
81
      case 10: // EcorePackage.EOBJECT___EGET__FEATURE__RESOLVE
82
        return target.eGet((EStructuralFeature) arguments.get(0), (Boolean) arguments.get(1));
83
      case 11: // EcorePackage.EOBJECT___ESET__FEATURE__NEW_VALUE
84
        target.eSet((EStructuralFeature) arguments.get(0), arguments.get(1));
85
        return null;
86
      case 12: // EcorePackage.EOBJECT___EIS_SET__FEATURE
87
        return target.eIsSet((EStructuralFeature) arguments.get(0));
88
      case 13: // EcorePackage.EOBJECT___EUNSET__FEATURE
89
        target.eUnset((EStructuralFeature) arguments.get(0));
90
        return null;
91
      case 14: // EcorePackage.EOBJECT___ECALL__OPERATION__ARGUMENTS
92
        return target.eCall((EOperation) arguments.get(0), (EList<?>) arguments.get(1));
93
      }
94
    }
95
    
96
    throw new UnsupportedOperationException("eCall not implemented for " + eOperation.getName());
97
  }
98
99
}

Return to bug 255469