Salome HOME
Correct redirect end of session during check-out operation
authormka <mka@opencascade.com>
Fri, 24 May 2013 16:40:37 +0000 (16:40 +0000)
committermka <mka@opencascade.com>
Fri, 24 May 2013 16:40:37 +0000 (16:40 +0000)
Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java
Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java
Workspace/Siman/src/org/splat/simer/SimanRedirectOnEndOfSessionInterceptor.java

index f89f8200fb7b434bd3dce8e1e56debe4bae9c659..bc3c1a1f11525aba53171bff579319ae2cbd578c 100644 (file)
@@ -252,10 +252,6 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                                                cmd.toArray(new String[] {}), null,
                                                new File(SALOME_HOME));
                                
-                               // Refresh the current scenario view
-                               getAppletContext().showDocument(
-                                               new URL(this.getParameter("refresh")));
-                               
                                BufferedReader bri = new BufferedReader(new InputStreamReader(
                                                proc.getInputStream()));
                                BufferedReader bre = new BufferedReader(new InputStreamReader(
@@ -282,6 +278,10 @@ public class ToolbarApplet extends java.applet.Applet implements ActionListener
                                }
                                showError(response);
                        }
+                       
+                       // Refresh the current scenario view
+                       getAppletContext().showDocument(
+                                       new URL(this.getParameter("refresh")));
                } else {
                        extensions = "[" + extensions.replaceAll("\\|\\|", "") + "]";
                        showError("SALOME module is not found: " + pathToScript
index 96781cf09585acf7b76c7ba128a9aa963d649f10..8aa9106f3c7a6861e9e1f98625394cf0e9b691cf 100644 (file)
@@ -49,11 +49,16 @@ public class DisplayStudyStepAction extends AbstractDisplayAction {
                if (_myindex == null) {
                        if (_selection == null) { // Opening a study just newed
                                _selection = _openStudy.getSelection(); // Default selection
-                       } 
-                       // Re-opening (refreshing) the currently open study
-                       _openStudy = open(getStudyService().selectStudy(
-                                       _openStudy.getIndex())); // Closes the previously open study
-                       _openStudy.setSelection(_selection);
+                       }
+                       if(_openStudy.getStudyObject() == null) {
+                               // Nothing to open or re-open
+                               res = ERROR;
+                       } else {
+                               // Re-opening (refreshing) the currently open study
+                               _openStudy = open(getStudyService().selectStudy(
+                                               _openStudy.getIndex())); // Closes the previously open study
+                               _openStudy.setSelection(_selection);
+                       }
                } else {
                        try { // Opening a study from the search result
                                int index = Integer.valueOf(_myindex);
index 5beec983472f9245be352de69f7942ae707d6020..f25c9021911e16f6d8417cfd25ca6b1b8c7a50a1 100644 (file)
@@ -55,6 +55,19 @@ public class SimanRedirectOnEndOfSessionInterceptor extends
        public void setGlobalResultActionName(final String globalResultActionName) {
                _globalResultActionName = globalResultActionName;
        }
+       
+       /**
+        * {@inheritDoc}
+        * 
+        * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
+        */
+       public String intercept(final ActionInvocation invocation) throws Exception { //NOPMD: RKV: because of struts invoke() method
+               String result = super.intercept(invocation);
+               if (result.equals(getGlobalResult())) { //Redirect happened
+                       ((Action)invocation.getAction()).setMessage("");
+               }
+               return result;
+       }
 
        /**
         * {@inheritDoc}