When deleting a flight configuration, first change the configuration to

a different one.
This commit is contained in:
kruland2607 2013-10-09 16:06:30 -05:00
parent 1e0ac22592
commit 6641f959c5
2 changed files with 7 additions and 1 deletions

View File

@ -545,7 +545,14 @@ public class Rocket extends RocketComponent {
checkState();
if (id == null)
return;
// Get current configuration:
String currentId = getDefaultConfiguration().getFlightConfigurationID();
// If we're removing the current configuration, we need to switch to a different one first.
if (currentId != null && currentId.equals(id)) {
getDefaultConfiguration().setFlightConfigurationID(null);
}
flightConfigurationIDs.remove(id);
// FIXME - remove corresponding simulations?
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
}

View File

@ -156,7 +156,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
if (currentId == null)
return;
rocket.removeFlightConfigurationID(currentId);
rocket.getDefaultConfiguration().setFlightConfigurationID(null);
configurationChanged();
}