X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Ftypicals%2FToggleTypicalRealtimeSync.java;fp=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Ftypicals%2FToggleTypicalRealtimeSync.java;h=f48e644a906280300b4157c5e2e4dec878bbe96f;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=bb5063655785ac14d3f2b8dea4374c877b8204e1;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/typicals/ToggleTypicalRealtimeSync.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/typicals/ToggleTypicalRealtimeSync.java index bb5063655..f48e644a9 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/typicals/ToggleTypicalRealtimeSync.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/typicals/ToggleTypicalRealtimeSync.java @@ -1,45 +1,45 @@ -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 ); - } - -} +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 ); + } + +}