From d1d6120b217c76c82ea678e460b07b50c37f5728 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 20 Mar 2023 15:52:06 +0100 Subject: [PATCH] [#2101] Copy config name when copy/load rocket --- .../openrocket/rocketcomponent/FlightConfiguration.java | 1 - core/src/net/sf/openrocket/rocketcomponent/Rocket.java | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 1b2ec0f0d..0cbf35e1a 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -33,7 +33,6 @@ import net.sf.openrocket.util.Transformation; */ public class FlightConfiguration implements FlightConfigurableParameter, Monitorable { private static final Logger log = LoggerFactory.getLogger(FlightConfiguration.class); - private static final Translator trans = Application.getTranslator(); private String configurationName; public static String DEFAULT_CONFIG_NAME = "[{motors}]"; diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index 0661e39ce..513f16391 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -382,7 +382,9 @@ public class Rocket extends ComponentAssembly { // the default value needs to be explicitly set, because it has different semantics copyRocket.configSet = new FlightConfigurableParameterSet<>(new FlightConfiguration(copyRocket)); for (FlightConfigurationId key : this.configSet.getIds()) { - copyRocket.configSet.set(key, new FlightConfiguration(copyRocket, key)); + FlightConfiguration newCfg = new FlightConfiguration(copyRocket, key); + newCfg.setName(this.configSet.get(key).getName()); // Copy config name + copyRocket.configSet.set(key, newCfg); } copyRocket.selectedConfiguration = copyRocket.configSet.get( this.getSelectedConfiguration().getId()); @@ -432,7 +434,9 @@ public class Rocket extends ComponentAssembly { this.configSet.reset(); this.configSet.setDefault(new FlightConfiguration(this)); for (FlightConfigurationId key : source.configSet.map.keySet()) { - this.configSet.set(key, new FlightConfiguration(this, key)); + FlightConfiguration newCfg = new FlightConfiguration(this, key); + newCfg.setName(source.configSet.get(key).getName()); // Copy config name + this.configSet.set(key, newCfg); } this.selectedConfiguration = this.configSet.get(source.getSelectedConfiguration().getId());