X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.workbench%2Fsrc%2Forg%2Fsimantics%2Fworkbench%2Finternal%2Fpreferences%2FAutosavePreferencePage.java;fp=bundles%2Forg.simantics.workbench%2Fsrc%2Forg%2Fsimantics%2Fworkbench%2Finternal%2Fpreferences%2FAutosavePreferencePage.java;h=3e260a7e7ad3a003e8f3241529bd0eb78ade99ab;hp=b367bc23b301dd1f17eb36b5da377d6bd5fb2491;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/AutosavePreferencePage.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/AutosavePreferencePage.java index b367bc23b..3e260a7e7 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/AutosavePreferencePage.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/preferences/AutosavePreferencePage.java @@ -1,68 +1,68 @@ -/******************************************************************************* - * 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 - */ -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) { - } - -} +/******************************************************************************* + * 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 + */ +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) { + } + +}