*** empty log message ***
diff --git a/deprecated/plugins/org.eclipse.uml2.edit/src/org/eclipse/uml2/provider/ElementItemProvider.java b/deprecated/plugins/org.eclipse.uml2.edit/src/org/eclipse/uml2/provider/ElementItemProvider.java
index bdc4a4d..d580530 100644
--- a/deprecated/plugins/org.eclipse.uml2.edit/src/org/eclipse/uml2/provider/ElementItemProvider.java
+++ b/deprecated/plugins/org.eclipse.uml2.edit/src/org/eclipse/uml2/provider/ElementItemProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ElementItemProvider.java,v 1.5 2004/05/25 20:03:27 khussey Exp $
+ * $Id: ElementItemProvider.java,v 1.6 2004/06/01 20:05:19 khussey Exp $
*/
package org.eclipse.uml2.provider;
@@ -20,6 +20,8 @@
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.provider.EModelElementItemProvider;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
@@ -212,4 +214,19 @@
return UML2EditPlugin.INSTANCE;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.command.CreateChildCommand.Helper#getCreateChildImage(java.lang.Object,
+ * java.lang.Object, java.lang.Object, java.util.Collection)
+ */
+ public Object getCreateChildImage(Object owner, Object feature,
+ Object child, Collection selection) {
+
+ return feature instanceof EReference && child instanceof EObject
+ ? getResourceLocator().getImage(
+ "full/obj16/" + ((EObject) child).eClass().getName()) //$NON-NLS-1$
+ : super.getCreateChildImage(owner, feature, child, selection);
+ }
+
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationClassImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationClassImpl.java
index 44eeca9..ac9c9c4 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationClassImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationClassImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: AssociationClassImpl.java,v 1.10 2004/05/28 05:39:37 khussey Exp $
+ * $Id: AssociationClassImpl.java,v 1.11 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -224,19 +224,26 @@
* @generated NOT
*/
public EList getEndTypes() {
+ EList endTypes = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getAssociation_EndType());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getAssociation_EndType())) {
- List endType = new ArrayList();
+ if (null == endTypes) {
+ List endType = new ArrayList();
- for (Iterator memberEnds = getMemberEnds().iterator(); memberEnds.hasNext();) {
- endType.add(((Property) memberEnds.next()).getType());
- }
+ for (Iterator memberEnds = getMemberEnds().iterator(); memberEnds
+ .hasNext();) {
- getCacheAdapter().put(this, UML2Package.eINSTANCE.getAssociation_EndType(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getAssociation_EndType(), endType.size(), endType.toArray()));
- }
+ endType.add(((Property) memberEnds.next()).getType());
+ }
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getAssociation_EndType());
+ endTypes = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getAssociation_EndType(), endType.size(),
+ endType.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getAssociation_EndType(), endTypes);
+ }
+
+ return endTypes;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationImpl.java
index c2505b2..20dbbdc 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/AssociationImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: AssociationImpl.java,v 1.8 2004/05/20 03:20:03 khussey Exp $
+ * $Id: AssociationImpl.java,v 1.9 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -196,19 +196,26 @@
* @generated NOT
*/
public EList getEndTypes() {
+ EList endTypes = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getAssociation_EndType());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getAssociation_EndType())) {
- List endType = new ArrayList();
+ if (null == endTypes) {
+ List endType = new ArrayList();
- for (Iterator memberEnds = getMemberEnds().iterator(); memberEnds.hasNext();) {
- endType.add(((Property) memberEnds.next()).getType());
- }
+ for (Iterator memberEnds = getMemberEnds().iterator(); memberEnds
+ .hasNext();) {
- getCacheAdapter().put(this, UML2Package.eINSTANCE.getAssociation_EndType(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getAssociation_EndType(), endType.size(), endType.toArray()));
- }
+ endType.add(((Property) memberEnds.next()).getType());
+ }
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getAssociation_EndType());
+ endTypes = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getAssociation_EndType(), endType.size(),
+ endType.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getAssociation_EndType(), endTypes);
+ }
+
+ return endTypes;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/BehaviorImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/BehaviorImpl.java
index b661c63..789628d 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/BehaviorImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/BehaviorImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: BehaviorImpl.java,v 1.10 2004/05/28 05:39:37 khussey Exp $
+ * $Id: BehaviorImpl.java,v 1.11 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -373,26 +373,33 @@
* @generated NOT
*/
public EList getFormalParameters() {
+ EList formalParameters = (EList) getCacheAdapter().get(eResource(),
+ this, UML2Package.eINSTANCE.getBehavior_FormalParameter());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getBehavior_FormalParameter())) {
- List formalParameter = new ArrayList();
-
- for (Iterator parameters = getParameters().iterator(); parameters.hasNext();) {
- Parameter parameter = (Parameter) parameters.next();
-
- if (!ParameterDirectionKind.RETURN_LITERAL.equals(parameter.getDirection())) {
- formalParameter.add(parameter);
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getBehavior_FormalParameter(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getBehavior_FormalParameter(), formalParameter.size(), formalParameter
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getBehavior_FormalParameter());
+ if (null == formalParameters) {
+ List formalParameter = new ArrayList();
+
+ for (Iterator parameters = getParameters().iterator(); parameters
+ .hasNext();) {
+
+ Parameter parameter = (Parameter) parameters.next();
+
+ if (!ParameterDirectionKind.RETURN_LITERAL.equals(parameter
+ .getDirection())) {
+
+ formalParameter.add(parameter);
+ }
+ }
+
+ formalParameters = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getBehavior_FormalParameter(),
+ formalParameter.size(), formalParameter.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getBehavior_FormalParameter(),
+ formalParameters);
+ }
+
+ return formalParameters;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassifierImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassifierImpl.java
index 815fce7..4a8b863 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassifierImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassifierImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ClassifierImpl.java,v 1.10 2004/05/28 05:39:37 khussey Exp $
+ * $Id: ClassifierImpl.java,v 1.11 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -585,16 +585,20 @@
* @generated NOT
*/
public EList getGenerals() {
+ EList generals = (EList) getCacheAdapter().get(eResource(), this,
+ UML2Package.eINSTANCE.getClassifier_General());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getClassifier_General())) {
- Set generals = general();
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getClassifier_General(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getClassifier_General(), generals.size(), generals.toArray()));
- }
+ if (null == generals) {
+ Set general = general();
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getClassifier_General());
+ generals = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getClassifier_General(), general.size(),
+ general.toArray());
+ getCacheAdapter().put(eResource(), this,
+ UML2Package.eINSTANCE.getClassifier_General(), generals);
+ }
+
+ return generals;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DeploymentTargetImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DeploymentTargetImpl.java
index b9700b1..3d8a55e 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DeploymentTargetImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DeploymentTargetImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: DeploymentTargetImpl.java,v 1.5 2004/05/20 03:20:02 khussey Exp $
+ * $Id: DeploymentTargetImpl.java,v 1.6 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -142,31 +142,44 @@
*/
public EList getDeployedElements() {
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement())) {
- Set deployedElement = new HashSet();
-
- for (Iterator deployments = getDeployments().iterator(); deployments.hasNext();) {
-
- for (Iterator deployedArtifacts = ((Deployment) deployments.next()).getDeployedArtifacts().iterator(); deployedArtifacts.hasNext();) {
- DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts.next();
-
- if (Artifact.class.isInstance(deployedArtifact)) {
-
- for (Iterator manifestations = ((Artifact) deployedArtifact).getManifestations().iterator(); manifestations.hasNext();) {
- deployedElement.add(((Manifestation) manifestations.next()).getUtilizedElement());
- }
- }
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(), deployedElement.size(), deployedElement
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+ EList deployedElements = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+
+ if (null == deployedElements) {
+ Set deployedElement = new HashSet();
+
+ for (Iterator deployments = getDeployments().iterator(); deployments
+ .hasNext();) {
+
+ for (Iterator deployedArtifacts = ((Deployment) deployments
+ .next()).getDeployedArtifacts().iterator(); deployedArtifacts
+ .hasNext();) {
+
+ DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts
+ .next();
+
+ if (Artifact.class.isInstance(deployedArtifact)) {
+
+ for (Iterator manifestations = ((Artifact) deployedArtifact)
+ .getManifestations().iterator(); manifestations
+ .hasNext();) {
+
+ deployedElement.add(((Manifestation) manifestations
+ .next()).getUtilizedElement());
+ }
+ }
+ }
+ }
+
+ deployedElements = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElement.size(), deployedElement.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElements);
+ }
+
+ return deployedElements;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
index a4def18..1935f21 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ElementImpl.java,v 1.11 2004/05/28 05:39:37 khussey Exp $
+ * $Id: ElementImpl.java,v 1.12 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -393,14 +393,16 @@
try {
Method method = getClass().getMethod("getApplicableStereotypes", //$NON-NLS-1$
null);
+ Set applicableStereotypes = StereotypeOperations
+ .getApplicableStereotypes(this);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- StereotypeOperations.getApplicableStereotypes(this));
+ if (null == applicableStereotypes) {
+ applicableStereotypes = StereotypeOperations
+ .getApplicableStereotypes(this);
+ getCacheAdapter().put(this, method, applicableStereotypes);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return applicableStereotypes;
} catch (Exception e) {
return StereotypeOperations.getApplicableStereotypes(this);
}
@@ -425,14 +427,15 @@
try {
Method method = getClass().getMethod("getAppliedStereotypes", null); //$NON-NLS-1$
+ Set appliedStereotypes = (Set) getCacheAdapter().get(this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- StereotypeOperations.getAppliedStereotypes(this));
+ if (null == appliedStereotypes) {
+ appliedStereotypes = StereotypeOperations
+ .getAppliedStereotypes(this);
+ getCacheAdapter().put(this, method, appliedStereotypes);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return appliedStereotypes;
} catch (Exception e) {
return StereotypeOperations.getAppliedStereotypes(this);
}
@@ -540,14 +543,14 @@
try {
Method method = getClass().getMethod("getKeywords", null); //$NON-NLS-1$
+ Set keywords = (Set) getCacheAdapter().get(this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- ElementOperations.getKeywords(this));
+ if (null == keywords) {
+ keywords = ElementOperations.getKeywords(this);
+ getCacheAdapter().put(this, method, keywords);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return keywords;
} catch (Exception e) {
return ElementOperations.getKeywords(this);
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InstanceSpecificationImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InstanceSpecificationImpl.java
index bace099..278313c 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InstanceSpecificationImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InstanceSpecificationImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: InstanceSpecificationImpl.java,v 1.7 2004/05/20 03:20:02 khussey Exp $
+ * $Id: InstanceSpecificationImpl.java,v 1.8 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -183,32 +183,44 @@
* @generated NOT
*/
public EList getDeployedElements() {
+ EList deployedElements = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement())) {
- Set deployedElement = new HashSet();
-
- for (Iterator deployments = getDeployments().iterator(); deployments.hasNext();) {
-
- for (Iterator deployedArtifacts = ((Deployment) deployments.next()).getDeployedArtifacts().iterator(); deployedArtifacts.hasNext();) {
- DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts.next();
-
- if (Artifact.class.isInstance(deployedArtifact)) {
-
- for (Iterator manifestations = ((Artifact) deployedArtifact).getManifestations().iterator(); manifestations.hasNext();) {
- deployedElement.add(((Manifestation) manifestations.next()).getUtilizedElement());
- }
- }
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(), deployedElement.size(), deployedElement
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+ if (null == deployedElements) {
+ Set deployedElement = new HashSet();
+
+ for (Iterator deployments = getDeployments().iterator(); deployments
+ .hasNext();) {
+
+ for (Iterator deployedArtifacts = ((Deployment) deployments
+ .next()).getDeployedArtifacts().iterator(); deployedArtifacts
+ .hasNext();) {
+
+ DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts
+ .next();
+
+ if (Artifact.class.isInstance(deployedArtifact)) {
+
+ for (Iterator manifestations = ((Artifact) deployedArtifact)
+ .getManifestations().iterator(); manifestations
+ .hasNext();) {
+
+ deployedElement.add(((Manifestation) manifestations
+ .next()).getUtilizedElement());
+ }
+ }
+ }
+ }
+
+ deployedElements = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElement.size(), deployedElement.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElements);
+ }
+
+ return deployedElements;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NamedElementImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NamedElementImpl.java
index f7d747e..01738cf 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NamedElementImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NamedElementImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: NamedElementImpl.java,v 1.7 2004/05/28 05:39:37 khussey Exp $
+ * $Id: NamedElementImpl.java,v 1.8 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -169,7 +169,18 @@
* @generated NOT
*/
public String getQualifiedName() {
- return qualifiedName();
+ String qualifiedName = (String) getCacheAdapter().get(eResource(),
+ this, UML2Package.eINSTANCE.getNamedElement_QualifiedName());
+
+ if (null == qualifiedName) {
+ qualifiedName = qualifiedName();
+
+ getCacheAdapter().put(eResource(), this,
+ UML2Package.eINSTANCE.getNamedElement_QualifiedName(),
+ qualifiedName);
+ }
+
+ return qualifiedName;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NodeImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NodeImpl.java
index 5d7b4e2..4eb8b3b 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NodeImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/NodeImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: NodeImpl.java,v 1.10 2004/05/28 05:39:37 khussey Exp $
+ * $Id: NodeImpl.java,v 1.11 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -157,32 +157,44 @@
* @generated NOT
*/
public EList getDeployedElements() {
+ EList deployedElements = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement())) {
- Set deployedElement = new HashSet();
-
- for (Iterator deployments = getDeployments().iterator(); deployments.hasNext();) {
-
- for (Iterator deployedArtifacts = ((Deployment) deployments.next()).getDeployedArtifacts().iterator(); deployedArtifacts.hasNext();) {
- DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts.next();
-
- if (Artifact.class.isInstance(deployedArtifact)) {
-
- for (Iterator manifestations = ((Artifact) deployedArtifact).getManifestations().iterator(); manifestations.hasNext();) {
- deployedElement.add(((Manifestation) manifestations.next()).getUtilizedElement());
- }
- }
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(), deployedElement.size(), deployedElement
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+ if (null == deployedElements) {
+ Set deployedElement = new HashSet();
+
+ for (Iterator deployments = getDeployments().iterator(); deployments
+ .hasNext();) {
+
+ for (Iterator deployedArtifacts = ((Deployment) deployments
+ .next()).getDeployedArtifacts().iterator(); deployedArtifacts
+ .hasNext();) {
+
+ DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts
+ .next();
+
+ if (Artifact.class.isInstance(deployedArtifact)) {
+
+ for (Iterator manifestations = ((Artifact) deployedArtifact)
+ .getManifestations().iterator(); manifestations
+ .hasNext();) {
+
+ deployedElement.add(((Manifestation) manifestations
+ .next()).getUtilizedElement());
+ }
+ }
+ }
+ }
+
+ deployedElements = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElement.size(), deployedElement.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElements);
+ }
+
+ return deployedElements;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
index 8621911..10d5fbb 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: PackageImpl.java,v 1.9 2004/05/28 05:39:37 khussey Exp $
+ * $Id: PackageImpl.java,v 1.10 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -1076,14 +1076,17 @@
try {
Method method = getClass().getMethod("getAllAppliedProfiles", null); //$NON-NLS-1$
+ Set allAppliedProfiles = (Set) getCacheAdapter().get(eResource(),
+ this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- ProfileOperations.getAllAppliedProfiles(this));
+ if (null == allAppliedProfiles) {
+ allAppliedProfiles = ProfileOperations
+ .getAllAppliedProfiles(this);
+ getCacheAdapter().put(eResource(), this, method,
+ allAppliedProfiles);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return allAppliedProfiles;
} catch (Exception e) {
return ProfileOperations.getAllAppliedProfiles(this);
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
index ef7eb0b..43861cb 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ProfileImpl.java,v 1.6 2004/05/28 05:39:37 khussey Exp $
+ * $Id: ProfileImpl.java,v 1.7 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -108,26 +108,32 @@
* @generated NOT
*/
public EList getOwnedStereotypes() {
+ EList ownedStereotypes = (EList) getCacheAdapter().get(eResource(),
+ this, UML2Package.eINSTANCE.getProfile_OwnedStereotype());
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getProfile_OwnedStereotype())) {
- Set ownedStereotype = new HashSet();
-
- for (Iterator ownedMembers = getOwnedMembers().iterator(); ownedMembers.hasNext();) {
- NamedElement ownedMember = (NamedElement) ownedMembers.next();
-
- if (Stereotype.class.isInstance(ownedMember)) {
- ownedStereotype.add(ownedMember);
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getProfile_OwnedStereotype(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getProfile_OwnedStereotype(), ownedStereotype.size(), ownedStereotype
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getProfile_OwnedStereotype());
+ if (null == ownedStereotypes) {
+ Set ownedStereotype = new HashSet();
+
+ for (Iterator ownedMembers = getOwnedMembers().iterator(); ownedMembers
+ .hasNext();) {
+
+ NamedElement ownedMember = (NamedElement) ownedMembers.next();
+
+ if (Stereotype.class.isInstance(ownedMember)) {
+ ownedStereotype.add(ownedMember);
+ }
+ }
+
+ ownedStereotypes = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getProfile_OwnedStereotype(),
+ ownedStereotype.size(), ownedStereotype.toArray());
+
+ getCacheAdapter().put(eResource(), this,
+ UML2Package.eINSTANCE.getProfile_OwnedStereotype(),
+ ownedStereotypes);
+ }
+
+ return ownedStereotypes;
}
/**
@@ -617,14 +623,17 @@
try {
Method method = getClass().getMethod(
"getReferencedMetaclasses", null); //$NON-NLS-1$
+ Set referencedMetaclasses = (Set) getCacheAdapter().get(
+ eResource(), this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- ProfileOperations.getReferencedMetaclasses(this));
+ if (null == referencedMetaclasses) {
+ referencedMetaclasses = ProfileOperations
+ .getReferencedMetaclasses(this);
+ getCacheAdapter().put(eResource(), this, method,
+ referencedMetaclasses);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return referencedMetaclasses;
} catch (Exception e) {
return ProfileOperations.getReferencedMetaclasses(this);
}
@@ -640,14 +649,17 @@
try {
Method method = getClass().getMethod(
"getReferencedMetamodels", null); //$NON-NLS-1$
+ Set referencedMetamodels = (Set) getCacheAdapter().get(eResource(),
+ this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- ProfileOperations.getReferencedMetamodels(this));
+ if (null == referencedMetamodels) {
+ referencedMetamodels = ProfileOperations
+ .getReferencedMetamodels(this);
+ getCacheAdapter().put(eResource(), this, method,
+ referencedMetamodels);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return referencedMetamodels;
} catch (Exception e) {
return ProfileOperations.getReferencedMetamodels(this);
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PropertyImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PropertyImpl.java
index 14ef293..1e8c0de 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PropertyImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PropertyImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: PropertyImpl.java,v 1.8 2004/05/28 05:39:37 khussey Exp $
+ * $Id: PropertyImpl.java,v 1.9 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -428,31 +428,44 @@
*/
public EList getDeployedElements() {
- if (!getCacheAdapter().containsKey(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement())) {
- Set deployedElement = new HashSet();
-
- for (Iterator deployments = getDeployments().iterator(); deployments.hasNext();) {
-
- for (Iterator deployedArtifacts = ((Deployment) deployments.next()).getDeployedArtifacts().iterator(); deployedArtifacts.hasNext();) {
- DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts.next();
-
- if (Artifact.class.isInstance(deployedArtifact)) {
-
- for (Iterator manifestations = ((Artifact) deployedArtifact).getManifestations().iterator(); manifestations.hasNext();) {
- deployedElement.add(((Manifestation) manifestations.next()).getUtilizedElement());
- }
- }
- }
- }
-
- getCacheAdapter().put(
- this,
- UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
- new EcoreEList.UnmodifiableEList(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(), deployedElement.size(), deployedElement
- .toArray()));
- }
-
- return (EList) getCacheAdapter().get(this, UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+ EList deployedElements = (EList) getCacheAdapter().get(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement());
+
+ if (null == deployedElements) {
+ Set deployedElement = new HashSet();
+
+ for (Iterator deployments = getDeployments().iterator(); deployments
+ .hasNext();) {
+
+ for (Iterator deployedArtifacts = ((Deployment) deployments
+ .next()).getDeployedArtifacts().iterator(); deployedArtifacts
+ .hasNext();) {
+
+ DeployedArtifact deployedArtifact = (DeployedArtifact) deployedArtifacts
+ .next();
+
+ if (Artifact.class.isInstance(deployedArtifact)) {
+
+ for (Iterator manifestations = ((Artifact) deployedArtifact)
+ .getManifestations().iterator(); manifestations
+ .hasNext();) {
+
+ deployedElement.add(((Manifestation) manifestations
+ .next()).getUtilizedElement());
+ }
+ }
+ }
+ }
+
+ deployedElements = new EcoreEList.UnmodifiableEList(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElement.size(), deployedElement.toArray());
+ getCacheAdapter().put(this,
+ UML2Package.eINSTANCE.getDeploymentTarget_DeployedElement(),
+ deployedElements);
+ }
+
+ return deployedElements;
}
/**
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StereotypeImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StereotypeImpl.java
index 24763d5..9a7a712 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StereotypeImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StereotypeImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: StereotypeImpl.java,v 1.13 2004/05/28 05:39:37 khussey Exp $
+ * $Id: StereotypeImpl.java,v 1.14 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -724,14 +724,15 @@
try {
Method method = getClass().getMethod("getExtendedEClasses", null); //$NON-NLS-1$
+ Set extendedEClasses = (Set) getCacheAdapter().get(this, method);
- if (!getCacheAdapter().containsKey(this, method)) {
- getCacheAdapter().put(this, method,
- StereotypeOperations.getExtendedEClasses(this));
+ if (null == extendedEClasses) {
+ extendedEClasses = StereotypeOperations
+ .getExtendedEClasses(this);
+ getCacheAdapter().put(this, method, extendedEClasses);
}
- return (Set) getCacheAdapter().get(this, method);
-
+ return extendedEClasses;
} catch (Exception e) {
return StereotypeOperations.getExtendedEClasses(this);
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ClassifierOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ClassifierOperations.java
index 130b722..22c2f1f 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ClassifierOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ClassifierOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ClassifierOperations.java,v 1.6 2004/05/11 15:24:01 khussey Exp $
+ * $Id: ClassifierOperations.java,v 1.7 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -24,10 +24,10 @@
import org.eclipse.uml2.Feature;
import org.eclipse.uml2.Generalization;
import org.eclipse.uml2.NamedElement;
-import org.eclipse.uml2.util.UML2Validator;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.UML2Plugin;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.util.UML2Validator;
/**
* A static utility class that provides operations related to classifiers.
@@ -151,11 +151,11 @@
for (Iterator generalizations = classifier.getGeneralizations()
.iterator(); generalizations.hasNext();) {
- Generalization generalization = (Generalization) generalizations
- .next();
+ Classifier general = ((Generalization) generalizations.next())
+ .getGeneral();
- if (null != generalization.getGeneral()) {
- parents.add(generalization.getGeneral());
+ if (null != general) {
+ parents.add(general);
}
}
@@ -211,16 +211,13 @@
result = false;
if (null != diagnostics) {
- diagnostics
- .add(new BasicDiagnostic(
- Diagnostic.WARNING,
- UML2Validator.DIAGNOSTIC_SOURCE,
- UML2Validator.CLASSIFIER__NO_CYCLES_IN_GENERALIZATION,
- UML2Plugin.INSTANCE
- .getString(
- "_UI_Classifier_NoCyclesInGeneralization_diagnostic", //$NON-NLS-1$
- getMessageSubstitutions(context, classifier)),
- new Object[] {classifier}));
+ diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ UML2Validator.CLASSIFIER__NO_CYCLES_IN_GENERALIZATION,
+ UML2Plugin.INSTANCE.getString(
+ "_UI_Classifier_NoCyclesInGeneralization_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(context, classifier)),
+ new Object[]{classifier}));
}
}
@@ -247,15 +244,13 @@
return result;
} else {
diagnostics
- .add(new BasicDiagnostic(
- Diagnostic.WARNING,
- UML2Validator.DIAGNOSTIC_SOURCE,
- UML2Validator.CLASSIFIER__SPECIALIZE_TYPE,
- UML2Plugin.INSTANCE.getString(
- "_UI_Classifier_SpecializeType_diagnostic", //$NON-NLS-1$
- getMessageSubstitutions(context,
- classifier, parent)),
- new Object[] {classifier, parent}));
+ .add(new BasicDiagnostic(Diagnostic.WARNING,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ UML2Validator.CLASSIFIER__SPECIALIZE_TYPE,
+ UML2Plugin.INSTANCE.getString(
+ "_UI_Classifier_SpecializeType_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(context, classifier,
+ parent)), new Object[]{classifier, parent}));
}
}
}
@@ -287,15 +282,13 @@
result = false;
if (null != diagnostics) {
- diagnostics
- .add(new BasicDiagnostic(
- Diagnostic.ERROR,
- UML2Validator.DIAGNOSTIC_SOURCE,
- UML2Validator.CLASSIFIER__INHERITED_MEMBER,
- UML2Plugin.INSTANCE.getString(
- "_UI_Classifier_InheritedMember_diagnostic", //$NON-NLS-1$
- getMessageSubstitutions(context, classifier)),
- new Object[] {classifier}));
+ diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ UML2Validator.CLASSIFIER__INHERITED_MEMBER,
+ UML2Plugin.INSTANCE.getString(
+ "_UI_Classifier_InheritedMember_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(context, classifier)),
+ new Object[]{classifier}));
}
}
@@ -315,16 +308,13 @@
result = false;
if (null != diagnostics) {
- diagnostics
- .add(new BasicDiagnostic(
- Diagnostic.ERROR,
- UML2Validator.DIAGNOSTIC_SOURCE,
- UML2Validator.CLASSIFIER__GENERAL_EQUALS_PARENTS,
- UML2Plugin.INSTANCE
- .getString(
- "_UI_Classifier_GeneralEqualsParents_diagnostic", //$NON-NLS-1$
- getMessageSubstitutions(context, classifier)),
- new Object[] {classifier}));
+ diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ UML2Validator.CLASSIFIER__GENERAL_EQUALS_PARENTS,
+ UML2Plugin.INSTANCE.getString(
+ "_UI_Classifier_GeneralEqualsParents_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(context, classifier)),
+ new Object[]{classifier}));
}
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/StereotypeOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/StereotypeOperations.java
index 91f923b..a2a24b6 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/StereotypeOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/StereotypeOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: StereotypeOperations.java,v 1.6 2004/05/28 05:13:45 khussey Exp $
+ * $Id: StereotypeOperations.java,v 1.7 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -30,6 +30,7 @@
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.uml2.AggregationKind;
+import org.eclipse.uml2.Classifier;
import org.eclipse.uml2.Element;
import org.eclipse.uml2.EnumerationLiteral;
import org.eclipse.uml2.Extension;
@@ -187,12 +188,13 @@
.getOwnedAttributes().iterator(); ownedAttributes.hasNext();) {
Property property = (Property) ownedAttributes.next();
+ Type type = property.getType();
- if (org.eclipse.uml2.Class.class.isInstance(property.getType())
+ if (org.eclipse.uml2.Class.class.isInstance(type)
&& Extension.class.isInstance(property.getAssociation())) {
EClassifier eClassifier = UML2Package.eINSTANCE
- .getEClassifier(property.getType().getName());
+ .getEClassifier(type.getName());
if (EClass.class.isInstance(eClassifier)) {
@@ -214,12 +216,12 @@
for (Iterator generalizations = stereotype.getGeneralizations()
.iterator(); generalizations.hasNext();) {
- Generalization generalization = (Generalization) generalizations
- .next();
+ Classifier general = ((Generalization) generalizations.next())
+ .getGeneral();
- if (Stereotype.class.isInstance(generalization.getGeneral())) {
- getExtendedEClassesHelper((Stereotype) generalization
- .getGeneral(), extendedEClasses);
+ if (Stereotype.class.isInstance(general)) {
+ getExtendedEClassesHelper((Stereotype) general,
+ extendedEClasses);
}
}
}
@@ -625,15 +627,16 @@
if (eStructuralFeature.isMany()) {
List list = null == eObject
- ? Collections.EMPTY_LIST : (List) eObject
- .eGet(eStructuralFeature);
+ ? Collections.EMPTY_LIST
+ : (List) eObject.eGet(eStructuralFeature);
value = -1 == index
- ? list : list.get(index);
+ ? list
+ : list.get(index);
} else {
value = null == eObject
- ? eStructuralFeature.getDefaultValue() : eObject
- .eGet(eStructuralFeature);
+ ? eStructuralFeature.getDefaultValue()
+ : eObject.eGet(eStructuralFeature);
}
if (EcorePackage.eINSTANCE.getEEnum().isInstance(
@@ -912,7 +915,8 @@
*/
public static Profile getProfile(Stereotype stereotype) {
return null == stereotype
- ? null : (Profile) stereotype.getPackage();
+ ? null
+ : (Profile) stereotype.getPackage();
}
/**
@@ -944,7 +948,8 @@
keyword = identifier.length() > 0
? Character.toLowerCase(identifier.charAt(0))
- + identifier.substring(1) : identifier;
+ + identifier.substring(1)
+ : identifier;
}
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
index 9a3248f..7508d81 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
@@ -8,10 +8,11 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: CacheAdapter.java,v 1.3 2004/05/12 22:21:59 khussey Exp $
+ * $Id: CacheAdapter.java,v 1.4 2004/06/01 20:05:27 khussey Exp $
*/
package org.eclipse.uml2.util;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -22,18 +23,22 @@
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
/**
- *
+ *
*/
public class CacheAdapter
extends AdapterImpl {
public static final CacheAdapter INSTANCE = new CacheAdapter();
- private static final Map values = new HashMap();
+ private static final Map values = Collections
+ .synchronizedMap(new HashMap());
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
*/
public void notifyChanged(Notification msg) {
@@ -43,20 +48,20 @@
.getFeature()) {
switch (msg.getEventType()) {
- case Notification.ADD:
+ case Notification.ADD :
((EAnnotation) msg.getNewValue()).eAdapters().add(this);
break;
- case Notification.ADD_MANY:
+ case Notification.ADD_MANY :
for (Iterator newValues = ((List) msg.getNewValue())
.iterator(); newValues.hasNext();) {
((EAnnotation) newValues.next()).eAdapters().add(this);
}
break;
- case Notification.REMOVE:
+ case Notification.REMOVE :
((EAnnotation) msg.getOldValue()).eAdapters().remove(this);
break;
- case Notification.REMOVE_MANY:
+ case Notification.REMOVE_MANY :
for (Iterator oldValues = ((List) msg.getOldValue())
.iterator(); oldValues.hasNext();) {
@@ -67,30 +72,82 @@
}
}
+ Object notifier = msg.getNotifier();
+
+ if (EObject.class.isInstance(notifier)) {
+ clear(((EObject) notifier).eResource());
+ }
+
clear();
}
public void clear() {
- values.clear();
+ clear(null);
+ }
+
+ public void clear(Resource resource) {
+ values.remove(resource);
}
public boolean containsKey(EObject eObject, Object key) {
- return values.containsKey(eObject)
- && ((Map) values.get(eObject)).containsKey(key);
+ return containsKey(null, eObject, key);
+ }
+
+ public boolean containsKey(Resource resource, EObject eObject, Object key) {
+ Map resourceMap = (Map) values.get(resource);
+
+ if (null != resourceMap) {
+ Map eObjectMap = (Map) resourceMap.get(eObject);
+
+ if (null != eObjectMap) {
+ return eObjectMap.containsKey(key);
+ }
+ }
+
+ return false;
}
public Object get(EObject eObject, Object key) {
- return values.containsKey(eObject)
- ? ((Map) values.get(eObject)).get(key) : null;
+ return get(null, eObject, key);
+ }
+
+ public Object get(Resource resource, EObject eObject, Object key) {
+ Map resourceMap = (Map) values.get(resource);
+
+ if (null != resourceMap) {
+ Map eObjectMap = (Map) resourceMap.get(eObject);
+
+ if (null != eObjectMap) {
+ return eObjectMap.get(key);
+ }
+ }
+
+ return null;
}
public Object put(EObject eObject, Object key, Object value) {
-
- if (!values.containsKey(eObject)) {
- values.put(eObject, new HashMap());
- }
-
- return ((Map) values.get(eObject)).put(key, value);
+ return put(null, eObject, key, value);
}
-}
+ public Object put(Resource resource, EObject eObject, Object key,
+ Object value) {
+ Map resourceMap = (Map) values.get(resource);
+
+ if (null == resourceMap) {
+ resourceMap = new HashMap();
+
+ values.put(resource, resourceMap);
+ }
+
+ Map eObjectMap = (Map) resourceMap.get(eObject);
+
+ if (null == eObjectMap) {
+ eObjectMap = new HashMap();
+
+ resourceMap.put(eObject, eObjectMap);
+ }
+
+ return eObjectMap.put(key, value);
+ }
+
+}
\ No newline at end of file