]> gerrit.simantics Code Review - simantics/district.git/blob
a014c315aa02c094d4139f650233ea807d4fa443
[simantics/district.git] /
1 package org.simantics.maps.elevation.server.ui;
2
3 import org.eclipse.core.runtime.preferences.InstanceScope;
4 import org.eclipse.jface.layout.GridDataFactory;
5 import org.eclipse.jface.layout.GridLayoutFactory;
6 import org.eclipse.jface.preference.BooleanFieldEditor;
7 import org.eclipse.jface.preference.FieldEditorPreferencePage;
8 import org.eclipse.jface.preference.IPreferenceStore;
9 import org.eclipse.jface.preference.IntegerFieldEditor;
10 import org.eclipse.swt.SWT;
11 import org.eclipse.swt.widgets.Group;
12 import org.eclipse.ui.IWorkbench;
13 import org.eclipse.ui.IWorkbenchPreferencePage;
14 import org.eclipse.ui.preferences.ScopedPreferenceStore;
15 import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class MapsElevationServerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
20
21     private static final Logger LOGGER = LoggerFactory.getLogger(MapsElevationServerPreferencePage.class);
22     
23     public MapsElevationServerPreferencePage() {
24         super(GRID);
25         setDescription("Maps elevation server preferences");
26     }
27
28     @Override
29     protected IPreferenceStore doGetPreferenceStore() {
30         return new ScopedPreferenceStore(InstanceScope.INSTANCE, MapsElevationServerPreferences.P_NODE);
31     }
32
33     private void createGeneralGroup() {
34         Group serverGroup = new Group(getFieldEditorParent(), SWT.NONE);
35         serverGroup.setText("General");
36         GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(serverGroup);
37
38         BooleanFieldEditor automatically = new BooleanFieldEditor(MapsElevationServerPreferences.P_USE_ELEVATION_SERVER, "Use elevation server", serverGroup);
39         addField(automatically);
40
41         IntegerFieldEditor pipeDepth = new IntegerFieldEditor(MapsElevationServerPreferences.P_PIPE_DEPTH_UNDER_GROUND, "Pipe depth under ground", serverGroup);
42         pipeDepth.setValidRange(Integer.MIN_VALUE, Integer.MAX_VALUE);
43         addField(pipeDepth);
44         
45         GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(serverGroup);
46     }
47     
48     @Override
49     protected void createFieldEditors() {
50         createGeneralGroup();
51
52     }
53
54     @Override
55     protected void performApply() {
56         super.performApply();
57     }
58
59     @Override
60     public void init(IWorkbench workbench) {
61         
62     }
63
64
65 }