The final restructured version for automatic build using maven tycho
[Mograsim.git] / plugins / net.mograsim.preferences / src / net / mograsim / preferences / DefaultPreferences.java
diff --git a/plugins/net.mograsim.preferences/src/net/mograsim/preferences/DefaultPreferences.java b/plugins/net.mograsim.preferences/src/net/mograsim/preferences/DefaultPreferences.java
new file mode 100644 (file)
index 0000000..2f5c7c2
--- /dev/null
@@ -0,0 +1,70 @@
+package net.mograsim.preferences;
+
+import net.mograsim.preferences.ColorDefinition.BuiltInColor;
+
+public class DefaultPreferences extends Preferences
+{
+       @Override
+       public boolean getBoolean(String name)
+       {
+               switch (name)
+               {
+               case "net.mograsim.logic.model.improvetext":
+                       return true;
+               default:
+                       throw new IllegalArgumentException("Unknown boolean preference name: " + name);
+               }
+       }
+
+       @Override
+       public int getInt(String name)
+       {
+               switch (name)
+               {
+               default:
+                       throw new IllegalArgumentException("Unknown int preference name: " + name);
+               }
+       }
+
+       @Override
+       public double getDouble(String name)
+       {
+               switch (name)
+               {
+               case "net.mograsim.logic.model.linewidth.default":
+                       return 0.5;
+               case "net.mograsim.logic.model.linewidth.wire.singlebit":
+                       return 0.5;
+               case "net.mograsim.logic.model.linewidth.wire.multibit":
+                       return 0.85;
+               default:
+                       throw new IllegalArgumentException("Unknown double preference name: " + name);
+               }
+       }
+
+       @Override
+       public ColorDefinition getColorDefinition(String name)
+       {
+               switch (name)
+               {
+               case "net.mograsim.logic.model.color.bit.one":
+                       return new ColorDefinition(BuiltInColor.COLOR_GREEN);
+               case "net.mograsim.logic.model.color.bit.u":
+                       return new ColorDefinition(BuiltInColor.COLOR_CYAN);
+               case "net.mograsim.logic.model.color.bit.x":
+                       return new ColorDefinition(BuiltInColor.COLOR_RED);
+               case "net.mograsim.logic.model.color.bit.z":
+                       return new ColorDefinition(BuiltInColor.COLOR_YELLOW);
+               case "net.mograsim.logic.model.color.bit.zero":
+                       return new ColorDefinition(BuiltInColor.COLOR_GRAY);
+               case "net.mograsim.logic.model.color.background":
+                       return new ColorDefinition(BuiltInColor.COLOR_WHITE);
+               case "net.mograsim.logic.model.color.foreground":
+                       return new ColorDefinition(BuiltInColor.COLOR_BLACK);
+               case "net.mograsim.logic.model.color.text":
+                       return new ColorDefinition(BuiltInColor.COLOR_BLACK);
+               default:
+                       throw new IllegalArgumentException("Unknown color preference name: " + name);
+               }
+       }
+}
\ No newline at end of file