1 package org.simantics.maps.elevation.server.ui;
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;
19 public class MapsElevationServerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
21 private static final Logger LOGGER = LoggerFactory.getLogger(MapsElevationServerPreferencePage.class);
23 public MapsElevationServerPreferencePage() {
25 setDescription("Maps elevation server preferences");
29 protected IPreferenceStore doGetPreferenceStore() {
30 return new ScopedPreferenceStore(InstanceScope.INSTANCE, MapsElevationServerPreferences.P_NODE);
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);
38 BooleanFieldEditor automatically = new BooleanFieldEditor(MapsElevationServerPreferences.P_USE_ELEVATION_SERVER, "Use elevation server", serverGroup);
39 addField(automatically);
41 IntegerFieldEditor pipeDepth = new IntegerFieldEditor(MapsElevationServerPreferences.P_PIPE_DEPTH_UNDER_GROUND, "Pipe depth under ground", serverGroup);
44 GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(serverGroup);
48 protected void createFieldEditors() {
54 protected void performApply() {
59 public void init(IWorkbench workbench) {