Merge branch 'release-0.15' into debian-release-0.15
[pithos-web-client] / src / gr / grnet / pithos / web / client / FileContextMenu.java
index d680b47..1399047 100644 (file)
  */
 package gr.grnet.pithos.web.client;
 
-import gr.grnet.pithos.web.client.commands.CopyCommand;
-import gr.grnet.pithos.web.client.commands.CutCommand;
-import gr.grnet.pithos.web.client.commands.DeleteCommand;
-import gr.grnet.pithos.web.client.commands.PasteCommand;
-import gr.grnet.pithos.web.client.commands.PropertiesCommand;
-import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
-import gr.grnet.pithos.web.client.commands.ToTrashCommand;
-import gr.grnet.pithos.web.client.commands.UploadFileCommand;
-import gr.grnet.pithos.web.client.foldertree.File;
-import gr.grnet.pithos.web.client.foldertree.Folder;
-
-import java.util.List;
-
 import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.user.client.Command;
@@ -55,6 +42,11 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.MenuBar;
 import com.google.gwt.user.client.ui.MenuItem;
 import com.google.gwt.user.client.ui.PopupPanel;
+import gr.grnet.pithos.web.client.commands.*;
+import gr.grnet.pithos.web.client.foldertree.File;
+import gr.grnet.pithos.web.client.foldertree.Folder;
+
+import java.util.List;
 
 /**
  * The 'File Context' menu implementation.
@@ -203,6 +195,11 @@ public class FileContextMenu extends PopupPanel {
         }
         boolean isFolderTreeSelected = selectedTree.equals(app.getFolderTreeView());
         boolean isMysharedSelected = selectedTree.equals(app.getMySharedTreeView());
+
+        Pithos.LOG("FileContextMenu(), selectedFolder=", selectedFolder);
+        Pithos.LOG("FileContextMenu(), isFolderTreeSelected=", isFolderTreeSelected);
+        Pithos.LOG("FileContextMenu(), isMysharedSelected=", isMysharedSelected);
+
         if (selectedFolder != null) {
                    if (!selectedFolder.isInTrash()) {
                        if (canWrite && app.getClipboard().hasFiles() && !isMysharedSelected) {
@@ -210,10 +207,6 @@ public class FileContextMenu extends PopupPanel {
                                contextMenu.addItem(pasteItem);
                        }
                
-                       if (canWrite && !isMysharedSelected) {
-                               MenuItem upload = new MenuItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(app, this, selectedFolder));
-                               contextMenu.addItem(upload);
-                       }
                        if (isFolderTreeSelected || isMysharedSelected) {
                                        cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(app, this, selectedFiles));
                            contextMenu.addItem(cutItem);
@@ -230,12 +223,10 @@ public class FileContextMenu extends PopupPanel {
                    else {
                                MenuItem restore = new MenuItem("<span>" + AbstractImagePrototype.create(images.versions()).getHTML() + "&nbsp;Restore</span>", true, new RestoreTrashCommand(app, this, selectedFiles));
                                contextMenu.addItem(restore);
-                   }
-        }
 
-        if (isFolderTreeSelected || isMysharedSelected) {
-                       deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(app, this, selectedFiles, MessagePanel.images));
-               contextMenu.addItem(deleteItem);
+                deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(app, this, selectedFiles, MessagePanel.images));
+                contextMenu.addItem(deleteItem);
+                   }
         }
 
         if (selectedFolder != null && !selectedFolder.isInTrash()) {
@@ -250,8 +241,9 @@ public class FileContextMenu extends PopupPanel {
                        
                        @Override
                        public void execute() {
-                               for (File f : selectedFiles)
-                                       Window.open(app.getApiPath() + f.getOwnerID() + f.getUri(), "_blank", "");
+                               for (File f : selectedFiles) {
+                    Window.open(Pithos.getFileViewURL(f), "_blank", "");
+                }
                        }
                }));