Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-02-01 11:00:34 -0500
committercletavernie2013-02-01 11:00:34 -0500
commit1fa89e8995d5a65dbe0590970c4fbb93d5cf06fc (patch)
tree0d5670d6718ed2374c482b0e314bc7088608b7bb
parent281b8ec35d2fbfa5cde5773c04cb525d93638a81 (diff)
downloadorg.eclipse.papyrus-1fa89e8995d5a65dbe0590970c4fbb93d5cf06fc.tar.gz
org.eclipse.papyrus-1fa89e8995d5a65dbe0590970c4fbb93d5cf06fc.tar.xz
org.eclipse.papyrus-1fa89e8995d5a65dbe0590970c4fbb93d5cf06fc.zip
394939: [Papyrus UI] Papyrus shall enable to model Classes attributes.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=394939
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/utils/NamedElementHelper.java51
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java7
2 files changed, 32 insertions, 26 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/utils/NamedElementHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/utils/NamedElementHelper.java
index a328e3d83e3..014f72a8ccf 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/utils/NamedElementHelper.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/utils/NamedElementHelper.java
@@ -76,29 +76,29 @@ public class NamedElementHelper {
@Deprecated
public String getNewUMLElementName(Element umlParent, String baseString) {
return getDefaultNameWithIncrementFromBase(baseString, umlParent.eContents());
-// this.setBaseString(baseString);
-// String name = ""; //$NON-NLS-1$
-//
-// boolean found = false;
-// // i <10000: avoid infinite loops
-// for(int i = 1; i < 5; i++) {
-// found = false;
-// name = getBaseString() + i;
-//
-// Iterator<?> it = umlParent.getOwnedElements().iterator();
-// while(it.hasNext() && !found) {
-// Object o = it.next();
-// if(o instanceof NamedElement) {
-// if(name.equals(((NamedElement)o).getName())) {
-// found = true;
-// }
-// }
-// }
-// if(!found) {
-// return name;
-// }
-// }
-// return getBaseString() + "X"; //$NON-NLS-1$
+ // this.setBaseString(baseString);
+ // String name = ""; //$NON-NLS-1$
+ //
+ // boolean found = false;
+ // // i <10000: avoid infinite loops
+ // for(int i = 1; i < 5; i++) {
+ // found = false;
+ // name = getBaseString() + i;
+ //
+ // Iterator<?> it = umlParent.getOwnedElements().iterator();
+ // while(it.hasNext() && !found) {
+ // Object o = it.next();
+ // if(o instanceof NamedElement) {
+ // if(name.equals(((NamedElement)o).getName())) {
+ // found = true;
+ // }
+ // }
+ // }
+ // if(!found) {
+ // return name;
+ // }
+ // }
+ // return getBaseString() + "X"; //$NON-NLS-1$
}
/**
@@ -112,9 +112,12 @@ public class NamedElementHelper {
public void setBaseString(String baseString) {
this.baseString = baseString;
}
-
+
@SuppressWarnings("rawtypes")
public static String getDefaultNameWithIncrementFromBase(String base, Collection contents) {
+ if("property".equalsIgnoreCase(base)) {
+ base = "Attribute";
+ }
int nextNumber = 1;
for(Object o : contents) {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
index 0a1e36a9190..13da0b0c704 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
@@ -83,15 +83,18 @@ public class NamedElementUtil {
@SuppressWarnings("rawtypes")
public static String getDefaultNameWithIncrement(String prefix, EObject newElement, Collection contents) {
- if (prefix == null) {
+ if(prefix == null) {
prefix = "";
}
return getDefaultNameWithIncrementFromBase(prefix + newElement.eClass().getName(), contents);
}
-
+
@SuppressWarnings("rawtypes")
public static String getDefaultNameWithIncrementFromBase(String base, Collection contents) {
+ if(base.equalsIgnoreCase("property")) {
+ base = "Attribute";
+ }
int nextNumber = 1;
for(Object o : contents) {

Back to the top