[459651] Adding validation warnings for indistinguishable members.
diff --git a/plugins/org.eclipse.uml2.uml/plugin.properties b/plugins/org.eclipse.uml2.uml/plugin.properties
index 03ae231..4515442 100644
--- a/plugins/org.eclipse.uml2.uml/plugin.properties
+++ b/plugins/org.eclipse.uml2.uml/plugin.properties
@@ -1,4 +1,4 @@
-# Copyright (c) 2005, 2014 IBM Corporation, Embarcadero Technologies, CEA, and others.
+# Copyright (c) 2005, 2015 IBM Corporation, Embarcadero Technologies, CEA, and others.
# 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
@@ -7,7 +7,7 @@
# Contributors:
# IBM - initial API and implementation
# Kenn Hussey (Embarcadero Technologies) - 156879, 215488, 213218, 204200
-# Kenn Hussey (CEA) - 327039, 351774, 373709, 388636, 295864, 397140, 316165, 322715, 80307, 416833, 418466
+# Kenn Hussey (CEA) - 327039, 351774, 373709, 388636, 295864, 397140, 316165, 322715, 80307, 416833, 418466, 459651
# Christian W. Damus (CEA) - 373643, 374012, 163556, 409396, 180744, 403374, 420338, 405065
#
@@ -118,6 +118,7 @@
_UI_NamedElement_VisibilityNeedsOwnership_diagnostic = Named element ''{0}'' is not owned by a namespace, but it has visibility.
_UI_Namespace_MembersDistinguishable_diagnostic = Not all the members of namespace ''{0}'' are distinguishable within it.
+_UI_Namespace_MemberDistinguishable_diagnostic = Named element ''{0}'' is not distinguishable from all other members of namespace ''{1}''.
_UI_Operation_OnlyBodyForQuery_diagnostic = A body condition is specified for operation ''{0}'', but it is not a query.
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamespaceOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamespaceOperations.java
index b32afe6..85f880f 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamespaceOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamespaceOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
* Kenn Hussey - 323181
- * Kenn Hussey (CEA) - 327039, 418466, 451350
+ * Kenn Hussey (CEA) - 327039, 418466, 451350, 459651
*
*/
package org.eclipse.uml2.uml.internal.operations;
@@ -91,10 +91,32 @@
DiagnosticChain diagnostics, Map<Object, Object> context) {
boolean result = true;
- if (!namespace.membersAreDistinguishable()) {
- result = false;
+ if (diagnostics != null) {
+ EList<NamedElement> namespaceMembers = namespace.getMembers();
- if (diagnostics != null) {
+ for (NamedElement member : namespaceMembers) {
+
+ for (NamedElement otherMember : namespaceMembers) {
+
+ if (member != otherMember
+ && !member.isDistinguishableFrom(otherMember, namespace)) {
+
+ result = false;
+
+ diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
+ UMLValidator.DIAGNOSTIC_SOURCE,
+ UMLValidator.NAMESPACE__MEMBERS_DISTINGUISHABLE,
+ UMLPlugin.INSTANCE.getString(
+ "_UI_Namespace_MemberDistinguishable_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(context, member, namespace)),
+ new Object[]{member}));
+
+ break;
+ }
+ }
+ }
+
+ if (!result) {
diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
UMLValidator.DIAGNOSTIC_SOURCE,
UMLValidator.NAMESPACE__MEMBERS_DISTINGUISHABLE,
@@ -103,6 +125,8 @@
getMessageSubstitutions(context, namespace)),
new Object[]{namespace}));
}
+ } else {
+ result = namespace.membersAreDistinguishable();
}
return result;