From b6a6919ef30a5e2d99c3865a02bfb91d16ef4f7b Mon Sep 17 00:00:00 2001 From: mka Date: Mon, 8 Apr 2013 08:03:47 +0000 Subject: [PATCH] Create new scenario from existing one is improved --- .../src/org/splat/simer/NewScenarioAction.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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) { -- 2.39.2