[fixes #1163] I messed up one line of code...
This commit is contained in:
parent
a6ddbcd1c5
commit
cd44d73b55
@ -170,7 +170,7 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
* create simulation for new configuration
|
* create simulation for new configuration
|
||||||
*/
|
*/
|
||||||
private void addOrCopyConfiguration(boolean copy) {
|
private void addOrCopyConfiguration(boolean copy) {
|
||||||
Map<FlightConfigurationId, FlightConfiguration> newConfigs = new LinkedHashMap<>();
|
final Map<FlightConfigurationId, FlightConfiguration> newConfigs = new LinkedHashMap<>();
|
||||||
|
|
||||||
// create or copy configuration
|
// create or copy configuration
|
||||||
if (copy) {
|
if (copy) {
|
||||||
@ -198,20 +198,22 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
newConfigs.put(newId, newConfig);
|
newConfigs.put(newId, newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FlightConfigurationId newId : newConfigs.keySet()) {
|
OpenRocketDocument doc = BasicFrame.findDocument(rocket);
|
||||||
|
if (doc == null) return;
|
||||||
|
|
||||||
|
for (Map.Entry<FlightConfigurationId, FlightConfiguration> config : newConfigs.entrySet()) {
|
||||||
// associate configuration with Id and select it
|
// associate configuration with Id and select it
|
||||||
rocket.setFlightConfiguration(newId, newConfigs.get(newId));
|
rocket.setFlightConfiguration(config.getKey(), config.getValue());
|
||||||
|
rocket.setSelectedConfiguration(config.getKey());
|
||||||
|
|
||||||
// create simulation for configuration
|
// create simulation for configuration
|
||||||
Simulation newSim = new Simulation(rocket);
|
Simulation newSim = new Simulation(rocket);
|
||||||
|
|
||||||
OpenRocketDocument doc = BasicFrame.findDocument(rocket);
|
newSim.setName(doc.getNextSimulationName());
|
||||||
if (doc != null) {
|
doc.addSimulation(newSim);
|
||||||
newSim.setName(doc.getNextSimulationName());
|
|
||||||
doc.addSimulation(newSim);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset to first selected flight config
|
||||||
rocket.setSelectedConfiguration((FlightConfigurationId) newConfigs.keySet().toArray()[0]);
|
rocket.setSelectedConfiguration((FlightConfigurationId) newConfigs.keySet().toArray()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user