01: package com.quantum.flatfiles.preferences;
02:
03: import org.eclipse.jface.preference.BooleanFieldEditor;
04: import org.eclipse.jface.preference.FieldEditorPreferencePage;
05: import org.eclipse.jface.preference.IPreferenceStore;
06: import org.eclipse.jface.preference.StringFieldEditor;
07: import org.eclipse.ui.IWorkbench;
08: import org.eclipse.ui.IWorkbenchPreferencePage;
09:
10: import com.quantum.flatfiles.QuantumFlatFilesPlugin;
11:
12: public class CSVPreferences extends FieldEditorPreferencePage implements
13: IWorkbenchPreferencePage {
14:
15: public static final String WRITE_HEADERS = "com.quantum.flatfiles.CSV.writeHeaders";
16: public static final String COLUMN_SEPARATOR = "com.quantum.flatfiles.CSV.columnSeparator";
17: public static final String DEFAULT_PATH = "com.quantum.flatfiles.CSV.defaultPath";
18: public static final String DEFAULT_FILE_NAME = "com.quantum.flatfiles.CSV.defaultFileName";
19:
20: public CSVPreferences() {
21: super (FieldEditorPreferencePage.GRID);
22:
23: // Set the preference store for the preference page.
24: IPreferenceStore store = QuantumFlatFilesPlugin.getDefault()
25: .getPreferenceStore();
26: setPreferenceStore(store);
27: }
28:
29: public void init(IWorkbench workbench) {
30: this .workbench = workbench;
31: }
32:
33: IWorkbench workbench;
34:
35: protected void createFieldEditors() {
36: BooleanFieldEditor writeHeaders = new BooleanFieldEditor(
37: WRITE_HEADERS, "Write Column &Headers ?",
38: getFieldEditorParent());
39: addField(writeHeaders);
40:
41: StringFieldEditor columnSeparator = new StringFieldEditor(
42: COLUMN_SEPARATOR, "Default &Column Separator:",
43: getFieldEditorParent());
44:
45: addField(columnSeparator);
46:
47: StringFieldEditor defaultPath = new StringFieldEditor(
48: DEFAULT_PATH, "Default &Path:", getFieldEditorParent());
49:
50: addField(defaultPath);
51: StringFieldEditor defaultFileName = new StringFieldEditor(
52: DEFAULT_FILE_NAME, "Default &File Name:",
53: getFieldEditorParent());
54:
55: addField(defaultFileName);
56: }
57: }
|