package com.quantum; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.RGB; /** * @author BC Holmes */ public class PluginPreferences { public static final String NUMERIC_COLOR = "quantum.numeric.color"; public static final String STRING_COLOR = "quantum.string.color"; public static final String COMMENT_COLOR = "quantum.comment.color"; public static final String KEYWORD_COLOR = "quantum.keyword.color"; public static final String TEXT_COLOR = "quantum.text.color"; public static final String BACKGROUND_COLOR = "quantum.background.color"; public static void initialize(IPreferenceStore store) { initializeColors(store); store.setDefault("quantum.text.bold", false); //$NON-NLS-1$ store.setDefault("quantum.keyword.bold", true); //$NON-NLS-1$ store.setDefault("quantum.string.bold", false); //$NON-NLS-1$ store.setDefault("quantum.comment.bold", false); //$NON-NLS-1$ store.setDefault("quantum.numeric.bold", false); //$NON-NLS-1$ PreferenceConverter.setDefault(store, "quantum.font", //$NON-NLS-1$ JFaceResources.getTextFont().getFontData()); store.setDefault("com.quantum.model.Bookmark.queryHistorySize", 20); //$NON-NLS-1$ } /** * @param store */ private static void initializeColors(IPreferenceStore store) { PreferenceConverter.setDefault(store, BACKGROUND_COLOR, new RGB(255, 255, 255)); PreferenceConverter.setDefault(store, TEXT_COLOR, new RGB(0, 0, 0)); PreferenceConverter.setDefault(store, KEYWORD_COLOR, new RGB(126, 0, 75)); PreferenceConverter.setDefault(store, COMMENT_COLOR, new RGB(88, 148, 64)); PreferenceConverter.setDefault(store, STRING_COLOR, new RGB(0, 0, 255)); PreferenceConverter.setDefault(store, NUMERIC_COLOR, new RGB(255, 0, 0)); } /** * */ public static FontData getDefaultFont() { FontData[] temp = JFaceResources.getTextFont().getFontData(); return temp == null || temp.length == 0 ? null : temp[0]; } }