When deleting a flight configuration, first change the configuration to
a different one.
This commit is contained in:
parent
1e0ac22592
commit
6641f959c5
@ -545,7 +545,14 @@ public class Rocket extends RocketComponent {
|
|||||||
checkState();
|
checkState();
|
||||||
if (id == null)
|
if (id == null)
|
||||||
return;
|
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);
|
flightConfigurationIDs.remove(id);
|
||||||
|
// FIXME - remove corresponding simulations?
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MOTOR_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,6 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe
|
|||||||
if (currentId == null)
|
if (currentId == null)
|
||||||
return;
|
return;
|
||||||
rocket.removeFlightConfigurationID(currentId);
|
rocket.removeFlightConfigurationID(currentId);
|
||||||
rocket.getDefaultConfiguration().setFlightConfigurationID(null);
|
|
||||||
configurationChanged();
|
configurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user