if (selectedFolder != null) {
if (!selectedFolder.isInTrash()) {
if (canWrite && app.getClipboard().hasFiles()) {
- pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(app, this, selectedFolder));
- contextMenu.addItem(pasteItem);
+ List<File> files = (List<File>) app.getClipboard().getItem();
+ if (files.get(0).getOwner().equals(selectedFolder.getOwner())) {
+ pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(app, this, selectedFolder));
+ contextMenu.addItem(pasteItem);
+ }
}
if (canWrite) {
if (isFolderTreeSelected && selectedFiles.size() == 1)
contextMenu.addItem(new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(app, this, selectedFiles, images, 0)));
- if (selectedFiles.size() == 1)
- contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + app.getApiPath() + app.getUsername() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + app.getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
}
+ if (selectedFiles.size() == 1)
+ contextMenu.addItem(new MenuItem("<span><a class='hidden-link' href='" + app.getApiPath() + selectedFiles.get(0).getOwner() + selectedFiles.get(0).getUri() + "?X-Auth-Token=" + app.getToken() + "' target='_blank'>" + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download</a></span>", true, (Command) null));
MenuItem unSelect = new MenuItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, new Command() {
@Override
public void execute() {
*/
package gr.grnet.pithos.web.client;
+import java.util.List;
+
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.PropertiesCommand;
import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
+import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
if (canWrite) {
if (!app.getClipboard().isEmpty()) {
- pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(app, this, folder));
- contextMenu.addItem(pasteItem);
+ Object item = app.getClipboard().getItem();
+ boolean showPaste = false;
+ if (item instanceof List) {
+ List<File> files = (List<File>) item;
+ if (files.get(0).getOwner().equals(folder.getOwner()))
+ showPaste = true;
+ }
+ else {
+ Folder f = (Folder) item;
+ if (f.getOwner().equals(folder.getOwner()))
+ showPaste = true;
+ }
+ if (showPaste) {
+ pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(app, this, folder));
+ contextMenu.addItem(pasteItem);
+ }
}
if (isFolderTreeSelected && !folder.isContainer()) {