]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/src/org/simantics/district/maps/server/prefs/MapsServerPreferences.java
Hide "enabled" column for non-component type tech type tables
[simantics/district.git] / org.simantics.maps.server / src / org / simantics / district / maps / server / prefs / MapsServerPreferences.java
1 package org.simantics.district.maps.server.prefs;
2
3 import java.io.IOException;
4 import java.net.URISyntaxException;
5
6 import org.eclipse.core.runtime.preferences.InstanceScope;
7 import org.osgi.service.prefs.Preferences;
8 import org.simantics.district.maps.server.Activator;
9
10 public class MapsServerPreferences {
11
12     public static final String P_NODE = Activator.PLUGIN_ID;
13     
14     public static final String P_START_AUTOMATICALLY = "org.simantics.maps.server.startAutomatically";
15
16     public static final String P_DEFAULT_PORT = "org.simantics.maps.server.defaultPort";
17     
18     public static final String P_CURRENT_MBTILES = "org.simantics.maps.server.currentMbTiles";
19     
20     public static final String P_CURRENT_TM2STYLE = "org.simantics.maps.server.currentTM2Style";
21
22     public static final String P_SERVER_FOLDER = "org.simantics.maps.server.serverFolder";
23
24     public static Preferences getPreferences() {
25         return InstanceScope.INSTANCE.getNode(MapsServerPreferences.P_NODE);
26     }
27     
28     public static boolean startAutomatically() {
29         return getPreferences().getBoolean(P_START_AUTOMATICALLY, true);
30     }
31
32     public static int defaultPort() {
33         return getPreferences().getInt(P_DEFAULT_PORT, 8585);
34     }
35     
36     public static String currentMBTiles() {
37         return getPreferences().get(P_CURRENT_MBTILES, "helsinki_finland.mbtiles");
38     }
39     
40     public static String currentTM2Style() {
41         return getPreferences().get(P_CURRENT_TM2STYLE, "mapbox-studio-osm-bright.tm2");
42     }
43
44     public static String serverFolder() throws IOException, URISyntaxException {
45         return getPreferences().get(P_SERVER_FOLDER, Activator.getTileserverMapnikRoot().toAbsolutePath().toString());
46     }
47 }