-/*******************************************************************************\r
- * Copyright (c) 2012 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
- * Semantum Oy - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.workbench.internal.preferences;\r
-\r
-import org.eclipse.core.runtime.preferences.InstanceScope;\r
-import org.eclipse.jface.preference.BooleanFieldEditor;\r
-import org.eclipse.jface.preference.FieldEditorPreferencePage;\r
-import org.eclipse.jface.preference.IPreferenceStore;\r
-import org.eclipse.jface.preference.IntegerFieldEditor;\r
-import org.eclipse.ui.IWorkbench;\r
-import org.eclipse.ui.IWorkbenchPreferencePage;\r
-import org.eclipse.ui.preferences.ScopedPreferenceStore;\r
-import org.simantics.AutosavePreferences;\r
-import org.simantics.AutosaveVirtualGraphs;\r
-\r
-/**\r
- * @author Tuukka Lehtonen <tuukka.lehtonen@semantum.fi>\r
- */\r
-public class AutosavePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {\r
-\r
- public AutosavePreferencePage() {\r
- super(GRID);\r
-\r
- IPreferenceStore pf = new ScopedPreferenceStore(InstanceScope.INSTANCE, AutosavePreferences.P_NODE);\r
- setPreferenceStore( pf );\r
- }\r
-\r
- @Override\r
- protected void createFieldEditors() {\r
- BooleanFieldEditor autosaveEnabled = new BooleanFieldEditor(\r
- AutosavePreferences.P_VG_AUTOSAVE_ENABLED,\r
- "Virtual Graph autosave enabled",\r
- getFieldEditorParent());\r
- addField(autosaveEnabled);\r
-\r
- IntegerFieldEditor autosaveInterval = new IntegerFieldEditor(\r
- AutosavePreferences.P_VG_AUTOSAVE_INTERVAL, \r
- "Virtual Graph autosave interval (seconds)", \r
- getFieldEditorParent());\r
- autosaveInterval.setValidRange(1, Integer.MAX_VALUE);\r
- autosaveInterval.setErrorMessage("Autosave interval must be positive");\r
- addField(autosaveInterval);\r
- }\r
-\r
- @Override\r
- public boolean performOk() {\r
- if(super.performOk()) {\r
- AutosaveVirtualGraphs.saveVirtualGraphsPeriodically();\r
- return true;\r
- }\r
- else\r
- return false;\r
- }\r
-\r
- @Override\r
- public void init(IWorkbench workbench) {\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.workbench.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.simantics.AutosavePreferences;
+import org.simantics.AutosaveVirtualGraphs;
+
+/**
+ * @author Tuukka Lehtonen <tuukka.lehtonen@semantum.fi>
+ */
+public class AutosavePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ public AutosavePreferencePage() {
+ super(GRID);
+
+ IPreferenceStore pf = new ScopedPreferenceStore(InstanceScope.INSTANCE, AutosavePreferences.P_NODE);
+ setPreferenceStore( pf );
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ BooleanFieldEditor autosaveEnabled = new BooleanFieldEditor(
+ AutosavePreferences.P_VG_AUTOSAVE_ENABLED,
+ "Virtual Graph autosave enabled",
+ getFieldEditorParent());
+ addField(autosaveEnabled);
+
+ IntegerFieldEditor autosaveInterval = new IntegerFieldEditor(
+ AutosavePreferences.P_VG_AUTOSAVE_INTERVAL,
+ "Virtual Graph autosave interval (seconds)",
+ getFieldEditorParent());
+ autosaveInterval.setValidRange(1, Integer.MAX_VALUE);
+ autosaveInterval.setErrorMessage("Autosave interval must be positive");
+ addField(autosaveInterval);
+ }
+
+ @Override
+ public boolean performOk() {
+ if(super.performOk()) {
+ AutosaveVirtualGraphs.saveVirtualGraphsPeriodically();
+ return true;
+ }
+ else
+ return false;
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+}