Revision ea517aad src/gr/ebs/gss/client/FileContextMenu.java

b/src/gr/ebs/gss/client/FileContextMenu.java
40 40
import com.google.gwt.user.client.ui.MenuBar;
41 41
import com.google.gwt.user.client.ui.MenuItem;
42 42
import com.google.gwt.user.client.ui.PopupPanel;
43
import com.google.gwt.user.client.ui.TreeItem;
43 44
import com.google.gwt.user.client.ui.Widget;
44 45

  
45 46
/**
......
102 103
		// The popup's constructor's argument is a boolean specifying that it
103 104
		// auto-close itself when the user clicks outside of it.
104 105
		super(true);
106
		GSS gss = GSS.get();
105 107
		setAnimationEnabled(true);
106 108
		images = newImages;
107 109

  
......
119 121
		MenuBar contextMenu = new MenuBar(true);
120 122
		if (isEmpty) {
121 123
			contextMenu.addItem(pasteItem);
122
			if (GSS.get().getFolders().getCurrent() != null)
123
				if (GSS.get().getFolders().isFileItem(GSS.get().getFolders().getCurrent()))
124
			if (gss.getFolders().getCurrent() != null)
125
				if (gss.getFolders().isFileItem(gss.getFolders().getCurrent()))
124 126
					contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this, images));
125
				else if (GSS.get().getFolders().isMySharedItem(GSS.get().getFolders().getCurrent()) || GSS	.get()
127
				else if (gss.getFolders().isMySharedItem(gss.getFolders().getCurrent()) || GSS	.get()
126 128
																											.getFolders()
127 129
																											.isOthersSharedItem(GSS	.get()
128 130
																																	.getFolders()
129 131
																																	.getCurrent()))
130
					if(GSS.get().getFolders().getCurrent().getUserObject() instanceof FolderResource)
132
					if(gss.getFolders().getCurrent().getUserObject() instanceof FolderResource)
131 133
						contextMenu.addItem("<span>" + newImages.fileUpdate().getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this, images));
132 134
			contextMenu.addItem("<span>" + images.refresh().getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
133 135
		} else if (isTrash) {
......
155 157
			sharingItem = new MenuItem("<span>" + newImages.sharing().getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, images, 1));
156 158
			propItem = new MenuItem("<span>" + newImages.viewText().getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, images, 0));
157 159

  
158
			contextMenu.addItem(updateItem);
160
			TreeItem currentFolder = gss.getFolders().getCurrent();
161
			if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource)
162
				contextMenu.addItem(updateItem);
159 163
			String[] link = {"", ""};
160
			GSS.get().getTopPanel().getFileMenu().createDownloadLink(link);
164
			gss.getTopPanel().getFileMenu().createDownloadLink(link);
161 165
			downloadItem = new MenuItem("<span>" + link[0] + newImages.download().getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
162 166
			contextMenu.addItem(downloadItem);
163 167
			contextMenu.addItem(cutItem);
164 168
			contextMenu.addItem(copyItem);
165
			contextMenu.addItem(pasteItem);
169
			if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource)
170
				contextMenu.addItem(pasteItem);
166 171
			contextMenu.addItem("<span>" + images.unselectAll().getHTML() + "&nbsp;Unselect</span>", true, unselectAllCommand);
167 172
			contextMenu.addItem(trashItem);
168 173
			contextMenu.addItem(deleteItem);
......
171 176
			contextMenu.addItem(propItem);
172 177
		}
173 178
		add(contextMenu);
174
		if (GSS.get().getClipboard().hasFileItem())
179
		if (gss.getClipboard().hasFileItem())
175 180
			pasteItem.setVisible(true);
176 181
		else
177 182
			pasteItem.setVisible(false);

Also available in: Unified diff