From 183dba6384d9a445aae6039b207ac890f41b3654 Mon Sep 17 00:00:00 2001 From: pkonemann Date: Tue, 7 Jun 2011 08:21:10 +0200 Subject: Bugfix: Hidden diff elements were transformed twice. Bugfix: MPatch creation wizard did not open when .emfdiff file is selected. Change-Id: I6c6586bd2d358efcff8c9d15d4e5925fa03632a4 --- .../mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java | 18 +++++++++++++++++- .../emfdiff2mpatch/wizards/EmfdiffExportWizard.java | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java b/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java index 7c7aa8924..975fca959 100644 --- a/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java +++ b/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java @@ -157,7 +157,7 @@ public class Emfdiff2Mpatch { final List diffElements = ExtEcoreUtils.collectTypedElements(diffModel.getOwnedElements(), Collections.singleton(DiffPackage.Literals.DIFF_ELEMENT), true); for (EObject diffElement : diffElements) { - if (!(diffElement instanceof DiffGroup)) { + if (shallTransform((DiffElement) diffElement)) { mpatch.getChanges().add(toIndepChange((DiffElement) diffElement)); } } @@ -165,6 +165,22 @@ public class Emfdiff2Mpatch { return mpatch; } + /** + * This returns true if the given {@link DiffElement} shall be transformed to mpatch. + * + * Subclasses may override this helper method to change this behavior. + */ + protected boolean shallTransform(DiffElement diffElement) { + // no groups! grouping may be added later. + if (diffElement instanceof DiffGroup) + return false; + // ignore this element if it is hidden by another diff element + if (!diffElement.getIsHiddenBy().isEmpty()) + return false; + // otherwise return true + return true; + } + /** * mapping for abstract DiffElement: *