svn commit: r19427 - trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-05-15 10:15:51-0700
New Revision: 19427

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java

Log:
Check if a model element is named before getting its name

Modified: trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java?view=diff&pathrev=19427&r1=19426&r2=19427
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/DisplayTextTree.java	2011-05-15 10:15:51-0700
@@ -344,14 +344,19 @@
      * (guaranteed with length > 0)
      */
     public static final String getModelElementDisplayName(Object modelElement) {
-        String name = Model.getFacade().getName(modelElement);
-        if (name == null || name.equals("")) {
-            name = MessageFormat.format(
-        	    Translator.localize("misc.unnamed"),
-                    new Object[] {
-        		Model.getFacade().getUMLClassName(modelElement)
-                    }
-    	    );
+        String name = "";
+        if (Model.getFacade().isANamedElement(modelElement)) {
+            name = Model.getFacade().getName(modelElement);
+            if (name == null || name.equals("")) {
+                name = MessageFormat.format(
+                        Translator.localize("misc.unnamed"),
+                        new Object[] {
+                            Model.getFacade().getUMLClassName(modelElement)
+                        }
+                );
+            }
+        } else {
+            name = Model.getFacade().getUMLClassName(modelElement);
         }
         return name;
     }

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

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.