Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenn Hussey2012-03-22 20:18:42 +0000
committerKenn Hussey2012-03-22 20:18:42 +0000
commita888d1254d98d0c73d9eaf79ad4e731952d09586 (patch)
tree5e44844907ebe042b38c24bf1aa5bb1732ac1a16 /plugins/org.eclipse.uml2.uml
parenta96a6894bff375ff20890fedb0333ba8db328abc (diff)
downloadorg.eclipse.uml2.test-a888d1254d98d0c73d9eaf79ad4e731952d09586.tar.gz
org.eclipse.uml2.test-a888d1254d98d0c73d9eaf79ad4e731952d09586.tar.xz
org.eclipse.uml2.test-a888d1254d98d0c73d9eaf79ad4e731952d09586.zip
[374878] Enforcing namespace constraint.
Diffstat (limited to 'plugins/org.eclipse.uml2.uml')
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamedElementOperations.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamedElementOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamedElementOperations.java
index de56ebb2..5243660b 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamedElementOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/NamedElementOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011 IBM Corporation, CEA, and others.
+ * Copyright (c) 2005, 2012 IBM Corporation, 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 (CEA) - 327039, 351774
+ * Kenn Hussey (CEA) - 327039, 351774, 374878
*
*/
package org.eclipse.uml2.uml.internal.operations;
@@ -361,9 +361,16 @@ public class NamedElementOperations
public static Namespace getNamespace(NamedElement namedElement) {
InternalEObject eInternalContainer = ((InternalEObject) namedElement)
.eInternalContainer();
- return eInternalContainer instanceof Namespace
- ? (Namespace) eInternalContainer
- : null;
+
+ if (eInternalContainer instanceof Namespace) {
+ Namespace namespace = (Namespace) eInternalContainer;
+
+ if (namespace.getMembers().contains(namedElement)) {
+ return namespace;
+ }
+ }
+
+ return null;
}
/**

Back to the top