]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/preferences/SimulationPreferenceUtil.java
Added Set End Time command and handler as an alternate stepping mode
[simantics/platform.git] / bundles / org.simantics.simulation.ui / src / org / simantics / simulation / ui / preferences / SimulationPreferenceUtil.java
index 0c2cfc40dbd6019136adbf7ec4d45c6f89d9eb2a..5ca1591ca306ae67953e41706e07f9cd398b39a9 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.osgi.service.prefs.BackingStoreException;
 import org.osgi.service.prefs.Preferences;
 import org.simantics.simulation.ui.Activator;
+import org.simantics.simulation.ui.preferences.SimulationPreferences.StepMode;
 
 
 /**
@@ -42,8 +43,10 @@ public final class SimulationPreferenceUtil {
     public static SimulationPreferences getPrefs(IScopeContext context) {
         IEclipsePreferences node = context.getNode(Activator.PLUGIN_ID);
         double stepDuration = node.getDouble(SimulationPreferences.P_SIMULATION_STEP_DURATION, SimulationPreferences.DEFAULT_SIMULATION_STEP_DURATION);
+        double stepEndTime = node.getDouble(SimulationPreferences.P_SIMULATION_STEP_END_TIME, SimulationPreferences.DEFAULT_SIMULATION_STEP_END_TIME);
+        int stepMode = node.getInt(SimulationPreferences.P_SIMULATION_STEP_MODE, SimulationPreferences.DEFAULT_SIMULATION_STEP_MODE.ordinal());
 
-        return new SimulationPreferences(node, stepDuration);
+        return new SimulationPreferences(node, stepDuration, stepEndTime, StepMode.fromInt(stepMode));
     }
 
     /**
@@ -78,6 +81,8 @@ public final class SimulationPreferenceUtil {
     private static IEclipsePreferences _setPrefs(IScopeContext context, SimulationPreferences prefs) {
         IEclipsePreferences node = context.getNode(Activator.PLUGIN_ID);
         node.putDouble(SimulationPreferences.P_SIMULATION_STEP_DURATION, prefs.stepDuration);
+        node.putDouble(SimulationPreferences.P_SIMULATION_STEP_END_TIME, prefs.stepEndTime);
+        node.putInt(SimulationPreferences.P_SIMULATION_STEP_MODE, prefs.stepMode.ordinal());
         return node;
     }