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(col);
- setColor.accept(newColor);
- exec.run();
- setColor.accept(oldColor);
+ if (col == null)
+ exec.run();
+ else
+ {
+ ColorManager cm = ColorManager.current();
+ Color oldColor = getColor.get();
+ Color newColor = cm.toColor(col);
+ setColor.accept(newColor);
+ exec.run();
+ setColor.accept(oldColor);
+ }
}
private ColorHelper()
import net.mograsim.logic.ui.modeladapter.LogicModelParameters;
import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter;
import net.mograsim.preferences.ColorDefinition;
-import net.mograsim.preferences.ColorDefinition.BuiltInColor;
import net.mograsim.preferences.Preferences;
public class LogicUIPart extends ViewPart
if (rgb == null)
{
StatusManager.getManager().handle(new Status(IStatus.ERROR, "net.mograsim.plugin.core", "No color for name " + name));
- return new ColorDefinition(BuiltInColor.COLOR_BLACK);
+ return null;
}
return new ColorDefinition(rgb.red, rgb.green, rgb.blue);
}