diff options
author | Lars Vogel | 2020-07-14 13:30:20 +0000 |
---|---|---|
committer | Lars Vogel | 2020-07-31 09:52:08 +0000 |
commit | 961c1d1d50f0bd73b5dc3f2e5b37042c63b2ce32 (patch) | |
tree | b37e568b72b1d8ad5ffa4ba0bb10125f53c40258 | |
parent | 2098f96974e025c74abc2fd6214ef5e9e0912aee (diff) | |
download | eclipse.platform.text-961c1d1d50f0bd73b5dc3f2e5b37042c63b2ce32.tar.gz eclipse.platform.text-961c1d1d50f0bd73b5dc3f2e5b37042c63b2ce32.tar.xz eclipse.platform.text-961c1d1d50f0bd73b5dc3f2e5b37042c63b2ce32.zip |
Bug 565208: Remove calls to Color.disposeY20200801-1200I20200803-0210I20200801-1800I20200801-0010I20200731-2040I20200731-1800
As these calls are no longer needed, remove the calls
and related code around such dispose that is also
now redundant.
Change-Id: Ifd82694346e546185768256eba526027f5bd9f4f
4 files changed, 7 insertions, 90 deletions
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java index 17696de2b01..414163c4c52 100644 --- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java +++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java @@ -73,12 +73,6 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio private Label fSeparator; /** The font of the optional status text label.*/ private Font fStatusTextFont; - /** - * The color of the optional status text label or <code>null</code> if none. - * - * @since 3.6 - */ - private Color fStatusTextForegroundColor; /** The maximal widget width. */ private int fMaxWidth; /** The maximal widget height. */ @@ -173,8 +167,9 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fStatusField.setLayoutData(gd2); - fStatusTextForegroundColor= new Color(fStatusField.getDisplay(), blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f)); - fStatusField.setForeground(fStatusTextForegroundColor); + Color statusTextForegroundColor= new Color(fStatusField.getDisplay(), + blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f)); + fStatusField.setForeground(statusTextForegroundColor); fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); } @@ -240,9 +235,6 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio if (fStatusTextFont != null && !fStatusTextFont.isDisposed()) fStatusTextFont.dispose(); fStatusTextFont= null; - if (fStatusTextForegroundColor != null && !fStatusTextForegroundColor.isDisposed()) - fStatusTextForegroundColor.dispose(); - fStatusTextForegroundColor= null; fTextFont= null; fShell= null; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java index 521ba4e01dc..7ab858a9770 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java @@ -79,12 +79,6 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio private Label fSeparator; /** The font of the optional status text label.*/ private Font fStatusTextFont; - /** - * The color of the optional status text label or <code>null</code> if none. - * - * @since 3.6 - */ - private Color fStatusTextForegroundColor; /** The maximal widget width. */ private int fMaxWidth; /** The maximal widget height. */ @@ -182,8 +176,9 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fStatusField.setLayoutData(gd2); - fStatusTextForegroundColor= new Color(fStatusField.getDisplay(), blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f)); - fStatusField.setForeground(fStatusTextForegroundColor); + Color statusTextForegroundColor= new Color(fStatusField.getDisplay(), + blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f)); + fStatusField.setForeground(statusTextForegroundColor); fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); } @@ -253,9 +248,6 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio if (fStatusTextFont != null && !fStatusTextFont.isDisposed()) fStatusTextFont.dispose(); fStatusTextFont= null; - if (fStatusTextForegroundColor != null && !fStatusTextForegroundColor.isDisposed()) - fStatusTextForegroundColor.dispose(); - fStatusTextForegroundColor= null; fTextFont= null; fShell= null; diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java index 22b270c3f7c..3456447c3f3 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java @@ -2378,26 +2378,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit */ private SelectionListener fSelectionListener; /** The editor's font. */ - private Font fFont; /** - * The editor's foreground color. - * @since 2.0 - */ - private Color fForegroundColor; - /** - * The editor's background color. - * @since 2.0 - */ - private Color fBackgroundColor; - /** - * The editor's selection foreground color. - * @since 3.0 - */ - private Color fSelectionForegroundColor; - /** - * The editor's selection background color. - * @since 3.0 - */ - private Color fSelectionBackgroundColor; + private Font fFont; /** * The find scope's highlight color. * @since 2.0 @@ -3932,32 +3913,18 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit : createColor(store, PREFERENCE_COLOR_FOREGROUND, styledText.getDisplay()); styledText.setForeground(color); - if (fForegroundColor != null) - fForegroundColor.dispose(); - - fForegroundColor= color; - // ---------- background color ---------------------- color= store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null : createColor(store, PREFERENCE_COLOR_BACKGROUND, styledText.getDisplay()); styledText.setBackground(color); - if (fBackgroundColor != null) - fBackgroundColor.dispose(); - - fBackgroundColor= color; - // ----------- selection foreground color -------------------- color= store.getBoolean(PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT) ? null : createColor(store, PREFERENCE_COLOR_SELECTION_FOREGROUND, styledText.getDisplay()); styledText.setSelectionForeground(color); - if (fSelectionForegroundColor != null) - fSelectionForegroundColor.dispose(); - - fSelectionForegroundColor= color; // ---------- selection background color ---------------------- color= store.getBoolean(PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT) @@ -3965,10 +3932,6 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit : createColor(store, PREFERENCE_COLOR_SELECTION_BACKGROUND, styledText.getDisplay()); styledText.setSelectionBackground(color); - if (fSelectionBackgroundColor != null) - fSelectionBackgroundColor.dispose(); - - fSelectionBackgroundColor= color; } } @@ -3992,10 +3955,6 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit if (target != null && target instanceof IFindReplaceTargetExtension) ((IFindReplaceTargetExtension) target).setScopeHighlightColor(color); - if (fFindScopeHighlightColor != null) - fFindScopeHighlightColor.dispose(); - - fFindScopeHighlightColor= color; } } @@ -4335,31 +4294,6 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit disposeNonDefaultCaret(); fInitialCaret= null; - if (fForegroundColor != null) { - fForegroundColor.dispose(); - fForegroundColor= null; - } - - if (fBackgroundColor != null) { - fBackgroundColor.dispose(); - fBackgroundColor= null; - } - - if (fSelectionForegroundColor != null) { - fSelectionForegroundColor.dispose(); - fSelectionForegroundColor= null; - } - - if (fSelectionBackgroundColor != null) { - fSelectionBackgroundColor.dispose(); - fSelectionBackgroundColor= null; - } - - if (fFindScopeHighlightColor != null) { - fFindScopeHighlightColor.dispose(); - fFindScopeHighlightColor= null; - } - if (fFontPropertyChangeListener != null) { JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); if (fPreferenceStore != null) diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java index 6d4a5322c04..99da27488e9 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/InfoForm.java @@ -80,7 +80,6 @@ public class InfoForm { fScrolledComposite.addDisposeListener(e -> { JFaceResources.getFontRegistry().removeListener(fPropertyChangeListener); fScrolledComposite = null; - fSeparatorColor.dispose(); fSeparatorColor = null; fHeader = null; fBanner = null; |