diff options
| author | Mickael LANOE | 2015-03-24 16:49:55 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2015-04-09 09:26:01 +0000 |
| commit | 395db93998cd7ab0491fa5982ff58492e84a3ba0 (patch) | |
| tree | 2ae8889d45c703914b45becd7960fad5dad3467e | |
| parent | 7576a385bba4385cdbd86ab28268ed036a8219ad (diff) | |
| download | org.eclipse.sirius-395db93998cd7ab0491fa5982ff58492e84a3ba0.tar.gz org.eclipse.sirius-395db93998cd7ab0491fa5982ff58492e84a3ba0.tar.xz org.eclipse.sirius-395db93998cd7ab0491fa5982ff58492e84a3ba0.zip | |
[458822] Update the component meta-model to allow additional testing
Add an EOpposite reference "opposites" for the "references" reference
and a reference "references2" without EOpposite in
Component to allow testing on both cases.
Add trace on access to ComponentImpl.getName() with a new mechanism to
disable logging accesses during the logging itself, see
PayloadMarkerAdapter.setEnable(boolean).
Bug: 458822
Change-Id: If65ede30f8db352c2b78dd614af4ecfaaad20128
Signed-off-by: Mickael LANOE <mickael.lanoe@obeo.fr>
11 files changed, 862 insertions, 550 deletions
diff --git a/plugins/org.eclipse.sirius.tests.sample.component/model/component.ecore b/plugins/org.eclipse.sirius.tests.sample.component/model/component.ecore index 5502da7bc4..f4944a1b67 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/model/component.ecore +++ b/plugins/org.eclipse.sirius.tests.sample.component/model/component.ecore @@ -9,7 +9,11 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1" eType="#//Component" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="references" upperBound="-1" - eType="#//Component"/> + eType="#//Component" eOpposite="#//Component/opposites"/> <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//Component"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="opposites" upperBound="-1" + eType="#//Component" eOpposite="#//Component/references"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="references2" upperBound="-1" + eType="#//Component"/> </eClassifiers> </ecore:EPackage> diff --git a/plugins/org.eclipse.sirius.tests.sample.component/model/component.genmodel b/plugins/org.eclipse.sirius.tests.sample.component/model/component.genmodel index 2bdd81f0a0..307c2317ee 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/model/component.genmodel +++ b/plugins/org.eclipse.sirius.tests.sample.component/model/component.genmodel @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2015 Obeo
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

