for (int i = 0; i < statusBars.length; i++)
statusBars[i].nextStep();
}
// Simulations
SimulationsType iNetSimulations = iNetToolSpec.addNewSimulations();
SimulationType iSimulation;
TransitionsequenceType iTransitionsequence;
OccuredtransitionType iOccuredTransition;
for (Iterator<SimulationModel> iter = petrinetModel.getSimulations().iterator();iter.hasNext();)
{
SimulationModel currSimulation = iter.next();
// check if current fingerprint of the net equals the imported one
// if not ask the user if he want's to keep the simulation
//
// this check is performed as well on:
// - fileixport
// - loading a simulation
// when you change it here please do at those locations as well
int answer = 0;
Date simulationCreationDate = currSimulation.getSavedDate();
if(!petrinetModel.isLogicalFingerprintEqual(currSimulation.getFingerprint()))
{
Object[] options = {Messages.getString("Tokengame.ChangedNetDialog.ButtonKeep"),Messages.getString("Tokengame.ChangedNetDialog.ButtonDelete")};
// get the localized message text
String message = Messages.getString("Tokengame.ChangedNetDialog.Export.Message");
// fill the message text dynamically with the simulationname and simulationdate
message = message.replaceAll("##SIMULATIONNAME##", currSimulation.getName());
message = message.replaceAll("##SIMULATIONDATE##", DateFormat.getDateInstance().format(currSimulation.getSavedDate()));
answer = JOptionPane.showOptionDialog(null, message, Messages.getString("Tokengame.ChangedNetDialog.Title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
// if the user didn't choose one of the buttons but closed the OptionDialog don't drop the simulation
if(answer == -1)
{
answer = 0;
}
}
if(answer == 0)
{
iSimulation = iNetSimulations.addNewSimulation();
iSimulation.setId(currSimulation.getId());
iSimulation.setSimulationname(currSimulation.getName());
Calendar cal = Calendar.getInstance();
cal.setTime(simulationCreationDate);
iSimulation.setSimulationdate(cal);