Changes in the preference system
[Mograsim.git] / net.mograsim.preferences / src / net / mograsim / preferences / Preferences.java
1 package net.mograsim.preferences;
2
3 import org.eclipse.swt.graphics.Color;
4
5 public abstract class Preferences
6 {
7         private static Preferences currentPreferences;
8
9         public static void setPreferences(Preferences preferences)
10         {
11                 if (preferences == null)
12                         throw new NullPointerException();
13                 currentPreferences = preferences;
14         }
15
16         public static Preferences current()
17         {
18                 if (currentPreferences == null)
19                         currentPreferences = new DefaultPreferences();
20                 return currentPreferences;
21         }
22
23         public abstract ColorDefinition getColorDefinition(String name);
24
25         public Color getColor(String name)
26         {
27                 return ColorManager.current().toColor(getColorDefinition(name));
28         }
29 }