Contributors:
 Obeo - initial API and implementation" - modelDirectory="/org.eclipse.sirius.tests.sample.component/src" modelPluginID="org.eclipse.sirius.tests.sample.component" - modelName="Component" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" - rootImplementsInterface="" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" - complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.8" language="" - classNamePattern="" operationReflection="true" importOrganizing="true"> + modelDirectory="/org.eclipse.sirius.tests.sample.component/src" editorDirectory="/org.eclipse.sirius.tests.sample.component.design/src-gen" + modelPluginID="org.eclipse.sirius.tests.sample.component" modelName="Component" + rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" rootImplementsInterface="" + importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" complianceLevel="6.0" + copyrightFields="false" runtimeVersion="2.8" language="" classNamePattern="" operationReflection="true" + importOrganizing="true"> <foreignModel>component.ecore</foreignModel> <genPackages prefix="Component" basePackage="org.eclipse.sirius.tests.sample" disposableProviderFactory="true" ecorePackage="component.ecore#/"> @@ -15,6 +16,8 @@ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference component.ecore#//Component/children"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference component.ecore#//Component/references"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference component.ecore#//Component/reference"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference component.ecore#//Component/opposites"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference component.ecore#//Component/references2"/> </genClasses> </genPackages> </genmodel:GenModel> diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/Component.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/Component.java index 7d81a1ccff..a390a3a9d7 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/Component.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/Component.java @@ -11,7 +11,6 @@ package org.eclipse.sirius.tests.sample.component; import org.eclipse.emf.common.util.EList; - import org.eclipse.emf.ecore.EObject; /** @@ -31,6 +30,11 @@ import org.eclipse.emf.ecore.EObject; * <em>References</em>}</li> * <li>{@link org.eclipse.sirius.tests.sample.component.Component#getReference * <em>Reference</em>}</li> + * <li>{@link org.eclipse.sirius.tests.sample.component.Component#getOpposites + * <em>Opposites</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.Component#getReferences2 + * <em>References2</em>}</li> * </ul> * </p> * @@ -164,4 +168,43 @@ public interface Component extends EObject { */ void setReference(Component value); + /** + * Returns the value of the '<em><b>Opposites</b></em>' reference list. The + * list contents are of type + * {@link org.eclipse.sirius.tests.sample.component.Component}. It is + * bidirectional and its opposite is ' + * {@link org.eclipse.sirius.tests.sample.component.Component#getReferences + * <em>References</em>}'. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Opposites</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Opposites</em>' reference list. + * @see org.eclipse.sirius.tests.sample.component.ComponentPackage#getComponent_Opposites() + * @see org.eclipse.sirius.tests.sample.component.Component#getReferences + * @model opposite="references" + * @generated + */ + EList<Component> getOpposites(); + + /** + * Returns the value of the '<em><b>References2</b></em>' reference list. + * The list contents are of type + * {@link org.eclipse.sirius.tests.sample.component.Component}. <!-- + * begin-user-doc --> + * <p> + * If the meaning of the '<em>References2</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>References2</em>' reference list. + * @see org.eclipse.sirius.tests.sample.component.ComponentPackage#getComponent_References2() + * @model + * @generated + */ + EList<Component> getReferences2(); + } // Component diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/ComponentPackage.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/ComponentPackage.java index f3f5530a81..75f1687b46 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/ComponentPackage.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/ComponentPackage.java @@ -118,13 +118,31 @@ public interface ComponentPackage extends EPackage { int COMPONENT__REFERENCE = 4; /** + * The feature id for the '<em><b>Opposites</b></em>' reference list. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPONENT__OPPOSITES = 5; + + /** + * The feature id for the '<em><b>References2</b></em>' reference list. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPONENT__REFERENCES2 = 6; + + /** * The number of structural features of the '<em>Component</em>' class. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated * @ordered */ - int COMPONENT_FEATURE_COUNT = 5; + int COMPONENT_FEATURE_COUNT = 7; /** * The number of operations of the '<em>Component</em>' class. <!-- @@ -208,6 +226,30 @@ public interface ComponentPackage extends EPackage { EReference getComponent_Reference(); /** + * Returns the meta object for the reference list ' + * {@link org.eclipse.sirius.tests.sample.component.Component#getOpposites + * <em>Opposites</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for the reference list '<em>Opposites</em>'. + * @see org.eclipse.sirius.tests.sample.component.Component#getOpposites() + * @see #getComponent() + * @generated + */ + EReference getComponent_Opposites(); + + /** + * Returns the meta object for the reference list ' + * {@link org.eclipse.sirius.tests.sample.component.Component#getReferences2 + * <em>References2</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for the reference list '<em>References2</em>'. + * @see org.eclipse.sirius.tests.sample.component.Component#getReferences2() + * @see #getComponent() + * @generated + */ + EReference getComponent_References2(); + + /** * Returns the factory that creates the instances of the model. <!-- * begin-user-doc --> <!-- end-user-doc --> * @@ -284,6 +326,22 @@ public interface ComponentPackage extends EPackage { */ EReference COMPONENT__REFERENCE = eINSTANCE.getComponent_Reference(); + /** + * The meta object literal for the '<em><b>Opposites</b></em>' reference + * list feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EReference COMPONENT__OPPOSITES = eINSTANCE.getComponent_Opposites(); + + /** + * The meta object literal for the '<em><b>References2</b></em>' + * reference list feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EReference COMPONENT__REFERENCES2 = eINSTANCE.getComponent_References2(); + } } // ComponentPackage diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentFactoryImpl.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentFactoryImpl.java index 79e379041c..fb7a5e1e74 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentFactoryImpl.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentFactoryImpl.java @@ -20,9 +20,9 @@ import org.eclipse.sirius.tests.sample.component.ComponentFactory; import org.eclipse.sirius.tests.sample.component.ComponentPackage; /** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- + * end-user-doc --> + * * @generated */ public class ComponentFactoryImpl extends EFactoryImpl implements ComponentFactory { @@ -101,4 +101,4 @@ public class ComponentFactoryImpl extends EFactoryImpl implements ComponentFacto return ComponentPackage.eINSTANCE; } -} //ComponentFactoryImpl +} // ComponentFactoryImpl diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentImpl.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentImpl.java index d30ae15d48..58dd8cddf3 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentImpl.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentImpl.java @@ -22,23 +22,39 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.tests.sample.component.Component; import org.eclipse.sirius.tests.sample.component.ComponentPackage; import org.eclipse.sirius.tests.sample.component.util.PayloadMarkerAdapter; /** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Component</b></em>'. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Component</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#isPayload <em>Payload</em>}</li> - * <li>{@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getChildren <em>Children</em>}</li> - * <li>{@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getReferences <em>References</em>}</li> - * <li>{@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getReference <em>Reference</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getName + * <em>Name</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#isPayload + * <em>Payload</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getChildren + * <em>Children</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getReferences + * <em>References</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getReference + * <em>Reference</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getOpposites + * <em>Opposites</em>}</li> + * <li> + * {@link org.eclipse.sirius.tests.sample.component.impl.ComponentImpl#getReferences2 + * <em>References2</em>}</li> * </ul> * </p> * @@ -46,129 +62,163 @@ import org.eclipse.sirius.tests.sample.component.util.PayloadMarkerAdapter; */ public class ComponentImpl extends MinimalEObjectImpl.Container implements Component { /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ protected static final String NAME_EDEFAULT = null; /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ protected String name = NAME_EDEFAULT; /** - * The default value of the '{@link #isPayload() <em>Payload</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isPayload() - * @generated - * @ordered - */ + * The default value of the '{@link #isPayload() <em>Payload</em>}' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #isPayload() + * @generated + * @ordered + */ protected static final boolean PAYLOAD_EDEFAULT = false; /** - * The cached value of the '{@link #isPayload() <em>Payload</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isPayload() - * @generated - * @ordered - */ + * The cached value of the '{@link #isPayload() <em>Payload</em>}' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #isPayload() + * @generated + * @ordered + */ protected boolean payload = PAYLOAD_EDEFAULT; /** - * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChildren() - * @generated - * @ordered - */ + * The cached value of the '{@link #getChildren() <em>Children</em>}' + * containment reference list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getChildren() + * @generated + * @ordered + */ protected EList<Component> children; /** - * The cached value of the '{@link #getReferences() <em>References</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getReferences() - * @generated - * @ordered - */ + * The cached value of the '{@link #getReferences() <em>References</em>}' + * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getReferences() + * @generated + * @ordered + */ protected EList<Component> references; /** - * The cached value of the '{@link #getReference() <em>Reference</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getReference() - * @generated - * @ordered - */ - protected Component reference; + * The cached value of the '{@link #getReference() <em>Reference</em>}' + * reference. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getReference() + * @generated + * @ordered + */ + protected Component reference; + + /** + * The cached value of the '{@link #getOpposites() <em>Opposites</em>}' + * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getOpposites() + * @generated + * @ordered + */ + protected EList<Component> opposites; + + /** + * The cached value of the '{@link #getReferences2() <em>References2</em>}' + * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getReferences2() + * @generated + * @ordered + */ + protected EList<Component> references2; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ protected ComponentImpl() { - super(); - } + super(); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override protected EClass eStaticClass() { - return ComponentPackage.Literals.COMPONENT; - } + return ComponentPackage.Literals.COMPONENT; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override public String getName() { - return name; - } + if (PayloadMarkerAdapter.isPayload(this)) { + PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); + pma.logAccess(eSetting(ComponentPackage.Literals.COMPONENT__NAME)); + } + + return name; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.COMPONENT__NAME, oldName, name)); - } + if (PayloadMarkerAdapter.isPayload(this)) { + PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); + pma.logAccess(eSetting(ComponentPackage.Literals.COMPONENT__NAME)); + } + + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.COMPONENT__NAME, oldName, name)); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public boolean isPayload() { - return payload; - } + return payload; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated NOT */ + @Override public void setPayload(boolean newPayload) { boolean oldPayload = payload; payload = newPayload; @@ -180,10 +230,11 @@ public class ComponentImpl extends MinimalEObjectImpl.Container implements Compo } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated NOT */ + @Override public EList<Component> getChildren() { if (children == null) { children = new EObjectContainmentEList<Component>(Component.class, this, ComponentPackage.COMPONENT__CHILDREN); @@ -196,13 +247,14 @@ public class ComponentImpl extends MinimalEObjectImpl.Container implements Compo } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated NOT */ + @Override public EList<Component> getReferences() { if (references == null) { - references = new EObjectResolvingEList<Component>(Component.class, this, ComponentPackage.COMPONENT__REFERENCES); + references = new EObjectWithInverseResolvingEList.ManyInverse<Component>(Component.class, this, ComponentPackage.COMPONENT__REFERENCES, ComponentPackage.COMPONENT__OPPOSITES); } if (PayloadMarkerAdapter.isPayload(this)) { PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); @@ -212,175 +264,262 @@ public class ComponentImpl extends MinimalEObjectImpl.Container implements Compo } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Component getReference() { - if (reference != null && reference.eIsProxy()) { - InternalEObject oldReference = (InternalEObject)reference; - reference = (Component)eResolveProxy(oldReference); - if (reference != oldReference) { + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override + public Component getReference() { + if (reference != null && reference.eIsProxy()) { + InternalEObject oldReference = (InternalEObject) reference; + reference = (Component) eResolveProxy(oldReference); + if (reference != oldReference) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentPackage.COMPONENT__REFERENCE, oldReference, reference)); + } + } + + if (PayloadMarkerAdapter.isPayload(this)) { + PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); + pma.logAccess(eSetting(ComponentPackage.Literals.COMPONENT__REFERENCE)); + } + return reference; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public Component basicGetReference() { + return reference; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override + public void setReference(Component newReference) { + if (PayloadMarkerAdapter.isPayload(this)) { + PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); + pma.logAccess(eSetting(ComponentPackage.Literals.COMPONENT__REFERENCE)); + } + + Component oldReference = reference; + reference = newReference; if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentPackage.COMPONENT__REFERENCE, oldReference, reference)); - } + eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.COMPONENT__REFERENCE, oldReference, reference)); } - return reference; - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Component basicGetReference() { - return reference; - } + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override + public EList<Component> getOpposites() { + if (opposites == null) { + opposites = new EObjectWithInverseResolvingEList.ManyInverse<Component>(Component.class, this, ComponentPackage.COMPONENT__OPPOSITES, ComponentPackage.COMPONENT__REFERENCES); + } + if (PayloadMarkerAdapter.isPayload(this)) { + PayloadMarkerAdapter pma = PayloadMarkerAdapter.getPayloadMarker(this); + pma.logAccess((Setting) opposites); + } + return opposites; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setReference(Component newReference) { - Component oldReference = reference; - reference = newReference; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ComponentPackage.COMPONENT__REFERENCE, oldReference, reference)); - } + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EList<Component> getReferences2() { + if (references2 == null) { + references2 = new EObjectResolvingEList<Component>(Component.class, this, ComponentPackage.COMPONENT__REFERENCES2); + } + return references2; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ComponentPackage.COMPONENT__REFERENCES: + return ((InternalEList<InternalEObject>) (InternalEList<?>) getReferences()).basicAdd(otherEnd, msgs); + case ComponentPackage.COMPONENT__OPPOSITES: + return ((InternalEList<InternalEObject>) (InternalEList<?>) getOpposites()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case ComponentPackage.COMPONENT__CHILDREN: - return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); + switch (featureID) { + case ComponentPackage.COMPONENT__CHILDREN: + return ((InternalEList<?>) getChildren()).basicRemove(otherEnd, msgs); + case ComponentPackage.COMPONENT__REFERENCES: + return ((InternalEList<?>) getReferences()).basicRemove(otherEnd, msgs); + case ComponentPackage.COMPONENT__OPPOSITES: + return ((InternalEList<?>) getOpposites()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); } - return super.eInverseRemove(otherEnd, featureID, msgs); - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ComponentPackage.COMPONENT__NAME: - return getName(); - case ComponentPackage.COMPONENT__PAYLOAD: - return isPayload(); - case ComponentPackage.COMPONENT__CHILDREN: - return getChildren(); - case ComponentPackage.COMPONENT__REFERENCES: - return getReferences(); - case ComponentPackage.COMPONENT__REFERENCE: - if (resolve) return getReference(); - return basicGetReference(); + switch (featureID) { + case ComponentPackage.COMPONENT__NAME: + return getName(); + case ComponentPackage.COMPONENT__PAYLOAD: + return isPayload(); + case ComponentPackage.COMPONENT__CHILDREN: + return getChildren(); + case ComponentPackage.COMPONENT__REFERENCES: + return getReferences(); + case ComponentPackage.COMPONENT__REFERENCE: + if (resolve) + return getReference(); + return basicGetReference(); + case ComponentPackage.COMPONENT__OPPOSITES: + return getOpposites(); + case ComponentPackage.COMPONENT__REFERENCES2: + return getReferences2(); + } + return super.eGet(featureID, resolve, coreType); } - return super.eGet(featureID, resolve, coreType); - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ComponentPackage.COMPONENT__NAME: - setName((String)newValue); - return; - case ComponentPackage.COMPONENT__PAYLOAD: - setPayload((Boolean)newValue); - return; - case ComponentPackage.COMPONENT__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection<? extends Component>)newValue); - return; - case ComponentPackage.COMPONENT__REFERENCES: - getReferences().clear(); - getReferences().addAll((Collection<? extends Component>)newValue); - return; - case ComponentPackage.COMPONENT__REFERENCE: - setReference((Component)newValue); - return; + switch (featureID) { + case ComponentPackage.COMPONENT__NAME: + setName((String) newValue); + return; + case ComponentPackage.COMPONENT__PAYLOAD: + setPayload((Boolean) newValue); + return; + case ComponentPackage.COMPONENT__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection<? extends Component>) newValue); + return; + case ComponentPackage.COMPONENT__REFERENCES: + getReferences().clear(); + getReferences().addAll((Collection<? extends Component>) newValue); + return; + case ComponentPackage.COMPONENT__REFERENCE: + setReference((Component) newValue); + return; + case ComponentPackage.COMPONENT__OPPOSITES: + getOpposites().clear(); + getOpposites().addAll((Collection<? extends Component>) newValue); + return; + case ComponentPackage.COMPONENT__REFERENCES2: + getReferences2().clear(); + getReferences2().addAll((Collection<? extends Component>) newValue); + return; + } + super.eSet(featureID, newValue); } - super.eSet(featureID, newValue); - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override public void eUnset(int featureID) { - switch (featureID) { - case ComponentPackage.COMPONENT__NAME: - setName(NAME_EDEFAULT); - return; - case ComponentPackage.COMPONENT__PAYLOAD: - setPayload(PAYLOAD_EDEFAULT); - return; - case ComponentPackage.COMPONENT__CHILDREN: - getChildren().clear(); - return; - case ComponentPackage.COMPONENT__REFERENCES: - getReferences().clear(); - return; - case ComponentPackage.COMPONENT__REFERENCE: - setReference((Component)null); - return; + switch (featureID) { + case ComponentPackage.COMPONENT__NAME: + setName(NAME_EDEFAULT); + return; + case ComponentPackage.COMPONENT__PAYLOAD: + setPayload(PAYLOAD_EDEFAULT); + return; + case ComponentPackage.COMPONENT__CHILDREN: + getChildren().clear(); + return; + case ComponentPackage.COMPONENT__REFERENCES: + getReferences().clear(); + return; + case ComponentPackage.COMPONENT__REFERENCE: + setReference((Component) null); + return; + case ComponentPackage.COMPONENT__OPPOSITES: + getOpposites().clear(); + return; + case ComponentPackage.COMPONENT__REFERENCES2: + getReferences2().clear(); + return; + } + super.eUnset(featureID); } - super.eUnset(featureID); - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override public boolean eIsSet(int featureID) { - switch (featureID) { - case ComponentPackage.COMPONENT__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case ComponentPackage.COMPONENT__PAYLOAD: - return payload != PAYLOAD_EDEFAULT; - case ComponentPackage.COMPONENT__CHILDREN: - return children != null && !children.isEmpty(); - case ComponentPackage.COMPONENT__REFERENCES: - return references != null && !references.isEmpty(); - case ComponentPackage.COMPONENT__REFERENCE: - return reference != null; + switch (featureID) { + case ComponentPackage.COMPONENT__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case ComponentPackage.COMPONENT__PAYLOAD: + return payload != PAYLOAD_EDEFAULT; + case ComponentPackage.COMPONENT__CHILDREN: + return children != null && !children.isEmpty(); + case ComponentPackage.COMPONENT__REFERENCES: + return references != null && !references.isEmpty(); + case ComponentPackage.COMPONENT__REFERENCE: + return reference != null; + case ComponentPackage.COMPONENT__OPPOSITES: + return opposites != null && !opposites.isEmpty(); + case ComponentPackage.COMPONENT__REFERENCES2: + return references2 != null && !references2.isEmpty(); + } + return super.eIsSet(featureID); } - return super.eIsSet(featureID); - } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ @Override public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); - result.append(name); - result.append(", payload: "); - result.append(payload); - result.append(')'); - return result.toString(); - } - -} //ComponentImpl + if (eIsProxy()) + return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(", payload: "); + result.append(payload); + result.append(')'); + return result.toString(); + } + +} // ComponentImpl diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentPackageImpl.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentPackageImpl.java index 46525830d3..bf40efca93 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentPackageImpl.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/impl/ComponentPackageImpl.java @@ -20,209 +20,253 @@ import org.eclipse.sirius.tests.sample.component.ComponentFactory; import org.eclipse.sirius.tests.sample.component.ComponentPackage; /** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- + * end-user-doc --> + * * @generated */ public class ComponentPackageImpl extends EPackageImpl implements ComponentPackage { /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private EClass componentEClass = null; /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.sirius.tests.sample.component.ComponentPackage#eNS_URI - * @see #init() - * @generated - */ + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the + * package package URI value. + * <p> + * Note: the correct way to create the package is via the static factory + * method {@link #init init()}, which also performs initialization of the + * package, or returns the registered package, if one already exists. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.sirius.tests.sample.component.ComponentPackage#eNS_URI + * @see #init() + * @generated + */ private ComponentPackageImpl() { - super(eNS_URI, ComponentFactory.eINSTANCE); - } + super(eNS_URI, ComponentFactory.eINSTANCE); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private static boolean isInited = false; /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link ComponentPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ + * Creates, registers, and initializes the <b>Package</b> for this model, + * and for any others upon which it depends. + * + * <p> + * This method is used to initialize {@link ComponentPackage#eINSTANCE} when + * that field is accessed. Clients should not invoke it directly. Instead, + * they should simply access that field to obtain the package. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ public static ComponentPackage init() { - if (isInited) return (ComponentPackage)EPackage.Registry.INSTANCE.getEPackage(ComponentPackage.eNS_URI); + if (isInited) + return (ComponentPackage) EPackage.Registry.INSTANCE.getEPackage(ComponentPackage.eNS_URI); - // Obtain or create and register package - ComponentPackageImpl theComponentPackage = (ComponentPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ComponentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ComponentPackageImpl()); + // Obtain or create and register package + ComponentPackageImpl theComponentPackage = (ComponentPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ComponentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) + : new ComponentPackageImpl()); - isInited = true; + isInited = true; - // Create package meta-data objects - theComponentPackage.createPackageContents(); + // Create package meta-data objects + theComponentPackage.createPackageContents(); - // Initialize created meta-data - theComponentPackage.initializePackageContents(); + // Initialize created meta-data + theComponentPackage.initializePackageContents(); - // Mark meta-data to indicate it can't be changed - theComponentPackage.freeze(); + // Mark meta-data to indicate it can't be changed + theComponentPackage.freeze(); - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(ComponentPackage.eNS_URI, theComponentPackage); - return theComponentPackage; - } + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ComponentPackage.eNS_URI, theComponentPackage); + return theComponentPackage; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EClass getComponent() { - return componentEClass; - } + return componentEClass; + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EAttribute getComponent_Name() { - return (EAttribute)componentEClass.getEStructuralFeatures().get(0); - } + return (EAttribute) componentEClass.getEStructuralFeatures().get(0); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EAttribute getComponent_Payload() { - return (EAttribute)componentEClass.getEStructuralFeatures().get(1); - } + return (EAttribute) componentEClass.getEStructuralFeatures().get(1); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EReference getComponent_Children() { - return (EReference)componentEClass.getEStructuralFeatures().get(2); - } + return (EReference) componentEClass.getEStructuralFeatures().get(2); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EReference getComponent_References() { - return (EReference)componentEClass.getEStructuralFeatures().get(3); - } + return (EReference) componentEClass.getEStructuralFeatures().get(3); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getComponent_Reference() { - return (EReference)componentEClass.getEStructuralFeatures().get(4); - } + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EReference getComponent_Reference() { + return (EReference) componentEClass.getEStructuralFeatures().get(4); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EReference getComponent_Opposites() { + return (EReference) componentEClass.getEStructuralFeatures().get(5); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EReference getComponent_References2() { + return (EReference) componentEClass.getEStructuralFeatures().get(6); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public ComponentFactory getComponentFactory() { - return (ComponentFactory)getEFactoryInstance(); - } + return (ComponentFactory) getEFactoryInstance(); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private boolean isCreated = false; /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> + * Creates the meta-model objects for the package. This method is guarded to + * have no affect on any invocation but its first. <!-- begin-user-doc --> * <!-- end-user-doc --> - * @generated - */ + * + * @generated + */ public void createPackageContents() { - if (isCreated) return; - isCreated = true; + if (isCreated) + return; + isCreated = true; - // Create classes and their features - componentEClass = createEClass(COMPONENT); - createEAttribute(componentEClass, COMPONENT__NAME); - createEAttribute(componentEClass, COMPONENT__PAYLOAD); - createEReference(componentEClass, COMPONENT__CHILDREN); - createEReference(componentEClass, COMPONENT__REFERENCES); - createEReference(componentEClass, COMPONENT__REFERENCE); - } + // Create classes and their features + componentEClass = createEClass(COMPONENT); + createEAttribute(componentEClass, COMPONENT__NAME); + createEAttribute(componentEClass, COMPONENT__PAYLOAD); + createEReference(componentEClass, COMPONENT__CHILDREN); + createEReference(componentEClass, COMPONENT__REFERENCES); + createEReference(componentEClass, COMPONENT__REFERENCE); + createEReference(componentEClass, COMPONENT__OPPOSITES); + createEReference(componentEClass, COMPONENT__REFERENCES2); + } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private boolean isInitialized = false; /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; + if (isInitialized) + return; + isInitialized = true; - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); - // Create type parameters + // Create type parameters - // Set bounds for type parameters + // Set bounds for type parameters - // Add supertypes to classes + // Add supertypes to classes - // Initialize classes, features, and operations; add parameters - initEClass(componentEClass, Component.class, "Component", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getComponent_Name(), ecorePackage.getEString(), "name", null, 1, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getComponent_Payload(), ecorePackage.getEBoolean(), "payload", null, 1, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getComponent_Children(), this.getComponent(), null, "children", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getComponent_References(), this.getComponent(), null, "references", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getComponent_Reference(), this.getComponent(), null, "reference", null, 0, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Initialize classes, features, and operations; add parameters + initEClass(componentEClass, Component.class, "Component", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getComponent_Name(), ecorePackage.getEString(), "name", null, 1, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + initEAttribute(getComponent_Payload(), ecorePackage.getEBoolean(), "payload", null, 1, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); + initEReference(getComponent_Children(), this.getComponent(), null, "children", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComponent_References(), this.getComponent(), this.getComponent_Opposites(), "references", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComponent_Reference(), this.getComponent(), null, "reference", null, 0, 1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComponent_Opposites(), this.getComponent(), this.getComponent_References(), "opposites", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComponent_References2(), this.getComponent(), null, "references2", null, 0, -1, Component.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, + IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - // Create resource - createResource(eNS_URI); - } + // Create resource + createResource(eNS_URI); + } -} //ComponentPackageImpl +} // ComponentPackageImpl diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentAdapterFactory.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentAdapterFactory.java index 861d1fc950..029ccb6f45 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentAdapterFactory.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentAdapterFactory.java @@ -17,109 +17,110 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.tests.sample.component.*; /** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides + * an adapter <code>createXXX</code> method for each class of the model. <!-- + * end-user-doc --> + * * @see org.eclipse.sirius.tests.sample.component.ComponentPackage * @generated */ public class ComponentAdapterFactory extends AdapterFactoryImpl { /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ protected static ComponentPackage modelPackage; /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ public ComponentAdapterFactory() { - if (modelPackage == null) { - modelPackage = ComponentPackage.eINSTANCE; + if (modelPackage == null) { + modelPackage = ComponentPackage.eINSTANCE; + } } - } /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> This implementation returns <code>true</code> if + * the object is either the model's package or is an instance object of the + * model. <!-- end-user-doc --> + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ @Override public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ComponentSwitch<Adapter> modelSwitch = - new ComponentSwitch<Adapter>() { - @Override - public Adapter caseComponent(Component object) { - return createComponentAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } + * The switch that delegates to the <code>createXXX</code> methods. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected ComponentSwitch<Adapter> modelSwitch = new ComponentSwitch<Adapter>() { + @Override + public Adapter caseComponent(Component object) { + return createComponentAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } }; /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> + * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ + * + * @param target + * the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ @Override public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - + return modelSwitch.doSwitch((EObject) target); + } /** - * Creates a new adapter for an object of class '{@link org.eclipse.sirius.tests.sample.component.Component <em>Component</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.sirius.tests.sample.component.Component - * @generated - */ + * Creates a new adapter for an object of class ' + * {@link org.eclipse.sirius.tests.sample.component.Component + * <em>Component</em>}'. <!-- begin-user-doc --> This default implementation + * returns null so that we can easily ignore cases; it's useful to ignore a + * case when inheritance will catch all the cases anyway. <!-- end-user-doc + * --> + * + * @return the new adapter. + * @see org.eclipse.sirius.tests.sample.component.Component + * @generated + */ public Adapter createComponentAdapter() { - return null; - } + return null; + } /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ + * Creates a new adapter for the default case. <!-- begin-user-doc --> This + * default implementation returns null. <!-- end-user-doc --> + * + * @return the new adapter. + * @generated + */ public Adapter createEObjectAdapter() { - return null; - } + return null; + } -} //ComponentAdapterFactory +} // ComponentAdapterFactory diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentSwitch.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentSwitch.java index 4d74a587c7..ed3f7418ad 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentSwitch.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/ComponentSwitch.java @@ -16,101 +16,106 @@ import org.eclipse.emf.ecore.util.Switch; import org.eclipse.sirius.tests.sample.component.*; /** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance + * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)} * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> + * starting with the actual class of the object and proceeding up the + * inheritance hierarchy until a non-null result is returned, which is the + * result of the switch. <!-- end-user-doc --> + * * @see org.eclipse.sirius.tests.sample.component.ComponentPackage * @generated */ public class ComponentSwitch<T> extends Switch<T> { /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ protected static ComponentPackage modelPackage; /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ + * Creates an instance of the switch. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ public ComponentSwitch() { - if (modelPackage == null) { - modelPackage = ComponentPackage.eINSTANCE; + if (modelPackage == null) { + modelPackage = ComponentPackage.eINSTANCE; + } } - } /** - * Checks whether this is a switch for the given package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @parameter ePackage the package in question. - * @return whether this is a switch for the given package. - * @generated - */ + * Checks whether this is a switch for the given package. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ @Override protected boolean isSwitchFor(EPackage ePackage) { - return ePackage == modelPackage; - } + return ePackage == modelPackage; + } /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ + * Calls <code>caseXXX</code> for each class of the model until one returns + * a non null result; it yields that result. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> + * call. + * @generated + */ @Override protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case ComponentPackage.COMPONENT: { - Component component = (Component)theEObject; - T result = caseComponent(component); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); + switch (classifierID) { + case ComponentPackage.COMPONENT: { + Component component = (Component) theEObject; + T result = caseComponent(component); + if (result == null) + result = defaultCase(theEObject); + return result; + } + default: + return defaultCase(theEObject); + } } - } /** - * Returns the result of interpreting the object as an instance of '<em>Component</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Component</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ + * Returns the result of interpreting the object as an instance of ' + * <em>Component</em>'. <!-- begin-user-doc --> This implementation returns + * null; returning a non-null result will terminate the switch. <!-- + * end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Component</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ public T caseComponent(Component object) { - return null; - } + return null; + } /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ + * Returns the result of interpreting the object as an instance of ' + * <em>EObject</em>'. <!-- begin-user-doc --> This implementation returns + * null; returning a non-null result will terminate the switch, but this is + * the last case anyway. <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ @Override public T defaultCase(EObject object) { - return null; - } + return null; + } -} //ComponentSwitch +} // ComponentSwitch diff --git a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/PayloadMarkerAdapter.java b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/PayloadMarkerAdapter.java index 4329288525..8cf91d1d7c 100644 --- a/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/PayloadMarkerAdapter.java +++ b/plugins/org.eclipse.sirius.tests.sample.component/src/org/eclipse/sirius/tests/sample/component/util/PayloadMarkerAdapter.java @@ -60,9 +60,11 @@ public class PayloadMarkerAdapter extends EContentAdapter { } private final List<FeatureAccess> accessLog = new ArrayList<PayloadMarkerAdapter.FeatureAccess>(); - + private final Multiset<String> uniqueContexts = ConcurrentHashMultiset.create(); + private boolean enabled = true; + public static void install(EObject target) { for (Adapter a : target.eAdapters()) { if (a instanceof PayloadMarkerAdapter) { @@ -85,11 +87,17 @@ public class PayloadMarkerAdapter extends EContentAdapter { return null; } + public void setEnable(boolean enabled) { + this.enabled = enabled; + } + public synchronized void logAccess(Setting s) { - String context = computeContext(); - FeatureAccess fa = FeatureAccess.of(s, context); - accessLog.add(fa); - uniqueContexts.add(context); + if (enabled) { + String context = computeContext(); + FeatureAccess fa = FeatureAccess.of(s, context); + accessLog.add(fa); + uniqueContexts.add(context); + } } private static String computeContext() { @@ -99,7 +107,8 @@ public class PayloadMarkerAdapter extends EContentAdapter { boolean tooDeep = false; for (int i = 0; i < stack.length; i++) { StackTraceElement elt = stack[i]; - if (!tooDeep && (elt.getClassName().equals("org.eclipse.swt.widgets.RunnableLock") && elt.getMethodName().equals("run")) || (elt.getClassName().equals("org.eclipse.core.runtime.SafeRunner") && elt.getMethodName().equals("run"))) { + if (!tooDeep && (elt.getClassName().equals("org.eclipse.swt.widgets.RunnableLock") && elt.getMethodName().equals("run")) + || (elt.getClassName().equals("org.eclipse.core.runtime.SafeRunner") && elt.getMethodName().equals("run"))) { tooDeep = true; } if (!tooDeep && !elt.getClassName().startsWith(PayloadMarkerAdapter.class.getName())) { @@ -112,7 +121,7 @@ public class PayloadMarkerAdapter extends EContentAdapter { public synchronized List<FeatureAccess> getAccessLog() { return Collections.unmodifiableList(new ArrayList<FeatureAccess>(accessLog)); } - + public Multiset<String> getUniqueContexts() { return ImmutableMultiset.copyOf(uniqueContexts); } diff --git a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java index 9fd5110e0b..3258dcb32c 100644 --- a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java +++ b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java @@ -478,12 +478,18 @@ public class SiriusDebugView extends AbstractDebugView { int totalSize = log.size(); int shown = Math.min(totalSize, max); TabularReport tr = new TabularReport(/* "Timestamp", */"EObject", "Feature"); - for (int i = log.size() > max ? log.size() - max : 0; i < log.size(); i++) { - FeatureAccess featureAccess = log.get(i); - tr.addLine(Arrays.asList(/* - * String.format("%tT", - * featureAccess.timestamp), - */((Component) featureAccess.setting.getEObject()).getName(), featureAccess.setting.getEStructuralFeature().getName())); + + try { + PayloadMarkerAdapter.INSTANCE.setEnable(false); + for (int i = log.size() > max ? log.size() - max : 0; i < log.size(); i++) { + FeatureAccess featureAccess = log.get(i); + tr.addLine(Arrays.asList(/* + * String.format("%tT", + * featureAccess.timestamp), + */((Component) featureAccess.setting.getEObject()).getName(), featureAccess.setting.getEStructuralFeature().getName())); + } + } finally { + PayloadMarkerAdapter.INSTANCE.setEnable(true); } StringBuilder sb = new StringBuilder(); sb.append("Showing " + shown + " of " + totalSize + " accesses.\n"); |
