Author: scabanovich
Date: 2008-02-05 12:59:34 -0500 (Tue, 05 Feb 2008)
New Revision: 6116
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java
Log:
JBIDE-1743
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java 2008-02-05
16:15:04 UTC (rev 6115)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java 2008-02-05
17:59:34 UTC (rev 6116)
@@ -142,7 +142,7 @@
public static String getContainsMessage(XModelObject parent, XModelObject child) {
String pathpart = child.getPathPart();
XModelObject e = parent.getChildByPath(pathpart);
- if(e != null) {
+ if(e != null && e != parent) {
if(child.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null)
return null;
String tp = title(parent, true), tc = title(child, false), te = title(e, false);
String mes = (tc.equals(te))
@@ -218,8 +218,12 @@
}
public static String title(XModelObject o, boolean capitalize) {
- String s = o.getAttributeValue("element type") + " " +
- o.getModelEntity().getRenderer().getTitle(o);
+ String elementType = o.getAttributeValue("element type");
+ String objectTitle = o.getModelEntity().getRenderer().getTitle(o);
+ String s = elementType + " " + objectTitle;
+ if(objectTitle != null && objectTitle.equalsIgnoreCase(elementType)) {
+ s = objectTitle;
+ }
return (!capitalize || s.length() < 0 || Character.isUpperCase(s.charAt(0)))
? s : s.substring(0, 1).toUpperCase() + s.substring(1);
}