01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.project.ui.preferences;
16:
17: import net.refractions.udig.project.internal.ProjectPlugin;
18: import net.refractions.udig.project.preferences.PreferenceConstants;
19: import net.refractions.udig.project.ui.internal.Messages;
20:
21: import org.eclipse.jface.preference.BooleanFieldEditor;
22: import org.eclipse.jface.preference.ColorFieldEditor;
23: import org.eclipse.jface.preference.FieldEditorPreferencePage;
24: import org.eclipse.jface.preference.IntegerFieldEditor;
25: import org.eclipse.ui.IWorkbench;
26: import org.eclipse.ui.IWorkbenchPreferencePage;
27:
28: /**
29: * Preference page for setting the preferences of maps.
30: * @author Jesse
31: * @since 1.1.0
32: */
33: public class MapPreferencePage extends FieldEditorPreferencePage
34: implements IWorkbenchPreferencePage {
35:
36: /**
37: * @param style
38: */
39: public MapPreferencePage() {
40: super (GRID);
41: setPreferenceStore(ProjectPlugin.getPlugin()
42: .getPreferenceStore());
43: setDescription(Messages.MapPreferencePage_map_preferences_description);
44: }
45:
46: @Override
47: protected void createFieldEditors() {
48: BooleanFieldEditor removeTempLayers = new BooleanFieldEditor(
49: PreferenceConstants.P_REMOVE_LAYERS,
50: Messages.MapPreferencePage_pref_remove_layer_label,
51: getFieldEditorParent());
52: addField(removeTempLayers);
53: addField(new BooleanFieldEditor(
54: PreferenceConstants.P_WARN_IRREVERSIBLE_COMMAND,
55: Messages.MapPreferencePage_warnIrreversible,
56: getFieldEditorParent()));
57:
58: IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(
59: PreferenceConstants.P_DEFAULT_CRS,
60: Messages.MapPreferences_defaultCRS,
61: getFieldEditorParent(), 7);
62: integerFieldEditor.setValidRange(-1, 9999999);
63: integerFieldEditor
64: .setErrorMessage(Messages.MapPreferences_errorMessage);
65: addField(integerFieldEditor);
66: addField(new ColorFieldEditor(PreferenceConstants.P_BACKGROUND,
67: Messages.MapPreferences_backgroundColor,
68: getFieldEditorParent()));
69: addField(new ColorFieldEditor(
70: PreferenceConstants.P_SELECTION_COLOR,
71: Messages.MapPreferences_selectionColor,
72: getFieldEditorParent()));
73: PaletteSelectionFieldEditor defaultPalette = new PaletteSelectionFieldEditor(
74: PreferenceConstants.P_DEFAULT_PALETTE,
75: Messages.MapPreferences_defaultPalette,
76: getFieldEditorParent());
77: addField(defaultPalette);
78: }
79:
80: public void init(IWorkbench workbench) {
81: }
82:
83: }
|