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 com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
/**
private MenuItem downloadItem;
+ private MenuItem saveAsItem;
+
/**
* The image bundle for this widget's images that reuses images defined in
* other menus.
// The popup's constructor's argument is a boolean specifying that it
// auto-close itself when the user clicks outside of it.
super(true);
+ GSS gss = GSS.get();
setAnimationEnabled(true);
images = newImages;
contextMenu.addItem(pasteItem);
if (GSS.get().getFolders().getCurrent() != null)
if (GSS.get().getFolders().isFileItem(GSS.get().getFolders().getCurrent()))
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
else if (GSS.get().getFolders().isMySharedItem(GSS.get().getFolders().getCurrent()) || GSS .get()
.getFolders()
.isOthersSharedItem(GSS .get()
.getFolders()
.getCurrent()))
if(GSS.get().getFolders().getCurrent().getUserObject() instanceof FolderResource)
- contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
contextMenu.addItem("<span>" + images.refresh().getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
} else if (isTrash) {
contextMenu.addItem("<span>" + newImages.versions().getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
cutItem = new MenuItem("<span>" + newImages.cut().getHTML() + " Cut</span>", true, new CutCommand(this));
copyItem = new MenuItem("<span>" + newImages.copy().getHTML() + " Copy</span>", true, new CopyCommand(this));
- updateItem = new MenuItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this, images));
+ updateItem = new MenuItem("<span>" + newImages.fileUpdate().getHTML() + " Upload</span>", true, new UploadFileCommand(this));
trashItem = new MenuItem("<span>" + newImages.emptyTrash().getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
deleteItem = new MenuItem("<span>" + newImages.delete().getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
sharingItem = new MenuItem("<span>" + newImages.sharing().getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
propItem = new MenuItem("<span>" + newImages.viewText().getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0));
- contextMenu.addItem(updateItem);
+ TreeItem currentFolder = gss.getFolders().getCurrent();
+ if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource)
+ contextMenu.addItem(updateItem);
String[] link = {"", ""};
- GSS.get().getTopPanel().getFileMenu().createDownloadLink(link);
+ gss.getTopPanel().getFileMenu().createDownloadLink(link, false);
downloadItem = new MenuItem("<span>" + link[0] + newImages.download().getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
contextMenu.addItem(downloadItem);
+ gss.getTopPanel().getFileMenu().createDownloadLink(link, true);
+ saveAsItem = new MenuItem("<span>" + link[0] + newImages.download().getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
+ contextMenu.addItem(saveAsItem);
contextMenu.addItem(cutItem);
contextMenu.addItem(copyItem);
- contextMenu.addItem(pasteItem);
+ if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource)
+ contextMenu.addItem(pasteItem);
contextMenu.addItem("<span>" + images.unselectAll().getHTML() + " Unselect</span>", true, unselectAllCommand);
contextMenu.addItem(trashItem);
contextMenu.addItem(deleteItem);
contextMenu.addItem(propItem);
}
add(contextMenu);
- if (GSS.get().getClipboard().hasFileItem())
+ if (gss.getClipboard().hasFileItem())
pasteItem.setVisible(true);
else
pasteItem.setVisible(false);