svn commit: r19463 - trunk/src/argouml-app/src/org/argouml/uml/ui/UMLListCellRenderer2.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-05-19 00:12:04-0700
New Revision: 19463

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

Log:
Make safe against non NamedElement items

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/UMLListCellRenderer2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/UMLListCellRenderer2.java?view=diff&pathrev=19463&r1=19462&r2=19463
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/UMLListCellRenderer2.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/UMLListCellRenderer2.java	2011-05-19 00:12:04-0700
@@ -1,13 +1,14 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2011 Contributors - see below
  * 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
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *    tfmorris
+ *    Tom Morris
+ *    Bob Tarling
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -233,7 +234,14 @@
     }
 
     private String getName(Object value) {
-        String name = Model.getFacade().getName(value);
+        String name = null;
+        if (Model.getFacade().isANamedElement(value)) {
+            name = Model.getFacade().getName(value);
+        } else {
+            // TODO: Bob says - if the model element is not named we could
+            // generate a name. e.g. a generalization becomes "Class A -> Class B"
+            name = null;
+        }
         if (name == null || name.equals("")) {
             name = Translator.localize(
                             "misc.name.unnamed",

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

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.