public void RenameSimulation(Simulation simulation, string newName)
        {
            _buildingBlockTask.Load(simulation);

            //rename model, all object path and results
            //was the presenter open for the simulation? if yes
            var presenterWasOpen = _applicationController.HasPresenterOpenedFor(simulation);

            _applicationController.Close(simulation);

            //Model and root
            string oldName = simulation.Name;

            simulation.Name            = newName;
            simulation.Model.Name      = simulation.Name;
            simulation.Model.Root.Name = simulation.Name;

            _renameAbsolutePathVisitor.RenameAllAbsolutePathIn(simulation, oldName);

            _buildingBlockInSimulationManager.UpdateBuildingBlockNamesUsedIn(simulation);

            _simulationPathUpdater.UpdatePathsForRenamedSimulation(simulation, oldName, newName);

            //presenter was not open, nothing to do
            if (!presenterWasOpen)
            {
                return;
            }

            //edit the simulation back, since it was edited
            _buildingBlockTask.Edit(simulation);
        }
Beispiel #2
0
 private void finalizeSimulation(Simulation simulation)
 {
     if (simulation == null)
     {
         return;
     }
     _referencesResolver.ResolveReferencesIn(simulation.Model);
     _buildingBlockInSimulationManager.UpdateBuildingBlockNamesUsedIn(simulation);
     finalizeIndividual(simulation.Individual);
 }