From: mka Date: Mon, 8 Apr 2013 08:03:47 +0000 (+0000) Subject: Create new scenario from existing one is improved X-Git-Tag: Root_Delivery2_2013_04_22~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b6a6919ef30a5e2d99c3865a02bfb91d16ef4f7b;p=tools%2Fsiman.git Create new scenario from existing one is improved --- diff --git a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java index 9b22caf..0540432 100644 --- a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java @@ -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) {