diff options
author | vlorenzo | 2012-04-30 13:53:26 +0000 |
---|---|---|
committer | vlorenzo | 2012-04-30 13:53:26 +0000 |
commit | c3cd0a41a583d8931c3bbcde0e3e397eebd0c319 (patch) | |
tree | 8228893fb7ae18f9acd4823bd3721725082f5960 /sandbox | |
parent | acde973dd2d1567d1b536a133fbca3d9dfc3f166 (diff) | |
download | org.eclipse.papyrus-c3cd0a41a583d8931c3bbcde0e3e397eebd0c319.tar.gz org.eclipse.papyrus-c3cd0a41a583d8931c3bbcde0e3e397eebd0c319.tar.xz org.eclipse.papyrus-c3cd0a41a583d8931c3bbcde0e3e397eebd0c319.zip |
342163: [Usability] Papyrus merge should use the service edit of Papyrus
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342163
A save of my work
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusEFactory.java | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusEFactory.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusEFactory.java index 39553a34edb..263c0270401 100644 --- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusEFactory.java +++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusEFactory.java @@ -49,12 +49,12 @@ public class PapyrusEFactory { public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg) throws FactoryException {
return getEAddCommand(domain, object, name, arg, -1);
}
-
- public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg, final int elementIndex) throws FactoryException {
- return getEAddCommand(domain,object, name, arg, elementIndex, false);
+
+ public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg, final int elementIndex) throws FactoryException {
+ return getEAddCommand(domain, object, name, arg, elementIndex, false);
}
-
- public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain,final EObject object, final String name, final T arg, final int elementIndex, final boolean reorder) throws FactoryException {
+
+ public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg, final int elementIndex, final boolean reorder) throws FactoryException {
Command returnedCommand = null;
final EStructuralFeature feature = eStructuralFeature(object, name);
if(feature.isMany() && arg != null) {
@@ -86,7 +86,7 @@ public class PapyrusEFactory { // } else if (manyValue instanceof Collection<?>) {
// ((Collection<? super T>)manyValue).add(arg);
// }
-
+
if(manyValue instanceof Collection<?>) {
List<Object> newValue = new ArrayList<Object>((Collection<?>)manyValue);
final int listSize = newValue.size();
@@ -100,7 +100,7 @@ public class PapyrusEFactory { attachRealPositionEAdapter(arg, elementIndex);
reorderList((List<?>)newValue);
}
- } if(manyValue instanceof Collection<?>) {
+ } else if(manyValue instanceof Collection<?>) {
newValue.add(arg);
}
returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, newValue);
@@ -114,26 +114,27 @@ public class PapyrusEFactory { //TODO not tested
public static final Command getERemoveCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final Object arg) throws FactoryException {
-// final Object list = object.eGet(eStructuralFeature(object, name));
-// if (list instanceof List) {
-// if (arg != null) {
-// ((List<?>)list).remove(arg);
-// }
-// } else {
-// eSet(object, name, null);
-// }
+ // final Object list = object.eGet(eStructuralFeature(object, name));
+ // if (list instanceof List) {
+ // if (arg != null) {
+ // ((List<?>)list).remove(arg);
+ // }
+ // } else {
+ // eSet(object, name, null);
+ // }
final Object list = object.eGet(eStructuralFeature(object, name));
- if (list instanceof List) {
- if (arg != null) {
+ if(list instanceof List) {
+ if(arg != null) {
List<?> newValue = new ArrayList((List<?>)list);
((List<?>)newValue).remove(arg);
- return getEAddCommand(domain, object, name, newValue);
+ return getESetCommand(domain, object, name, newValue);
}
} else {
return getESetCommand(domain, object, name, null);
}
return null;
}
+
/**
*
* @param object
|