]> gerrit.simantics Code Review - simantics/district.git/blob
43200ce98a74cd07a26c87ed1625e2ce7d8eba67
[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         addField(pipeDepth);
43         
44         GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(serverGroup);
45     }
46     
47     @Override
48     protected void createFieldEditors() {
49         createGeneralGroup();
50
51     }
52
53     @Override
54     protected void performApply() {
55         super.performApply();
56     }
57
58     @Override
59     public void init(IWorkbench workbench) {
60         
61     }
62
63
64 }