Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-07-23 13:00:11 -0400
committerPaul Pazderski2019-07-23 16:16:55 -0400
commit8885a4e2cfbd3c7ef4323a16b71ce043c29fb586 (patch)
tree8bb3ebd2854ad2aeef157655007fb597e8ff89d9
parentc9f6f539682c664d3584670c3450d7aee9ece04b (diff)
downloadeclipse.platform.text-8885a4e2cfbd3c7ef4323a16b71ce043c29fb586.tar.gz
eclipse.platform.text-8885a4e2cfbd3c7ef4323a16b71ce043c29fb586.tar.xz
eclipse.platform.text-8885a4e2cfbd3c7ef4323a16b71ce043c29fb586.zip
Bug 549496 - VisibleLinesTracker is activated twice inI20190723-1800
LineNumberRulerColumn Tracker is activated enabled twice but only deactivated once. At the same time the Tracker should use ListenerList for its listeners. Change-Id: I310dc8cfc5068e329d81e7bd668b9f0646d2873b Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java12
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisibleLinesTracker.java7
2 files changed, 6 insertions, 13 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
index 1e41584cc..0f98abf8b 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
@@ -644,15 +644,11 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
fCanvas.addMouseMoveListener(fMouseHandler);
fCanvas.addMouseWheelListener(fMouseHandler);
- if (fCachedTextViewer != null) {
- VisibleLinesTracker.track(fCachedTextViewer, lineHeightChangeHandler);
- fCachedTextViewer.addTextListener(fInternalListener);
-
+ fCachedTextViewer.addTextListener(fInternalListener);
- if (fFont == null) {
- if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed())
- fFont= fCachedTextWidget.getFont();
- }
+ if (fFont == null) {
+ if (!fCachedTextWidget.isDisposed())
+ fFont= fCachedTextWidget.getFont();
}
if (fFont != null)
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisibleLinesTracker.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisibleLinesTracker.java
index 3f6b38159..4f8c2dfd3 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisibleLinesTracker.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/VisibleLinesTracker.java
@@ -13,8 +13,7 @@
*/
package org.eclipse.jface.text.source;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.function.Consumer;
import org.eclipse.swt.custom.StyledText;
@@ -48,10 +47,9 @@ class VisibleLinesTracker implements PaintListener {
private int oldBottomPixel;
/**
- *
* List of handler to call when a visible line height change.
*/
- private final Collection<Consumer<StyledText>> handlers;
+ private final LinkedHashSet<Consumer<StyledText>> handlers= new LinkedHashSet<>();
/**
* Constructor to track line height change of visible lines of the {@link StyledText} of the
@@ -61,7 +59,6 @@ class VisibleLinesTracker implements PaintListener {
*/
private VisibleLinesTracker(ITextViewer viewer) {
this.viewer= viewer;
- this.handlers= new ArrayList<>();
}
@Override

Back to the top