summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkonemann2011-06-07 02:21:10 (EDT)
committerpkonemann2011-06-07 02:21:10 (EDT)
commit183dba6384d9a445aae6039b207ac890f41b3654 (patch)
tree132f5bce1598a1050a2fa97c3006256ede7e53b6
parent632297b5eac379049d1eaefbd1fbdbc835afad11 (diff)
downloadorg.eclipse.emf.compare-183dba6384d9a445aae6039b207ac890f41b3654.zip
org.eclipse.emf.compare-183dba6384d9a445aae6039b207ac890f41b3654.tar.gz
org.eclipse.emf.compare-183dba6384d9a445aae6039b207ac890f41b3654.tar.bz2
Bugfix: Hidden diff elements were transformed twice.
Bugfix: MPatch creation wizard did not open when .emfdiff file is selected. Change-Id: I6c6586bd2d358efcff8c9d15d4e5925fa03632a4
-rw-r--r--plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/impl/Emfdiff2Mpatch.java18
-rw-r--r--plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/wizards/EmfdiffExportWizard.java3
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 7c7aa89..975fca9 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<EObject> 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));
}
}
@@ -166,6 +166,22 @@ public class Emfdiff2Mpatch {
}
/**
+ * 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:
* <ul>
* <li>if the DiffElement is of a concrete sub type for which another mapping exists (e.g.
diff --git a/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/wizards/EmfdiffExportWizard.java b/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/wizards/EmfdiffExportWizard.java
index fd4bc24..96d3754 100644
--- a/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/wizards/EmfdiffExportWizard.java
+++ b/plugins/org.eclipse.emf.compare.mpatch.emfdiff2mpatch/src/org/eclipse/emf/compare/mpatch/emfdiff2mpatch/wizards/EmfdiffExportWizard.java
@@ -88,7 +88,8 @@ public class EmfdiffExportWizard extends AbstractEmfdiffExportWizard {
public void addPages() {
final String fileName = file == null ? "result." + MPatchConstants.FILE_EXTENSION_MPATCH : file.getName();
- page = new EmfdiffExportWizardPage(MPatchConstants.MPATCH_LONG_NAME + " export", new StructuredSelection(file));
+ page = new EmfdiffExportWizardPage(MPatchConstants.MPATCH_LONG_NAME + " export",
+ file == null ? StructuredSelection.EMPTY : new StructuredSelection(file));
page.setTitle(MPatchConstants.MPATCH_LONG_NAME);
page.setDescription("Transforms emfdiff into " + MPatchConstants.MPATCH_LONG_NAME + ".");
page.setFileName(fileName);