mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
No need to dispose colors anymore.
Change-Id: I39e760a0dba9d220268ee738c8a085d14f0e188b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
e632011f2c
commit
3abe3d28e6
3 changed files with 7 additions and 26 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.make.ui; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.make.ui; singleton:=true
|
||||||
Bundle-Version: 8.0.0.qualifier
|
Bundle-Version: 8.0.100.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
|
Bundle-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2011 QNX Software Systems and others.
|
* Copyright (c) 2002, 2020 QNX Software Systems and others.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License 2.0
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
@ -16,8 +16,6 @@ package org.eclipse.cdt.make.internal.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
@ -68,18 +66,11 @@ public class ColorEditor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fButton.addDisposeListener(new DisposeListener() {
|
fButton.addDisposeListener(event -> {
|
||||||
@Override
|
|
||||||
public void widgetDisposed(DisposeEvent event) {
|
|
||||||
if (fImage != null) {
|
if (fImage != null) {
|
||||||
fImage.dispose();
|
fImage.dispose();
|
||||||
fImage = null;
|
fImage = null;
|
||||||
}
|
}
|
||||||
if (fColor != null) {
|
|
||||||
fColor.dispose();
|
|
||||||
fColor = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +95,6 @@ public class ColorEditor {
|
||||||
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
|
gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
|
||||||
|
|
||||||
if (fColor != null)
|
|
||||||
fColor.dispose();
|
|
||||||
|
|
||||||
fColor = new Color(display, fColorValue);
|
fColor = new Color(display, fColorValue);
|
||||||
gc.setBackground(fColor);
|
gc.setBackground(fColor);
|
||||||
gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
|
gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2013 QNX Software Systems and others.
|
* Copyright (c) 2000, 2020 QNX Software Systems and others.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials
|
* This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License 2.0
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
@ -53,13 +53,6 @@ public class ColorManager implements ISharedTextColors {
|
||||||
|
|
||||||
protected Map<RGB, Color> fColorTable = new HashMap<>(10);
|
protected Map<RGB, Color> fColorTable = new HashMap<>(10);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
for (Color color : fColorTable.values()) {
|
|
||||||
color.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(RGB rgb) {
|
public Color getColor(RGB rgb) {
|
||||||
Color color = fColorTable.get(rgb);
|
Color color = fColorTable.get(rgb);
|
||||||
|
|
Loading…
Add table
Reference in a new issue