X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2FColorHelper.java;h=0ec42f5737f3018b58d0977f312a102addf40dce;hb=9b0530074d07ba11b12c23df4370dd035da774b3;hp=b44a975ebee7815fe2f1ff288e21c1cbcd639334;hpb=dff3e01498ac766a7f1ec7b18ce2cc5acd257cb5;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/ColorHelper.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/ColorHelper.java index b44a975e..0ec42f57 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/ColorHelper.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/ColorHelper.java @@ -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 getColor, Consumer setColor, - Runnable exec) + private static void executeWithDifferentColor(ColorDefinition col, Supplier getColor, Consumer 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()