diff options
author | Christian W. Damus | 2013-12-05 01:43:45 +0000 |
---|---|---|
committer | Christian W. Damus | 2013-12-05 01:51:03 +0000 |
commit | bb7f2b82bdcab069786d2a02a2e463200bd99d97 (patch) | |
tree | 335e11d8166f21560ffe7acaaf04587fb14169e4 | |
parent | 26bb84dbcacaf52d43270ad98910d3378c6e6c8d (diff) | |
download | org.eclipse.uml2-bb7f2b82bdcab069786d2a02a2e463200bd99d97.tar.gz org.eclipse.uml2-bb7f2b82bdcab069786d2a02a2e463200bd99d97.tar.xz org.eclipse.uml2-bb7f2b82bdcab069786d2a02a2e463200bd99d97.zip |
[180744] template expansion supportbugs/180744
https://bugs.eclipse.org/bugs/show_bug.cgi?id=180744
Expose useful merge options in the Expand Template... action and fix capabilities trace for classifiers with multiple bindings.
3 files changed, 37 insertions, 3 deletions
diff --git a/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/TemplateExpanderOptionsDialog.java b/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/TemplateExpanderOptionsDialog.java index c9576c922..2d4adabe0 100644 --- a/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/TemplateExpanderOptionsDialog.java +++ b/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/TemplateExpanderOptionsDialog.java @@ -44,6 +44,21 @@ public class TemplateExpanderOptionsDialog UMLUtil.TemplateExpander.OPTION__MISSING_PARAMETER_SUBSTITUTIONS, new String[]{ignoreChoiceLabel, reportChoiceLabel}, reportChoiceLabel); + + createOptionArea( + parent, + UMLEditorPlugin.INSTANCE + .getString("_UI_RedundantGeneralizations_label"), //$NON-NLS-1$ + UMLUtil.PackageMerger.OPTION__REDUNDANT_GENERALIZATIONS, + new String[]{ignoreChoiceLabel, reportChoiceLabel, + discardChoiceLabel}, discardChoiceLabel); + + createOptionArea( + parent, + UMLEditorPlugin.INSTANCE.getString("_UI_Capabilities_label"), //$NON-NLS-1$ + UMLUtil.PackageMerger.OPTION__CAPABILITIES, new String[]{ + ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel}, + processChoiceLabel); } } diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java index 4138b6bec..02dd95027 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java @@ -2884,6 +2884,9 @@ public class UMLUtil Classifier intermediate = (Classifier) EcoreUtil .create(object.eClass()); + // add the intermediate result to the model + addAnonymousGeneral(intermediate, object); + // have to use a distinct template-expander for each // because multiple bindings to the same template // are allowed and an EcoreUtil.Copier can only copy @@ -2892,9 +2895,6 @@ public class UMLUtil new TemplateExpander() .expand(binding, intermediate, options, diagnostics, context)); - - // add the intermediate result to the model - addAnonymousGeneral(intermediate, object); } return resultingToMergedEObjectMap; diff --git a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/bug/tests/Bug180744Test.java b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/bug/tests/Bug180744Test.java index d20878c4d..4b57be2df 100644 --- a/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/bug/tests/Bug180744Test.java +++ b/tests/org.eclipse.uml2.uml.tests/src/org/eclipse/uml2/uml/bug/tests/Bug180744Test.java @@ -31,6 +31,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.uml2.common.util.UML2Util; import org.eclipse.uml2.uml.Association; +import org.eclipse.uml2.uml.AttributeOwner; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.Element; @@ -280,6 +281,20 @@ public class Bug180744Test assertCapabilityTrace(listOfBars, collection, remove); } + public void testMergeCapabilityTracesClassifierMultipleBindings() { + Class bagListOfFooBars = expand(getClass("BagListOfFooBars")); + Class general1 = (Class) bagListOfFooBars.getNestedClassifiers().get(0); + Class general2 = (Class) bagListOfFooBars.getNestedClassifiers().get(1); + Class collection = getClass("Collection"); + + // the traces are in the expanded template that owns the nested + // anonymous superclasses + Operation remove = getOperation(general1, "remove"); + assertCapabilityTrace(bagListOfFooBars, collection, remove); + Property kind = getProperty(general2, "kind"); + assertCapabilityTrace(bagListOfFooBars, collection, kind); + } + // // Test framework // @@ -330,6 +345,10 @@ public class Bug180744Test URI.createURI(url.toExternalForm()), UMLPackage.Literals.PACKAGE); } + Property getProperty(AttributeOwner owner, String name) { + return owner.getOwnedAttribute(name, null); + } + Operation getOperation(OperationOwner owner, String name) { return owner.getOwnedOperation(name, null, null); } |