Rework the CustomExpression evaluation to use SimulationListeners. Removed the OpenR...
[debian/openrocket] / core / src / net / sf / openrocket / gui / util / SwingPreferences.java
index 5633a57286a96147c4939b1f1da8154c285ef4fb..55aed61661ccdd53ffe12d9fe7c43f9b5f66ec33 100644 (file)
@@ -15,7 +15,6 @@ import java.util.prefs.BackingStoreException;
 import java.util.prefs.Preferences;
 
 import net.sf.openrocket.arch.SystemInfo;
-import net.sf.openrocket.document.OpenRocketDocument;
 import net.sf.openrocket.document.Simulation;
 import net.sf.openrocket.logging.LogHelper;
 import net.sf.openrocket.material.Material;
@@ -399,7 +398,7 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
        }
        
        public Simulation getBackgroundSimulation(Rocket rocket) {
-               Simulation s = new Simulation(new OpenRocketDocument(rocket), rocket);
+               Simulation s = new Simulation(rocket);
                SimulationOptions cond = s.getOptions();
                
                cond.setTimeStep(RK4SimulationStepper.RECOMMENDED_TIME_STEP * 2);
@@ -560,8 +559,8 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
        }
        
        @Override
-       public void setComponentFavorite( ComponentPreset preset, boolean favorite ) {
-               Preferences prefs = PREFNODE.node("favoritePresets");
+       public void setComponentFavorite( ComponentPreset preset, ComponentPreset.Type type, boolean favorite ) {
+               Preferences prefs = PREFNODE.node("favoritePresets").node(type.name());
                if ( favorite ) {
                        prefs.putBoolean(preset.preferenceKey(), true);
                } else {
@@ -570,8 +569,8 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
        }
        
        @Override
-       public Set<String> getComponentFavorites( ) {
-               Preferences prefs = PREFNODE.node("favoritePresets");
+       public Set<String> getComponentFavorites( ComponentPreset.Type type) {
+               Preferences prefs = PREFNODE.node("favoritePresets").node(type.name());
                Set<String> collection = new HashSet<String>();
                try {
                        collection.addAll( Arrays.asList(prefs.keys()));