diff options
author | Dani Megert | 2017-08-24 14:19:08 +0000 |
---|---|---|
committer | Dani Megert | 2017-08-24 14:19:08 +0000 |
commit | 153d18f2ec4f8ffa11eadcd344ab8e0135574abb (patch) | |
tree | 3fe69b1b33717602cbbb7f85a8dc9328a1ca92eb | |
parent | 285e1cd350eb852ea124518709054e0113ee08da (diff) | |
download | eclipse.platform.text-153d18f2ec4f8ffa11eadcd344ab8e0135574abb.tar.gz eclipse.platform.text-153d18f2ec4f8ffa11eadcd344ab8e0135574abb.tar.xz eclipse.platform.text-153d18f2ec4f8ffa11eadcd344ab8e0135574abb.zip |
Fixed bug 521373: MarginPainter no longer needs to be initialized after font changeI20170830-2000I20170830-0605I20170829-2345I20170829-2000I20170829-0940I20170829-0705I20170828-2000I20170828-1220I20170828-0730I20170827-2000I20170826-1500I20170825-2000I20170824-2000
3 files changed, 9 insertions, 36 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java index 2da2866ae22..a9da8dd5122 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/MarginPainter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -100,8 +100,8 @@ public class MarginPainter implements IPainter, PaintListener { } /** - * Initializes this painter, by flushing and recomputing all caches and causing - * the widget to be redrawn. Must be called explicitly when font of text widget changes. + * Initializes this painter, by flushing and recomputing all caches and causing the widget to be + * redrawn. */ public void initialize() { computeWidgetX(); diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java index ca16934efbb..84ee242fe95 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -434,7 +434,6 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR); support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN); - support.setSymbolicFontName(getFontPropertyPreferenceKey()); } /* diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java index aff66c1313b..b16c2464854 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,6 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; @@ -187,18 +186,6 @@ public class SourceViewerDecorationSupport { private static ITextStyleStrategy fgProblemUnderlineStrategy= new AnnotationPainter.UnderlineStrategy(SWT.UNDERLINE_ERROR); - /* - * @see IPropertyChangeListener - */ - private class FontPropertyChangeListener implements IPropertyChangeListener { - @Override - public void propertyChange(PropertyChangeEvent event) { - if (fMarginPainter != null && fSymbolicFontName != null && fSymbolicFontName.equals(event.getProperty())) - fMarginPainter.initialize(); - } - } - - /** The viewer */ private ISourceViewer fSourceViewer; /** The viewer's overview ruler */ @@ -243,10 +230,6 @@ public class SourceViewerDecorationSupport { private IPropertyChangeListener fPropertyChangeListener; /** The preference store */ private IPreferenceStore fPreferenceStore; - /** The symbolic font name */ - private String fSymbolicFontName; - /** The font change listener */ - private FontPropertyChangeListener fFontPropertyChangeListener; /** @@ -388,11 +371,6 @@ public class SourceViewerDecorationSupport { updateTextDecorations(); updateOverviewDecorations(); - if (fFontPropertyChangeListener != null) { - JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); - fFontPropertyChangeListener= null; - } - fOverviewRuler= null; // Painters got disposed in updateTextDecorations() or by the PaintManager @@ -497,10 +475,12 @@ public class SourceViewerDecorationSupport { /** * Sets the symbolic font name that is used for computing the margin width. * - * @param symbolicFontName the symbolic font name + * @param symbolicFontName + * the symbolic font name + * @deprecated As of 4.8, this is no longer used */ + @Deprecated public void setSymbolicFontName(String symbolicFontName) { - fSymbolicFontName= symbolicFontName; } /** @@ -801,9 +781,6 @@ public class SourceViewerDecorationSupport { fMarginPainter.setMarginRulerColumn(fPreferenceStore.getInt(fMarginPainterColumnKey)); ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer; extension.addPainter(fMarginPainter); - - fFontPropertyChangeListener= new FontPropertyChangeListener(); - JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); } } } @@ -814,9 +791,6 @@ public class SourceViewerDecorationSupport { private void hideMargin() { if (fMarginPainter != null) { if (fSourceViewer instanceof ITextViewerExtension2) { - JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); - fFontPropertyChangeListener= null; - ITextViewerExtension2 extension= (ITextViewerExtension2) fSourceViewer; extension.removePainter(fMarginPainter); fMarginPainter.deactivate(true); |