Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-09-30 18:05:47 +0000
committerMikaël Barbero2013-10-01 08:22:33 +0000
commit9102773f7784aa9e075048d4a461373bc00fee2b (patch)
tree0163c2efa2fe8b92a46264688a922e10df2917bb
parent90abb11fce4f4ab47b692c66b689ae764db364a1 (diff)
downloadorg.eclipse.emf.compare-9102773f7784aa9e075048d4a461373bc00fee2b.tar.gz
org.eclipse.emf.compare-9102773f7784aa9e075048d4a461373bc00fee2b.tar.xz
org.eclipse.emf.compare-9102773f7784aa9e075048d4a461373bc00fee2b.zip
Extract isThreeWay method
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareInputAdapter.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareInputAdapter.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareInputAdapter.java
index 94337b02c..78a19aef8 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareInputAdapter.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareInputAdapter.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.Match;
@@ -208,16 +209,7 @@ public abstract class CompareInputAdapter extends AdapterImpl implements ICompar
public ITypedElement getAncestor() {
final ITypedElement ret;
Notifier notifier = getComparisonObject();
- boolean isThreeWay = false;
- if (notifier instanceof Diff) {
- isThreeWay = ((Diff)notifier).getMatch().getComparison().isThreeWay();
- } else if (notifier instanceof Match) {
- isThreeWay = ((Match)notifier).getComparison().isThreeWay();
- } else if (notifier instanceof Conflict) {
- isThreeWay = true;
- } else if (notifier instanceof MatchResource) {
- isThreeWay = ((MatchResource)notifier).getComparison().isThreeWay();
- }
+ boolean isThreeWay = isThreeWay(notifier);
if (isThreeWay) {
IAccessorFactory accessorFactory = getAccessorFactoryForTarget();
if (accessorFactory != null) {
@@ -237,6 +229,24 @@ public abstract class CompareInputAdapter extends AdapterImpl implements ICompar
return ret;
}
+ protected boolean isThreeWay(Notifier notifier) {
+ final boolean isThreeWay;
+ if (notifier instanceof Diff) {
+ isThreeWay = ((Diff)notifier).getMatch().getComparison().isThreeWay();
+ } else if (notifier instanceof Match) {
+ isThreeWay = ((Match)notifier).getComparison().isThreeWay();
+ } else if (notifier instanceof Conflict) {
+ isThreeWay = true;
+ } else if (notifier instanceof MatchResource) {
+ isThreeWay = ((MatchResource)notifier).getComparison().isThreeWay();
+ } else if (notifier instanceof Comparison) {
+ isThreeWay = ((Comparison)notifier).isThreeWay();
+ } else {
+ isThreeWay = false;
+ }
+ return isThreeWay;
+ }
+
/**
* {@inheritDoc}
*

Back to the top