]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Create new scenario from existing one is improved
authormka <mka@opencascade.com>
Mon, 8 Apr 2013 08:03:47 +0000 (08:03 +0000)
committermka <mka@opencascade.com>
Mon, 8 Apr 2013 08:03:47 +0000 (08:03 +0000)
Workspace/Siman/src/org/splat/simer/NewScenarioAction.java

index 9b22caffc7ea7481771b5a876dfb0a9d5acff98d..05404329ed8d2c0d2837af3df89f786e1eb70e41 100644 (file)
@@ -124,13 +124,21 @@ public class NewScenarioAction extends Action {
                                        getConnectedUser()).setTitle(_title)
                                        .setInsertAfter(bascene);
 
-                       _bastep = getProjectElementService().getFirstStep(bascene)
+                       
+                       long selectedScenarioId = Long.valueOf(parse[0]);
+                       Scenario selectedScenario = scene[0];
+                       for(Scenario scenario : scene) {
+                               if(scenario.getIndex() == selectedScenarioId) {
+                                       selectedScenario = scenario;
+                               }
+                       }
+                       _bastep = getProjectElementService().getFirstStep(selectedScenario)
                                        .getNumber();
                        if (this.sharesStep()) {
-                               step = getProjectElementService().getSteps(bascene);
+                               step = getProjectElementService().getSteps(selectedScenario);
                                sprop.setBaseStep(step[number - _bastep]);
                        }
-                       bascene = getScenarioService().addScenario(study, sprop);
+                       Scenario createdScenario = getScenarioService().addScenario(study, sprop);
                        // transax.commit();
 
                        // Update of the display
@@ -143,7 +151,7 @@ public class NewScenarioAction extends Action {
                                        }
                                }
                        }
-                       _mystudy.setSelection(bascene.getIndex() + "." + number);
+                       _mystudy.setSelection(createdScenario.getIndex() + "." + number);
                        getSession().remove("menu.scenario");
                        return SUCCESS;
                } catch (RuntimeException saverror) {