intial source from ttp://www.sf.net/projects/wdte
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / PluginPreferences.java
1 package com.quantum;
2
3 import org.eclipse.jface.preference.IPreferenceStore;
4 import org.eclipse.jface.preference.PreferenceConverter;
5 import org.eclipse.jface.resource.JFaceResources;
6 import org.eclipse.swt.graphics.FontData;
7 import org.eclipse.swt.graphics.RGB;
8
9
10 /**
11  * @author BC Holmes
12  */
13 public class PluginPreferences {
14         
15         public static final String NUMERIC_COLOR = "quantum.numeric.color";
16         public static final String STRING_COLOR = "quantum.string.color";
17         public static final String COMMENT_COLOR = "quantum.comment.color";
18         public static final String KEYWORD_COLOR = "quantum.keyword.color";
19         public static final String TEXT_COLOR = "quantum.text.color";
20         public static final String BACKGROUND_COLOR = "quantum.background.color";
21         
22         public static void initialize(IPreferenceStore store) {
23                 initializeColors(store);
24                 
25                 store.setDefault("quantum.text.bold", false); //$NON-NLS-1$
26                 store.setDefault("quantum.keyword.bold", true); //$NON-NLS-1$
27                 store.setDefault("quantum.string.bold", false); //$NON-NLS-1$
28                 store.setDefault("quantum.comment.bold", false); //$NON-NLS-1$
29                 store.setDefault("quantum.numeric.bold", false); //$NON-NLS-1$
30                 PreferenceConverter.setDefault(store, "quantum.font", //$NON-NLS-1$
31                                 JFaceResources.getTextFont().getFontData()); 
32                 store.setDefault("com.quantum.model.Bookmark.queryHistorySize", 20); //$NON-NLS-1$
33         }
34
35         /**
36          * @param store
37          */
38         private static void initializeColors(IPreferenceStore store) {
39                 PreferenceConverter.setDefault(store, BACKGROUND_COLOR, new RGB(255, 255, 255));
40                 PreferenceConverter.setDefault(store, TEXT_COLOR, new RGB(0, 0, 0));
41                 PreferenceConverter.setDefault(store, KEYWORD_COLOR, new RGB(126, 0, 75));
42                 PreferenceConverter.setDefault(store, COMMENT_COLOR, new RGB(88, 148, 64));
43                 PreferenceConverter.setDefault(store, STRING_COLOR, new RGB(0, 0, 255));
44                 PreferenceConverter.setDefault(store, NUMERIC_COLOR, new RGB(255, 0, 0));
45         }
46
47         /**
48          * 
49          */
50         public static FontData getDefaultFont() {
51             FontData[] temp =  JFaceResources.getTextFont().getFontData();
52             return temp == null || temp.length == 0 ? null : temp[0];
53         }
54
55 }