Salome HOME
Menus are improved
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / UploadAction.java
index ad513195f7bb45f8eb49288f071b6a8c17cd29ad..4505ed2c653aab9bae282b19d27727b2ac22ef9a 100644 (file)
@@ -20,6 +20,12 @@ public class UploadAction extends Action {
         * Injected repository service.
         */
        private RepositoryService _repositoryService;
+       
+       /**
+        * Value of the menu property. 
+        * It can be: none, create, open, study, knowledge, sysadmin, help.
+        */
+       private String _menuProperty;
 
        private static final long serialVersionUID = 6003880772275115923L;
 
@@ -31,11 +37,17 @@ public class UploadAction extends Action {
 
     public String doInitialize () {
 //  -----------------------------
+       setMenuProperty("study");
+               initializationScreenContext(_menuProperty);
+               
       return SUCCESS;
     }
 
     public String doUpload () {
 //  -------------------------
+      setMenuProperty("study");
+      initializationScreenContext(_menuProperty);
+      
       if (action == ToDo.cancel) return "cancel";
       try {
        File    udir = getRepositoryService().getDownloadDirectory(getConnectedUser());
@@ -46,9 +58,18 @@ public class UploadAction extends Action {
        if (file.exists())  file.delete();
        Do.copy(upload, file);
         logger.info("Uploading \"" + uploadFileName + "\" " + uploadMimeType + " file.");
+        /*if (next == null || next.isEmpty()) {
+               next = "import";
+        }*/
+        
+        logger.info("MKA next = " + next);
         return next;
       }
       catch (OutOfMemoryError error) {
+         
+       setMenuProperty("none");
+               initializationScreenContext(_menuProperty);
+               
        return "outofmemory";
       }
       catch (Exception error) {
@@ -117,4 +138,20 @@ public class UploadAction extends Action {
        public void setRepositoryService(RepositoryService repositoryService) {
                _repositoryService = repositoryService;
        }
+       
+       /**
+        * Get the menuProperty.
+        * @return the menuProperty
+        */
+       public String getMenuProperty() {
+               return _menuProperty;
+       }
+
+       /**
+        * Set the menuProperty.
+        * @param menuProperty the menuProperty to set
+        */
+       public void setMenuProperty(String menuProperty) {
+               this._menuProperty = menuProperty;
+       }
 }
\ No newline at end of file