import gr.ebs.gss.client.rest.resource.FileResource;
import gr.ebs.gss.client.rest.resource.FolderResource;
import gr.ebs.gss.client.rest.resource.RestResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
+import gr.ebs.gss.client.rest.resource.TrashFolderResource;
import java.util.List;
};
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
+ pasteItem.getElement().setId("FileContextMenu.paste");
RestResource sel = GSS.get().getTreeView().getSelection();
MenuBar contextMenu = new MenuBar(true);
if (isEmpty) {
if(sel instanceof FolderResource)
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
*/
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ if(sel instanceof RestResourceWrapper && !(sel instanceof TrashFolderResource)){
+ MenuItem upload = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ upload.getElement().setId("fileContextMenu.upload");
+ contextMenu.addItem(upload);
+ }
+ MenuItem refresh = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ refresh.getElement().setId("fileContextMenu.refresh");
+ contextMenu.addItem(refresh);
+
} else if (isTrash) {
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ MenuItem restore = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
+ restore.getElement().setId("fileContextMenu.restore");
+ contextMenu.addItem(restore);
+
+ MenuItem delete = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ delete.getElement().setId("fileContextMenu.delete");
+ contextMenu.addItem(delete);
} else {
final Command unselectAllCommand = new Command() {
GSS.get().getSearchResults().clearSelectedRows();
}
};
- cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ cutItem.getElement().setId("fileContextMenu.cut");
+
copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
-
+ copyItem.getElement().setId("fileContextMenu.copy");
+
updateItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ updateItem.getElement().setId("fileContextMenu.upload");
trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
+ trashItem.getElement().setId("fileContextMenu.moveToTrash");
+
deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ deleteItem.getElement().setId("fileContextMenu.delete");
sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
+ sharingItem.getElement().setId("fileContextMenu.sharing");
+
propItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0));
+ propItem.getElement().setId("fileContextMenu.properties");
if(sel!=null && sel instanceof FolderResource)
String[] link = {"", ""};
gss.getTopPanel().getFileMenu().createDownloadLink(link, false);
downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
+ downloadItem.getElement().setId("fileContextMenu.download");
contextMenu.addItem(downloadItem);
+
gss.getTopPanel().getFileMenu().createDownloadLink(link, true);
saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
+ saveAsItem.getElement().setId("fileContextMenu.saveAs");
contextMenu.addItem(saveAsItem);
contextMenu.addItem(cutItem);
contextMenu.addItem(copyItem);
if(sel!=null && sel instanceof FolderResource)
contextMenu.addItem(pasteItem);
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, unselectAllCommand);
+ MenuItem unSelect = new MenuItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, unselectAllCommand);
+ unSelect.getElement().setId("fileContextMenu.unSelect");
+ contextMenu.addItem(unSelect);
+
contextMenu.addItem(trashItem);
contextMenu.addItem(deleteItem);
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+
+ MenuItem refresh = new MenuItem("<span id='fileContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+// refresh.getElement().setId("fileContextMenu.refresh");
+ contextMenu.addItem(refresh);
+
contextMenu.addItem(sharingItem);
contextMenu.addItem(propItem);
}
menu = new FileContextMenu(images, false, false);
menu.onMultipleSelection();
}*/
+ menu = new FileContextMenu(images, false, false);
+ menu.onMultipleSelection();
int left = event.getClientX();
int top = event.getClientY();
menu.setPopupPosition(left, top);
menu = new FileContextMenu(images, false, true);
else return menu;
*/
+ menu = new FileContextMenu(images, false, true);
int left = event.getClientX();
int top = event.getClientY();
menu.setPopupPosition(left, top);