Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2017-03-02 21:29:21 -0500
committerAndrey Loskutov2017-03-03 04:05:59 -0500
commite4281a76e6b2a994e22b3594dee7c59d845adfdc (patch)
tree5289965123b0eb5205a740ddef1a80f9a438d26c
parent4c395500d1ea10ec726ce49d3c66d0d43295aeb9 (diff)
downloadeclipse.platform.team-e4281a76e6b2a994e22b3594dee7c59d845adfdc.tar.gz
eclipse.platform.team-e4281a76e6b2a994e22b3594dee7c59d845adfdc.tar.xz
eclipse.platform.team-e4281a76e6b2a994e22b3594dee7c59d845adfdc.zip
Bug 512893 - Swap does not work on images
This change makes ContentMergeViewer self sufficient with respect to listening to changes of the "org.eclipse.compare.Swapped" preference. Change-Id: I4d3ccfaf24bbc9b444bea615a240d9f26ea2aa16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 4f04b3f77..a5e82b2d0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -315,6 +315,7 @@ public abstract class ContentMergeViewer extends ContentViewer
private ResourceBundle fBundle;
private final CompareConfiguration fCompareConfiguration;
private IPropertyChangeListener fPropertyChangeListener;
+ private IPropertyChangeListener fPreferenceChangeListener;
private ICompareInputChangeListener fCompareInputChangeListener;
private ListenerList<IPropertyChangeListener> fListenerList;
boolean fConfirmSave= true;
@@ -394,8 +395,16 @@ public abstract class ContentMergeViewer extends ContentViewer
// Make sure the compare configuration is not null
fCompareConfiguration = cc != null ? cc : new CompareConfiguration();
- fPropertyChangeListener = (event) -> handlePropertyChangeEvent(event);
+ fPropertyChangeListener = event -> handlePropertyChangeEvent(event);
fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener);
+ fPreferenceChangeListener = event -> {
+ if (event.getProperty().equals(ComparePreferencePage.SWAPPED)) {
+ getCompareConfiguration().setProperty(CompareConfiguration.MIRRORED, event.getNewValue());
+ updateContentProvider();
+ updateToolItems();
+ }
+ };
+ cc.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener);
fDefaultContentProvider = new MergeViewerContentProvider(fCompareConfiguration);
updateContentProvider();
@@ -594,13 +603,6 @@ public abstract class ContentMergeViewer extends ContentViewer
setAncestorVisibility(false, !Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false));
return;
}
-
- if (key.equals(ComparePreferencePage.SWAPPED)) {
- getCompareConfiguration().setProperty(CompareConfiguration.MIRRORED, event.getNewValue());
- updateContentProvider();
- updateToolItems();
- return;
- }
}
void updateCursor(Control c, int dir) {
@@ -1045,6 +1047,11 @@ public abstract class ContentMergeViewer extends ContentViewer
fPropertyChangeListener= null;
}
+ if (fPreferenceChangeListener != null) {
+ fCompareConfiguration.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
+ fPreferenceChangeListener= null;
+ }
+
fAncestorLabel= null;
fLeftLabel= null;
if (Policy.debugContentMergeViewer) {

Back to the top