Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-10-11 09:36:41 -0400
committerMikaël Barbero2013-10-18 13:47:51 -0400
commit6b470fbb97e266ef2aae8b0a91fc96d49db01671 (patch)
tree1bf2c8b90af51d923f34514d094040fd855fd9f1 /plugins/org.eclipse.emf.compare.ide.ui/src
parent897c84fee8722b11a2b7890c030be502a39c637c (diff)
downloadorg.eclipse.emf.compare-6b470fbb97e266ef2aae8b0a91fc96d49db01671.tar.gz
org.eclipse.emf.compare-6b470fbb97e266ef2aae8b0a91fc96d49db01671.tar.xz
org.eclipse.emf.compare-6b470fbb97e266ef2aae8b0a91fc96d49db01671.zip
Fix initialization order of group provider
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java2
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java20
2 files changed, 13 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
index 42a905895..57a350931 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
@@ -187,8 +187,8 @@ public class EMFCompareConfiguration extends ForwardingCompareConfiguration impl
setProperty(COMPARE_RESULT, newComparison);
setProperty(COMPARISON_SCOPE, newComparisonScope);
- initStructureMergeViewerFilter(newComparison, newComparisonScope);
initStructureMergeViewerGroupProvider(newComparison, newComparisonScope);
+ initStructureMergeViewerFilter(newComparison, newComparisonScope);
getEventBus().post(
new ComparisonAndScopeChange(oldComparison, newComparison, oldComparisonScope,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index e85da2a97..fd2f346a7 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -12,7 +12,6 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
import static com.google.common.collect.Iterables.getFirst;
-import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import java.lang.reflect.Field;
@@ -234,9 +233,6 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
fHandlerService = CompareHandlerService.createFor(getCompareConfiguration().getContainer(),
treeViewer.getControl().getShell());
- EventBus eventBus = new EventBus();
- eventBus.register(this);
-
StructureMergeViewerFilter structureMergeViewerFilter = getCompareConfiguration()
.getStructureMergeViewerFilter();
structureMergeViewerFilter.install(treeViewer);
@@ -294,7 +290,7 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
eAdapters.add(differenceGroupProvider);
treeRuler.computeConsequences();
- treeRuler.redraw();
+ SWTUtil.safeRedraw(treeRuler, true);
}
@Subscribe
@@ -466,14 +462,22 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
if (!getControl().isDisposed()) { // guard against disposal
final TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
treeNode.setData(comparison);
+ final Object input = fAdapterFactory.adapt(treeNode, ICompareInput.class);
+
+ // this will set to the EMPTY difference group provider, but necessary to avoid NPE while setting
+ // input.
+ treeNode.eAdapters().add(getSelectedDifferenceGroupProvider());
+
+ SWTUtil.safeSyncExec(new Runnable() {
+ public void run() {
+ getViewer().setInput(input);
+ }
+ });
getCompareConfiguration().setComparisonAndScope(comparison, scope);
- registerDifferenceGroupProvider(treeNode, getSelectedDifferenceGroupProvider());
SWTUtil.safeAsyncExec(new Runnable() {
public void run() {
- // Mandatory for the EMFCompareDiffTreeRuler, all TreeItems must have been created
- ((EMFCompareDiffTreeViewer)getViewer()).refreshAfterDiff(getViewer().getInput());
((EMFCompareDiffTreeViewer)getViewer()).createChildrenSilently(getViewer().getTree());
((EMFCompareDiffTreeViewer)getViewer()).initialSelection();
}

Back to the top