Changes in the preference system
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / ColorHelper.java
index b44a975..0ec42f5 100644 (file)
@@ -4,7 +4,6 @@ import java.util.function.Consumer;
 import java.util.function.Supplier;
 
 import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Device;
 
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.mograsim.preferences.ColorDefinition;
@@ -14,24 +13,22 @@ public class ColorHelper
 {
        public static void executeWithDifferentForeground(GeneralGC gc, ColorDefinition col, Runnable exec)
        {
-               executeWithDifferentColor(gc.getDevice(), col, gc::getForeground, gc::setForeground, exec);
+               executeWithDifferentColor(col, gc::getForeground, gc::setForeground, exec);
        }
 
        public static void executeWithDifferentBackground(GeneralGC gc, ColorDefinition col, Runnable exec)
        {
-               executeWithDifferentColor(gc.getDevice(), col, gc::getBackground, gc::setBackground, exec);
+               executeWithDifferentColor(col, gc::getBackground, gc::setBackground, exec);
        }
 
-       private static void executeWithDifferentColor(Device device, ColorDefinition col, Supplier<Color> getColor, Consumer<Color> setColor,
-                       Runnable exec)
+       private static void executeWithDifferentColor(ColorDefinition col, Supplier<Color> getColor, Consumer<Color> setColor, Runnable exec)
        {
                ColorManager cm = ColorManager.current();
                Color oldColor = getColor.get();
-               Color newColor = cm.toColor(device, col);
+               Color newColor = cm.toColor(col);
                setColor.accept(newColor);
                exec.run();
                setColor.accept(oldColor);
-               cm.dispose(newColor);
        }
 
        private ColorHelper()