]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/PreferenceInitializer.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / preferences / PreferenceInitializer.java
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/PreferenceInitializer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/preferences/PreferenceInitializer.java
new file mode 100644 (file)
index 0000000..28a845b
--- /dev/null
@@ -0,0 +1,43 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.modeling.ui.preferences;\r
+\r
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;\r
+import org.eclipse.core.runtime.preferences.DefaultScope;\r
+import org.eclipse.core.runtime.preferences.IScopeContext;\r
+import org.osgi.service.prefs.Preferences;\r
+import org.simantics.modeling.ui.Activator;\r
+import org.simantics.utils.page.PageDesc;\r
+\r
+public class PreferenceInitializer extends AbstractPreferenceInitializer {\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()\r
+     */\r
+    @Override\r
+    public void initializeDefaultPreferences() {\r
+        IScopeContext context = DefaultScope.INSTANCE;\r
+        Preferences node = context.getNode(Activator.PLUGIN_ID);\r
+\r
+        node.putDouble(DiagramPreferences.P_SNAP_GRID_SIZE, DiagramPreferences.DEFAULT_SNAP_GRID_SIZE);\r
+        node.put(DiagramPreferences.P_DEFAULT_PAGE_SIZE, PageDesc.serialize(DiagramPreferences.DEFAULT_PAGE_SIZE));\r
+//        node.put(DiagramPreferences.P_DEFAULT_PAGE_ORIENTATION, DiagramPreferences.DEFAULT_PAGE_ORIENTATION.toString());\r
+//        node.put(DiagramPreferences.P_DEFAULT_PAGE_MARGINS, PageDesc.serialize(DiagramPreferences.DEFAULT_PAGE_MARGINS));\r
+        node.putBoolean(DiagramPreferences.P_DISPLAY_PAGE_SIZE, DiagramPreferences.DEFAULT_DISPLAY_PAGE_SIZE);\r
+        node.putBoolean(DiagramPreferences.P_DISPLAY_MARGINS, DiagramPreferences.DEFAULT_DISPLAY_MARGINS);\r
+        node.putBoolean(DiagramPreferences.P_DISPLAY_GRID, DiagramPreferences.DEFAULT_DISPLAY_GRID);\r
+        node.putBoolean(DiagramPreferences.P_DISPLAY_RULER, DiagramPreferences.DEFAULT_DISPLAY_RULER);\r
+\r
+        node.put(ModelingPreferences.P_PROPERTY_PIN_MODE, ModelingPreferences.DEFAULT_PIN_MODE.name());\r
+    }\r
+\r
+}\r