-package org.simantics.modeling.ui.typicals;\r
-\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.runtime.preferences.InstanceScope;\r
-import org.eclipse.ui.commands.IElementUpdater;\r
-import org.eclipse.ui.menus.UIElement;\r
-import org.osgi.service.prefs.BackingStoreException;\r
-import org.osgi.service.prefs.Preferences;\r
-import org.simantics.modeling.typicals.TypicalPreferences;\r
-import org.simantics.utils.ui.ErrorLogger;\r
-\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- *\r
- */\r
-public class ToggleTypicalRealtimeSync extends AbstractHandler implements IElementUpdater {\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- Preferences prefs = InstanceScope.INSTANCE.getNode(TypicalPreferences.P_NODE);\r
- boolean value = prefs.getBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, TypicalPreferences.DEFAULT_REALTIME_TYPICAL_SYNC_ENABLED);\r
- value = !value;\r
- prefs.putBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, value);\r
- try {\r
- prefs.flush();\r
- } catch (BackingStoreException e) {\r
- ErrorLogger.defaultLogError(e);\r
- }\r
-\r
- return null;\r
- }\r
-\r
- @Override\r
- public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {\r
- Preferences prefs = InstanceScope.INSTANCE.getNode(TypicalPreferences.P_NODE);\r
- boolean value = prefs.getBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, TypicalPreferences.DEFAULT_REALTIME_TYPICAL_SYNC_ENABLED);\r
- element.setChecked( value );\r
- }\r
-\r
-}\r
+package org.simantics.modeling.ui.typicals;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+import org.simantics.modeling.typicals.TypicalPreferences;
+import org.simantics.utils.ui.ErrorLogger;
+
+
+/**
+ * @author Tuukka Lehtonen
+ *
+ */
+public class ToggleTypicalRealtimeSync extends AbstractHandler implements IElementUpdater {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Preferences prefs = InstanceScope.INSTANCE.getNode(TypicalPreferences.P_NODE);
+ boolean value = prefs.getBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, TypicalPreferences.DEFAULT_REALTIME_TYPICAL_SYNC_ENABLED);
+ value = !value;
+ prefs.putBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, value);
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ ErrorLogger.defaultLogError(e);
+ }
+
+ return null;
+ }
+
+ @Override
+ public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+ Preferences prefs = InstanceScope.INSTANCE.getNode(TypicalPreferences.P_NODE);
+ boolean value = prefs.getBoolean(TypicalPreferences.P_REALTIME_TYPICAL_SYNC_ENABLED, TypicalPreferences.DEFAULT_REALTIME_TYPICAL_SYNC_ENABLED);
+ element.setChecked( value );
+ }
+
+}