svn commit: r16338 - trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-11 15:30:04-0800
New Revision: 16338

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java

Log:
Allow mixed strings and uml elements to be compared

Modified: trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java?view=diff&pathrev=16338&r1=16337&r2=16338
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/util/PathComparator.java	2008-12-11 15:30:04-0800
@@ -74,8 +74,17 @@
         if (o1.equals(o2)) {
             return 0;
         }
-        if (o1 instanceof String && o2 instanceof String) {
-            return collator.compare((String) o1, (String) o2);
+        if (o1 instanceof String) {
+            if (o2 instanceof String) {
+                return collator.compare((String) o1, (String) o2);
+            } else if (Model.getFacade().isAUMLElement(o2)) {
+                // All strings collate before all UML elements
+                return -1;
+            }
+        }
+        if (o2 instanceof String && Model.getFacade().isAUMLElement(o1)) {
+            // All strings collate before all UML elements
+            return 1;
         }
         // Elements are collated first by name hoping for a quick solution
         String name1, name2;

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=983112

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.