[161647] Avoiding automatic application of required stereotypes to profile applications.
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
index eecc650..e6464ee 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ElementImpl.java,v 1.31.2.3 2006/09/13 14:31:05 khussey Exp $
+ * $Id: ElementImpl.java,v 1.31.2.4 2006/10/20 21:06:49 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
@@ -757,15 +757,22 @@
Resource.Internal eInternalResource = eInternalResource();
if (eInternalResource == null || !eInternalResource.isLoading()) {
- ElementOperations.unapplyAllNonApplicableStereotypes(this,
- false);
- ElementOperations.applyAllRequiredStereotypes(this, false);
+ unapplyAllNonApplicableStereotypes();
+ applyAllRequiredStereotypes();
}
}
return msgs;
}
+ protected void unapplyAllNonApplicableStereotypes() {
+ ElementOperations.unapplyAllNonApplicableStereotypes(this, false);
+ }
+
+ protected void applyAllRequiredStereotypes() {
+ ElementOperations.applyAllRequiredStereotypes(this, false);
+ }
+
private static final int ADAPTING = 1 << 7;
public EList eAdapters() {
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ProfileApplicationImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ProfileApplicationImpl.java
index ba6dab6..f0e35ef 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ProfileApplicationImpl.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ProfileApplicationImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ProfileApplicationImpl.java,v 1.17 2006/05/24 20:54:28 khussey Exp $
+ * $Id: ProfileApplicationImpl.java,v 1.17.2.1 2006/10/20 21:06:49 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
@@ -587,4 +587,8 @@
|| eIsSet(UMLPackage.PROFILE_APPLICATION__APPLYING_PACKAGE);
}
+ protected void applyAllRequiredStereotypes() {
+ // do nothing
+ }
+
} //ProfileApplicationImpl
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ElementOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ElementOperations.java
index 1006afd..f305cc2 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ElementOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ElementOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ElementOperations.java,v 1.44.2.5 2006/10/20 20:38:09 khussey Exp $
+ * $Id: ElementOperations.java,v 1.44.2.6 2006/10/20 21:06:49 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.operations;
@@ -1230,53 +1230,47 @@
ProfileApplication profileApplication = (ProfileApplication) allProfileApplications
.next();
+ Profile appliedProfile = profileApplication.getAppliedProfile();
- if (profileApplication != element) {
- Profile appliedProfile = profileApplication
- .getAppliedProfile();
+ if (appliedProfile != null) {
- if (appliedProfile != null) {
+ for (Iterator ownedExtensions = appliedProfile
+ .getOwnedExtensions(true).iterator(); ownedExtensions
+ .hasNext();) {
- for (Iterator ownedExtensions = appliedProfile
- .getOwnedExtensions(true).iterator(); ownedExtensions
- .hasNext();) {
+ Extension ownedExtension = (Extension) ownedExtensions
+ .next();
+ org.eclipse.uml2.uml.Class metaclass = ownedExtension
+ .getMetaclass();
- Extension ownedExtension = (Extension) ownedExtensions
- .next();
- org.eclipse.uml2.uml.Class metaclass = ownedExtension
- .getMetaclass();
+ if (metaclass != null) {
+ EClassifier eClassifier = getEClassifier(metaclass);
- if (metaclass != null) {
- EClassifier eClassifier = getEClassifier(metaclass);
+ if (eClassifier != null) {
+ Stereotype stereotype = ownedExtension
+ .getStereotype();
- if (eClassifier != null) {
- Stereotype stereotype = ownedExtension
- .getStereotype();
+ if (stereotype != null) {
+ ENamedElement appliedDefinition = profileApplication
+ .getAppliedDefinition(stereotype);
- if (stereotype != null) {
- ENamedElement appliedDefinition = profileApplication
- .getAppliedDefinition(stereotype);
+ if (appliedDefinition instanceof EClass
+ && !((EClass) appliedDefinition)
+ .isAbstract()) {
- if (appliedDefinition instanceof EClass
- && !((EClass) appliedDefinition)
- .isAbstract()) {
+ Map stereotypes = (Map) definitions
+ .get(eClassifier);
- Map stereotypes = (Map) definitions
- .get(eClassifier);
+ if (stereotypes == null) {
+ definitions.put(eClassifier,
+ stereotypes = new HashMap());
+ }
- if (stereotypes == null) {
- definitions
- .put(
- eClassifier,
- stereotypes = new HashMap());
- }
+ if (!stereotypes
+ .containsKey(stereotype)) {
- if (!stereotypes
- .containsKey(stereotype)) {
-
- stereotypes.put(stereotype,
- appliedDefinition);
- }
+ stereotypes.put(stereotype,
+ appliedDefinition);
}
}
}