summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkonemann2011-06-06 04:45:22 (EDT)
committerpkonemann2011-06-06 04:45:22 (EDT)
commit67b216fde77c2362535c0c5f2046a8ebb64aa9ae (patch)
tree34f7402d785705de7c591214d974766b1a8dc318
parent115756ba201b5899b9c74da854bd14fb586518fa (diff)
downloadorg.eclipse.emf.compare-67b216fde77c2362535c0c5f2046a8ebb64aa9ae.zip
org.eclipse.emf.compare-67b216fde77c2362535c0c5f2046a8ebb64aa9ae.tar.gz
org.eclipse.emf.compare-67b216fde77c2362535c0c5f2046a8ebb64aa9ae.tar.bz2
Bugfix: Whenever a diff element hides another diff element, the mpatch
creation transforms both of them; fix: the hidden element will not be transformed. Bugfix: MPatch creation wizard did not open when an .emfdiff file was selected. Change-Id: Ib5b6cf2d0f48338ebf4061852e39844c15fad8a8
-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..7df6a9e 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);