svn commit: r13110 - trunk/src_new/org/argouml/ui/DisplayTextTree.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-07-22 12:45:24-0700
New Revision: 13110

Modified:
   trunk/src_new/org/argouml/ui/DisplayTextTree.java

Log:
Remove the last dependency from org.argouml.ui to org.argouml.notation.providers.uml.

Modified: trunk/src_new/org/argouml/ui/DisplayTextTree.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/DisplayTextTree.java?view=diff&rev=13110&p1=trunk/src_new/org/argouml/ui/DisplayTextTree.java&p2=trunk/src_new/org/argouml/ui/DisplayTextTree.java&r1=13109&r2=13110
==============================================================================
--- trunk/src_new/org/argouml/ui/DisplayTextTree.java	(original)
+++ trunk/src_new/org/argouml/ui/DisplayTextTree.java	2007-07-22 12:45:24-0700
@@ -46,7 +46,6 @@
 import org.argouml.model.Model;
 import org.argouml.notation.NotationProvider;
 import org.argouml.notation.NotationProviderFactory2;
-import org.argouml.notation.providers.uml.NotationUtilityUml;
 import org.argouml.uml.ui.UMLTreeCellRenderer;
 import org.tigris.gef.base.Diagram;
 
@@ -216,10 +215,9 @@
 
                 // Look for stereotype
                 if (showStereotype) {
-                    Collection stereos =
+                    Collection<Object> stereos =
                         Model.getFacade().getStereotypes(value);
-                    name += " "
-                        + NotationUtilityUml.generateStereotype(stereos);
+                    name += " " + generateStereotype(stereos);
                     if (name != null && name.length() > 80) {
                         name = name.substring(0, 80) + "...";
                     }
@@ -298,7 +296,37 @@
         }
         return "-";
     }
-    
+
+    /**
+     * @param st a collection of stereotypes
+     * @return a string representing the given stereotype(s)
+     */
+    public static String generateStereotype(Collection<Object> st) {
+        if (st == null) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder(10);
+        boolean first = true;
+        for (Object o : st) {
+            if (!first) {
+                sb.append(',');
+            }
+            if (o != null) {
+                sb.append(Model.getFacade().getName(o));
+                first = false;
+            }
+        }
+        if (!first) {
+            Project project =
+                ProjectManager.getManager().getCurrentProject();
+            ProjectSettings ps = project.getProjectSettings();
+            return ps.getLeftGuillemot()
+                + sb.toString()
+                + ps.getRightGuillemot();
+        }
+        return "";
+    }
+
     public static final String getModelElementDisplayName(Object modelElement) {
         String name = Model.getFacade().getName(modelElement);
         if (name == null || name.equals("")) {
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.