Removed animation that is broken by latest chrome (v.24)
[pithos-web-client] / src / gr / grnet / pithos / web / client / ToolsMenu.java
index e51776e..c70c5c0 100644 (file)
@@ -40,7 +40,7 @@ import gr.grnet.pithos.web.client.commands.CreateGroupCommand;
 import gr.grnet.pithos.web.client.commands.CutCommand;
 import gr.grnet.pithos.web.client.commands.DeleteCommand;
 import gr.grnet.pithos.web.client.commands.DeleteGroupCommand;
-import gr.grnet.pithos.web.client.commands.EmptyTrashCommand;
+import gr.grnet.pithos.web.client.commands.EmptyContainerCommand;
 import gr.grnet.pithos.web.client.commands.PasteCommand;
 import gr.grnet.pithos.web.client.commands.PropertiesCommand;
 import gr.grnet.pithos.web.client.commands.RemoveUserCommand;
@@ -92,7 +92,6 @@ public class ToolsMenu extends PopupPanel {
                // The popup's constructor's argument is a boolean specifying that it
                // auto-close itself when the user clicks outside of it.
                super(true);
-               setAnimationEnabled(true);
                images = newImages;
         MenuBar contextMenu = new MenuBar(true);
 
@@ -100,11 +99,12 @@ public class ToolsMenu extends PopupPanel {
                Boolean[] permissions = folder.getPermissions().get(app.getUsername());
                boolean canWrite = folder.getOwner().equals(app.getUsername()) || (permissions!= null && permissions[1] != null && permissions[1]);
                boolean isFolderTreeSelected = selectedTree.equals(app.getFolderTreeView());
+               boolean isMysharedTreeSelected = app.isMySharedSelected();
                
                if (!folder.isInTrash()) {
                        if (canWrite) {
 
-                               if (isFolderTreeSelected) {
+                               if (isFolderTreeSelected || isMysharedTreeSelected) {
                                        MenuItem cut = null;
                                        if (files != null && !files.isEmpty()) {
                                                        cut = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut files</span>", true, new CutCommand(app, this, files));
@@ -130,7 +130,7 @@ public class ToolsMenu extends PopupPanel {
                        }
                
                        if (canWrite) {
-                               if (!app.getClipboard().isEmpty()) {
+                               if (!isMysharedTreeSelected && !app.getClipboard().isEmpty()) {
                                        Object item = app.getClipboard().getItem();
                                        boolean showPaste = false;
                                        if (item instanceof List) {
@@ -151,7 +151,7 @@ public class ToolsMenu extends PopupPanel {
                                        }
                                }
        
-                                   if (isFolderTreeSelected) {
+                                   if (isFolderTreeSelected || isMysharedTreeSelected) {
                                        MenuItem moveToTrash = null;
                                        if (files != null && !files.isEmpty()) {
                                                moveToTrash = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move files to Trash</span>", true, new ToTrashCommand(app, this, files));
@@ -174,12 +174,13 @@ public class ToolsMenu extends PopupPanel {
                                                contextMenu.addItem(delete);
                                                empty = false;
                                        }
-                               
+                                   }
+                                   if (isFolderTreeSelected || isMysharedTreeSelected) {
                                        if (files != null && files.size() == 1) {
                                                contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;File properties</span>", true, new PropertiesCommand(app, this, files, PropertiesCommand.PROPERTIES)));
                                                contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.group()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(app, this, files, PropertiesCommand.PERMISSIONS)));
                                                contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.internet()).getHTML() + "&nbsp;Publish</span>", true, new PropertiesCommand(app, this, files, PropertiesCommand.PUBLISH)));
-                                               contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + "&nbsp;Versions</span>", true, new PropertiesCommand(app, this, files, PropertiesCommand.VERSIONS)));
+                                               contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + "&nbsp;Versions</span>", true, new PropertiesCommand(app, this, files, PropertiesCommand.VERSIONS)));
                                                empty = false;
                                        }
                                        else if (!folder.isContainer()) {
@@ -199,6 +200,11 @@ public class ToolsMenu extends PopupPanel {
                                                }));
                                        empty = false;
                                }
+                               if (isFolderTreeSelected && folder.isContainer()) {
+                                       MenuItem emptyContainer = new MenuItem("<span>Empty Container</span>", true, new EmptyContainerCommand(app, this, folder));
+                                       contextMenu.addItem(emptyContainer);
+                                       empty = false;
+                               }
                        }
                }
                else {
@@ -215,7 +221,7 @@ public class ToolsMenu extends PopupPanel {
                                empty = false;
                        }
                        else {
-                               MenuItem emptyTrash = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + "&nbsp;Empty Trash</span>", true, new EmptyTrashCommand(app, this));
+                               MenuItem emptyTrash = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + "&nbsp;Empty Trash</span>", true, new EmptyContainerCommand(app, this, folder));
                                contextMenu.addItem(emptyTrash);
                                empty = false;
                        }
@@ -237,13 +243,11 @@ public class ToolsMenu extends PopupPanel {
                        contextMenu.addItem(deleteGroup);
                                empty = false;
                        }
-                       else {
-                       MenuItem createGroup = new MenuItem("<span>" + AbstractImagePrototype.create(images.group()).getHTML() + "&nbsp;Create Group</span>", true, new CreateGroupCommand(app, this));
-                       contextMenu.addItem(createGroup);
-                               empty = false;
-                       }
                }
         }
+        MenuItem createGroup = new MenuItem("<span>" + AbstractImagePrototype.create(images.group()).getHTML() + "&nbsp;Create Group</span>", true, new CreateGroupCommand(app, this));
+        contextMenu.addItem(createGroup);
+       empty = false;
                add(contextMenu);
        }