Salome HOME
Remove the scenario functionality is implemented
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / OpenStudy.java
index cad212ae8a2be79810024c0f06957ca00138ae8c..946317d5fef27f2a263036c490b328ca416382c3 100644 (file)
@@ -124,8 +124,10 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                                .getRevisionPattern());
 
                _cuser = user; // May be null if nobody connected
+               if(!study.equals(_mystudy)) {
+                       _selection = "0.1"; // Default selection
+               }
                _mystudy = study;
-               _selection = "0.1"; // Default selection
                _selecdoc = null;
 
                // Preparation of the display
@@ -135,7 +137,9 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                _description = _mystudy.getDescription();
                _involving = new ArrayList<Step>(1);
                _context = new ArrayList<SimulationContextFacade>();
-               _ustep = getProjectElementService().getFirstStep(_mystudy);
+               if (_selection.equals("0.1")) {
+                       _ustep = getProjectElementService().getFirstStep(_mystudy);
+               }
                _ustep.setActor(_cuser);
                _involving.add(_ustep);
                for (Iterator<SimulationContext> i = _ustep.getAllSimulationContexts()
@@ -165,19 +169,25 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices {
                                        _popup = getApplicationSettings().getPopupMenu(
                                                        "steditablemarkprivate");
                                } else {
-                                       if (_mystudy.getProgressState() == ProgressState.inWORK) {
-                                               _popup = getApplicationSettings().getPopupMenu(
-                                                               "steditable");
-                                       } else if (_mystudy.getProgressState() == ProgressState.inDRAFT) {
-                                               _popup = getApplicationSettings().getPopupMenu(
-                                                               "streviewable");
-                                       } else if (_mystudy.getProgressState() == ProgressState.inCHECK) {
-                                               _popup = getApplicationSettings().getPopupMenu(
-                                                               "stapprovable");
-                                       } else { // APPROVED
-                                               _popup = getApplicationSettings().getPopupMenu(
-                                                               "steditablemarkpublic");
+                                       String key = null;
+                                       switch(_mystudy.getProgressState()) {
+                                               case inWORK:
+                                                       key = "steditable";
+                                                       break;
+                                               case inDRAFT:
+                                                       key = "streviewable";
+                                                       break;
+                                               case inCHECK:
+                                                       key = "stapprovable";
+                                                       break;
+                                               default: // APPROVED
+                                                       key = "steditablemarkpublic";
+                                                       break;
+                                       }
+                                       if(Long.valueOf(getSelectedScenarioId()) != 0) {
+                                               key += "ScenarioSelected";
                                        }
+                                       _popup = getApplicationSettings().getPopupMenu(key);
                                }
 
                        }