From 783e2f7e5bc34aa4065dcfeebb1600755b7fcc7f Mon Sep 17 00:00:00 2001 From: mka Date: Fri, 24 May 2013 16:40:37 +0000 Subject: [PATCH] Correct redirect end of session during check-out operation --- .../src/org/splat/launcher/ToolbarApplet.java | 8 ++++---- .../org/splat/simer/DisplayStudyStepAction.java | 15 ++++++++++----- .../SimanRedirectOnEndOfSessionInterceptor.java | 13 +++++++++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java b/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java index f89f820..bc3c1a1 100644 --- a/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java +++ b/Workspace/Siman/src/org/splat/launcher/ToolbarApplet.java @@ -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 diff --git a/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java b/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java index 96781cf..8aa9106 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java @@ -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); diff --git a/Workspace/Siman/src/org/splat/simer/SimanRedirectOnEndOfSessionInterceptor.java b/Workspace/Siman/src/org/splat/simer/SimanRedirectOnEndOfSessionInterceptor.java index 5beec98..f25c902 100644 --- a/Workspace/Siman/src/org/splat/simer/SimanRedirectOnEndOfSessionInterceptor.java +++ b/Workspace/Siman/src/org/splat/simer/SimanRedirectOnEndOfSessionInterceptor.java @@ -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} -- 2.39.2