root / src / gr / ebs / gss / client / FileContextMenu.java @ fc0fa492
History | View | Annotate | Download (12 kB)
1 | 14ad7326 | pastith | /*
|
---|---|---|---|
2 | 14ad7326 | pastith | * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
|
3 | 14ad7326 | pastith | *
|
4 | 14ad7326 | pastith | * This file is part of GSS.
|
5 | 14ad7326 | pastith | *
|
6 | 14ad7326 | pastith | * GSS is free software: you can redistribute it and/or modify
|
7 | 14ad7326 | pastith | * it under the terms of the GNU General Public License as published by
|
8 | 14ad7326 | pastith | * the Free Software Foundation, either version 3 of the License, or
|
9 | 14ad7326 | pastith | * (at your option) any later version.
|
10 | 14ad7326 | pastith | *
|
11 | 14ad7326 | pastith | * GSS is distributed in the hope that it will be useful,
|
12 | 14ad7326 | pastith | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 14ad7326 | pastith | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 14ad7326 | pastith | * GNU General Public License for more details.
|
15 | 14ad7326 | pastith | *
|
16 | 14ad7326 | pastith | * You should have received a copy of the GNU General Public License
|
17 | 14ad7326 | pastith | * along with GSS. If not, see <http://www.gnu.org/licenses/>.
|
18 | 14ad7326 | pastith | */
|
19 | 14ad7326 | pastith | package gr.ebs.gss.client; |
20 | 14ad7326 | pastith | |
21 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.CopyCommand; |
22 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.CutCommand; |
23 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.DeleteCommand; |
24 | 080386c0 | fstamatelopoulos | import gr.ebs.gss.client.commands.PasteCommand; |
25 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.PropertiesCommand; |
26 | ad8b38cb | koutsoub | import gr.ebs.gss.client.commands.RefreshCommand; |
27 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.RestoreTrashCommand; |
28 | 14ad7326 | pastith | import gr.ebs.gss.client.commands.ToTrashCommand; |
29 | b4b188fe | koutsoub | import gr.ebs.gss.client.commands.UploadFileCommand; |
30 | 67b7ce51 | koutsoub | import gr.ebs.gss.client.dnd.DnDTreeItem; |
31 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.FileResource; |
32 | eaf8a7cb | koutsoub | import gr.ebs.gss.client.rest.resource.FolderResource; |
33 | 14ad7326 | pastith | |
34 | 14ad7326 | pastith | import java.util.List; |
35 | 14ad7326 | pastith | |
36 | afd3a0ef | Giannis Koutsoubos | import com.google.gwt.event.dom.client.ClickEvent; |
37 | afd3a0ef | Giannis Koutsoubos | import com.google.gwt.event.dom.client.ClickHandler; |
38 | bc9942d1 | Giannis Koutsoubos | import com.google.gwt.event.dom.client.ContextMenuEvent; |
39 | afd3a0ef | Giannis Koutsoubos | import com.google.gwt.resources.client.ClientBundle; |
40 | afd3a0ef | Giannis Koutsoubos | import com.google.gwt.resources.client.ImageResource; |
41 | 14ad7326 | pastith | import com.google.gwt.user.client.Command; |
42 | b4b188fe | koutsoub | import com.google.gwt.user.client.Event; |
43 | 14ad7326 | pastith | import com.google.gwt.user.client.ui.AbstractImagePrototype; |
44 | 14ad7326 | pastith | import com.google.gwt.user.client.ui.MenuBar; |
45 | 14ad7326 | pastith | import com.google.gwt.user.client.ui.MenuItem; |
46 | 14ad7326 | pastith | import com.google.gwt.user.client.ui.PopupPanel; |
47 | ea517aad | Dimitris Routsis | import com.google.gwt.user.client.ui.TreeItem; |
48 | 14ad7326 | pastith | |
49 | 14ad7326 | pastith | /**
|
50 | 14ad7326 | pastith | * The 'File Context' menu implementation.
|
51 | 14ad7326 | pastith | */
|
52 | afd3a0ef | Giannis Koutsoubos | public class FileContextMenu extends PopupPanel implements ClickHandler { |
53 | 14ad7326 | pastith | |
54 | 14ad7326 | pastith | /**
|
55 | 14ad7326 | pastith | * The widget's images.
|
56 | 14ad7326 | pastith | */
|
57 | 14ad7326 | pastith | private final Images images; |
58 | a52ea5e4 | pastith | |
59 | 14ad7326 | pastith | private MenuItem cutItem; |
60 | a52ea5e4 | pastith | |
61 | 14ad7326 | pastith | private MenuItem copyItem; |
62 | a52ea5e4 | pastith | |
63 | 080386c0 | fstamatelopoulos | private MenuItem pasteItem; |
64 | 080386c0 | fstamatelopoulos | |
65 | 14ad7326 | pastith | private MenuItem updateItem; |
66 | a52ea5e4 | pastith | |
67 | 892a2836 | fstamatelopoulos | private MenuItem sharingItem; |
68 | 892a2836 | fstamatelopoulos | |
69 | 14ad7326 | pastith | private MenuItem propItem; |
70 | a52ea5e4 | pastith | |
71 | 14ad7326 | pastith | private MenuItem trashItem; |
72 | a52ea5e4 | pastith | |
73 | 14ad7326 | pastith | private MenuItem deleteItem; |
74 | a52ea5e4 | pastith | |
75 | 14ad7326 | pastith | private MenuItem downloadItem; |
76 | a52ea5e4 | pastith | |
77 | 617fe906 | Dimitris Routsis | private MenuItem saveAsItem; |
78 | 617fe906 | Dimitris Routsis | |
79 | 14ad7326 | pastith | /**
|
80 | 14ad7326 | pastith | * The image bundle for this widget's images that reuses images defined in
|
81 | 14ad7326 | pastith | * other menus.
|
82 | 14ad7326 | pastith | */
|
83 | afd3a0ef | Giannis Koutsoubos | public interface Images extends ClientBundle,FileMenu.Images, EditMenu.Images { |
84 | 14ad7326 | pastith | |
85 | afd3a0ef | Giannis Koutsoubos | @Source("gr/ebs/gss/resources/mimetypes/document.png") |
86 | afd3a0ef | Giannis Koutsoubos | ImageResource fileContextMenu(); |
87 | 14ad7326 | pastith | |
88 | afd3a0ef | Giannis Koutsoubos | @Source("gr/ebs/gss/resources/doc_versions.png") |
89 | afd3a0ef | Giannis Koutsoubos | ImageResource versions(); |
90 | 892a2836 | fstamatelopoulos | |
91 | 023f6f1e | Panagiotis Astithas | @Override
|
92 | afd3a0ef | Giannis Koutsoubos | @Source("gr/ebs/gss/resources/group.png") |
93 | afd3a0ef | Giannis Koutsoubos | ImageResource sharing(); |
94 | 2e0597d1 | koutsoub | |
95 | 023f6f1e | Panagiotis Astithas | @Override
|
96 | afd3a0ef | Giannis Koutsoubos | @Source("gr/ebs/gss/resources/border_remove.png") |
97 | afd3a0ef | Giannis Koutsoubos | ImageResource unselectAll(); |
98 | b0cdfc28 | Fotis Stamatelopoulos | |
99 | afd3a0ef | Giannis Koutsoubos | @Source("gr/ebs/gss/resources/demo.png") |
100 | afd3a0ef | Giannis Koutsoubos | ImageResource viewImage(); |
101 | b0cdfc28 | Fotis Stamatelopoulos | } |
102 | 14ad7326 | pastith | |
103 | a52ea5e4 | pastith | public static native String getDate()/*-{ |
104 | 59504564 | pastith | return (new Date()).toUTCString();
|
105 | 59504564 | pastith | }-*/;
|
106 | a52ea5e4 | pastith | |
107 | 14ad7326 | pastith | /**
|
108 | 14ad7326 | pastith | * The widget's constructor.
|
109 | 14ad7326 | pastith | *
|
110 | 14ad7326 | pastith | * @param newImages the image bundle passed on by the parent object
|
111 | 14ad7326 | pastith | */
|
112 | 0e4865ee | pastith | public FileContextMenu(Images newImages, boolean isTrash, boolean isEmpty) { |
113 | 14ad7326 | pastith | // The popup's constructor's argument is a boolean specifying that it
|
114 | 14ad7326 | pastith | // auto-close itself when the user clicks outside of it.
|
115 | 14ad7326 | pastith | super(true); |
116 | ea517aad | Dimitris Routsis | GSS gss = GSS.get(); |
117 | 14ad7326 | pastith | setAnimationEnabled(true);
|
118 | 14ad7326 | pastith | images = newImages; |
119 | 14ad7326 | pastith | |
120 | eaf8a7cb | koutsoub | // The command that does some validation before downloading a file.
|
121 | 0e4865ee | pastith | Command downloadCmd = new Command() {
|
122 | 14ad7326 | pastith | |
123 | 023f6f1e | Panagiotis Astithas | @Override
|
124 | eaf8a7cb | koutsoub | public void execute() { |
125 | eaf8a7cb | koutsoub | hide(); |
126 | eaf8a7cb | koutsoub | GSS.get().getTopPanel().getFileMenu().preDownloadCheck(); |
127 | eaf8a7cb | koutsoub | } |
128 | eaf8a7cb | koutsoub | }; |
129 | 14ad7326 | pastith | |
130 | afd3a0ef | Giannis Koutsoubos | pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this)); |
131 | 080386c0 | fstamatelopoulos | |
132 | 0e4865ee | pastith | MenuBar contextMenu = new MenuBar(true); |
133 | eaf8a7cb | koutsoub | if (isEmpty) {
|
134 | 080386c0 | fstamatelopoulos | contextMenu.addItem(pasteItem); |
135 | eaf8a7cb | koutsoub | if (GSS.get().getFolders().getCurrent() != null) |
136 | eaf8a7cb | koutsoub | if (GSS.get().getFolders().isFileItem(GSS.get().getFolders().getCurrent()))
|
137 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this)); |
138 | eaf8a7cb | koutsoub | else if (GSS.get().getFolders().isMySharedItem(GSS.get().getFolders().getCurrent()) || GSS .get() |
139 | eaf8a7cb | koutsoub | .getFolders() |
140 | eaf8a7cb | koutsoub | .isOthersSharedItem(GSS .get() |
141 | eaf8a7cb | koutsoub | .getFolders() |
142 | eaf8a7cb | koutsoub | .getCurrent())) |
143 | eaf8a7cb | koutsoub | if(GSS.get().getFolders().getCurrent().getUserObject() instanceof FolderResource) |
144 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this)); |
145 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images)); |
146 | eaf8a7cb | koutsoub | } else if (isTrash) { |
147 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Restore</span>", true, new RestoreTrashCommand(this)); |
148 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images)); |
149 | 14ad7326 | pastith | } else {
|
150 | 2a945870 | fstamatelopoulos | final Command unselectAllCommand = new Command() { |
151 | eaf8a7cb | koutsoub | |
152 | 023f6f1e | Panagiotis Astithas | @Override
|
153 | 2a945870 | fstamatelopoulos | public void execute() { |
154 | 2a945870 | fstamatelopoulos | hide(); |
155 | 2a945870 | fstamatelopoulos | if(GSS.get().isFileListShowing())
|
156 | 2a945870 | fstamatelopoulos | GSS.get().getFileList().clearSelectedRows(); |
157 | 2a945870 | fstamatelopoulos | else if(GSS.get().isSearchResultsShowing()) |
158 | 2a945870 | fstamatelopoulos | GSS.get().getSearchResults().clearSelectedRows(); |
159 | 2a945870 | fstamatelopoulos | } |
160 | 2a945870 | fstamatelopoulos | }; |
161 | afd3a0ef | Giannis Koutsoubos | cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this)); |
162 | afd3a0ef | Giannis Koutsoubos | copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this)); |
163 | 080386c0 | fstamatelopoulos | |
164 | afd3a0ef | Giannis Koutsoubos | updateItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this)); |
165 | 14ad7326 | pastith | |
166 | afd3a0ef | Giannis Koutsoubos | trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this)); |
167 | afd3a0ef | Giannis Koutsoubos | deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images)); |
168 | 14ad7326 | pastith | |
169 | afd3a0ef | Giannis Koutsoubos | sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1)); |
170 | afd3a0ef | Giannis Koutsoubos | propItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0)); |
171 | 892a2836 | fstamatelopoulos | |
172 | ea517aad | Dimitris Routsis | TreeItem currentFolder = gss.getFolders().getCurrent(); |
173 | ea517aad | Dimitris Routsis | if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource) |
174 | ea517aad | Dimitris Routsis | contextMenu.addItem(updateItem); |
175 | 14ad7326 | pastith | String[] link = {"", ""}; |
176 | 617fe906 | Dimitris Routsis | gss.getTopPanel().getFileMenu().createDownloadLink(link, false);
|
177 | afd3a0ef | Giannis Koutsoubos | downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd); |
178 | eaf8a7cb | koutsoub | contextMenu.addItem(downloadItem); |
179 | 617fe906 | Dimitris Routsis | gss.getTopPanel().getFileMenu().createDownloadLink(link, true);
|
180 | afd3a0ef | Giannis Koutsoubos | saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd); |
181 | 617fe906 | Dimitris Routsis | contextMenu.addItem(saveAsItem); |
182 | b6761fe4 | fstamatelopoulos | contextMenu.addItem(cutItem); |
183 | b6761fe4 | fstamatelopoulos | contextMenu.addItem(copyItem); |
184 | ea517aad | Dimitris Routsis | if(currentFolder!=null && currentFolder.getUserObject() instanceof FolderResource) |
185 | ea517aad | Dimitris Routsis | contextMenu.addItem(pasteItem); |
186 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, unselectAllCommand); |
187 | b6761fe4 | fstamatelopoulos | contextMenu.addItem(trashItem); |
188 | b6761fe4 | fstamatelopoulos | contextMenu.addItem(deleteItem); |
189 | afd3a0ef | Giannis Koutsoubos | contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images)); |
190 | 892a2836 | fstamatelopoulos | contextMenu.addItem(sharingItem); |
191 | b6761fe4 | fstamatelopoulos | contextMenu.addItem(propItem); |
192 | 14ad7326 | pastith | } |
193 | 14ad7326 | pastith | add(contextMenu); |
194 | ea517aad | Dimitris Routsis | if (gss.getClipboard().hasFileItem())
|
195 | 080386c0 | fstamatelopoulos | pasteItem.setVisible(true);
|
196 | 080386c0 | fstamatelopoulos | else
|
197 | 080386c0 | fstamatelopoulos | pasteItem.setVisible(false);
|
198 | 14ad7326 | pastith | } |
199 | 14ad7326 | pastith | |
200 | a52ea5e4 | pastith | void onMultipleSelection() {
|
201 | 14ad7326 | pastith | updateItem.setVisible(false);
|
202 | 14ad7326 | pastith | downloadItem.setVisible(false);
|
203 | e0c13a93 | Fotis Stamatelopoulos | saveAsItem.setVisible(false);
|
204 | 2e0597d1 | koutsoub | sharingItem.setVisible(false);
|
205 | 14ad7326 | pastith | } |
206 | afd3a0ef | Giannis Koutsoubos | @Override
|
207 | afd3a0ef | Giannis Koutsoubos | public void onClick(ClickEvent event) { |
208 | a52ea5e4 | pastith | if (GSS.get().getCurrentSelection() != null) |
209 | a52ea5e4 | pastith | if (GSS.get().getCurrentSelection() instanceof FileResource) { |
210 | a52ea5e4 | pastith | FileResource res = (FileResource) GSS.get().getCurrentSelection(); |
211 | a52ea5e4 | pastith | FileContextMenu menu; |
212 | a52ea5e4 | pastith | if (res.isDeleted())
|
213 | b4b188fe | koutsoub | menu = new FileContextMenu(images, true, false); |
214 | 14ad7326 | pastith | else
|
215 | b4b188fe | koutsoub | menu = new FileContextMenu(images, false, false); |
216 | afd3a0ef | Giannis Koutsoubos | int left = event.getRelativeElement().getAbsoluteLeft();
|
217 | afd3a0ef | Giannis Koutsoubos | int top = event.getRelativeElement().getAbsoluteTop() + event.getRelativeElement().getOffsetHeight();
|
218 | 14ad7326 | pastith | menu.setPopupPosition(left, top); |
219 | 14ad7326 | pastith | menu.show(); |
220 | a52ea5e4 | pastith | } else if (GSS.get().getCurrentSelection() instanceof List) { |
221 | a52ea5e4 | pastith | FileContextMenu menu; |
222 | a52ea5e4 | pastith | if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
|
223 | b4b188fe | koutsoub | menu = new FileContextMenu(images, true, false); |
224 | a52ea5e4 | pastith | else {
|
225 | b4b188fe | koutsoub | menu = new FileContextMenu(images, false, false); |
226 | 14ad7326 | pastith | menu.onMultipleSelection(); |
227 | 14ad7326 | pastith | } |
228 | afd3a0ef | Giannis Koutsoubos | int left = event.getRelativeElement().getAbsoluteLeft();
|
229 | afd3a0ef | Giannis Koutsoubos | int top = event.getRelativeElement().getAbsoluteTop() + event.getRelativeElement().getOffsetHeight();
|
230 | 14ad7326 | pastith | menu.setPopupPosition(left, top); |
231 | 14ad7326 | pastith | menu.show(); |
232 | 14ad7326 | pastith | } |
233 | 14ad7326 | pastith | } |
234 | b4b188fe | koutsoub | |
235 | 1510f141 | Giannis Koutsoubos | |
236 | 1510f141 | Giannis Koutsoubos | public void onContextEvent(ContextMenuEvent event) { |
237 | 848896d0 | koutsoub | if (GSS.get().getCurrentSelection() != null) |
238 | 848896d0 | koutsoub | if (GSS.get().getCurrentSelection() instanceof FileResource) { |
239 | 848896d0 | koutsoub | FileResource res = (FileResource) GSS.get().getCurrentSelection(); |
240 | 848896d0 | koutsoub | FileContextMenu menu; |
241 | 848896d0 | koutsoub | if (res.isDeleted())
|
242 | 848896d0 | koutsoub | menu = new FileContextMenu(images, true, false); |
243 | 848896d0 | koutsoub | else
|
244 | 848896d0 | koutsoub | menu = new FileContextMenu(images, false, false); |
245 | 1510f141 | Giannis Koutsoubos | int left = event.getNativeEvent().getClientX();
|
246 | 1510f141 | Giannis Koutsoubos | int top = event.getNativeEvent().getClientY();
|
247 | 848896d0 | koutsoub | menu.setPopupPosition(left, top); |
248 | 848896d0 | koutsoub | menu.show(); |
249 | 1510f141 | Giannis Koutsoubos | |
250 | 848896d0 | koutsoub | } else if (GSS.get().getCurrentSelection() instanceof List) { |
251 | 848896d0 | koutsoub | FileContextMenu menu; |
252 | 848896d0 | koutsoub | if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
|
253 | 848896d0 | koutsoub | menu = new FileContextMenu(images, true, false); |
254 | 848896d0 | koutsoub | else {
|
255 | 848896d0 | koutsoub | menu = new FileContextMenu(images, false, false); |
256 | 848896d0 | koutsoub | menu.onMultipleSelection(); |
257 | 848896d0 | koutsoub | } |
258 | 1510f141 | Giannis Koutsoubos | int left = event.getNativeEvent().getClientX();
|
259 | 1510f141 | Giannis Koutsoubos | int top = event.getNativeEvent().getClientY();
|
260 | 848896d0 | koutsoub | menu.setPopupPosition(left, top); |
261 | 848896d0 | koutsoub | menu.show(); |
262 | 848896d0 | koutsoub | } |
263 | 848896d0 | koutsoub | } |
264 | 848896d0 | koutsoub | |
265 | 1510f141 | Giannis Koutsoubos | public FileContextMenu onEvent(Event event) { |
266 | 1510f141 | Giannis Koutsoubos | FileContextMenu menu=null;
|
267 | bc9942d1 | Giannis Koutsoubos | if (GSS.get().getCurrentSelection() != null) |
268 | bc9942d1 | Giannis Koutsoubos | if (GSS.get().getCurrentSelection() instanceof FileResource) { |
269 | bc9942d1 | Giannis Koutsoubos | FileResource res = (FileResource) GSS.get().getCurrentSelection(); |
270 | 1510f141 | Giannis Koutsoubos | |
271 | bc9942d1 | Giannis Koutsoubos | if (res.isDeleted())
|
272 | bc9942d1 | Giannis Koutsoubos | menu = new FileContextMenu(images, true, false); |
273 | bc9942d1 | Giannis Koutsoubos | else
|
274 | bc9942d1 | Giannis Koutsoubos | menu = new FileContextMenu(images, false, false); |
275 | 1510f141 | Giannis Koutsoubos | int left = event.getClientX();
|
276 | 1510f141 | Giannis Koutsoubos | int top = event.getClientY();
|
277 | bc9942d1 | Giannis Koutsoubos | menu.setPopupPosition(left, top); |
278 | bc9942d1 | Giannis Koutsoubos | menu.show(); |
279 | bc9942d1 | Giannis Koutsoubos | } else if (GSS.get().getCurrentSelection() instanceof List) { |
280 | 1510f141 | Giannis Koutsoubos | |
281 | bc9942d1 | Giannis Koutsoubos | if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
|
282 | bc9942d1 | Giannis Koutsoubos | menu = new FileContextMenu(images, true, false); |
283 | bc9942d1 | Giannis Koutsoubos | else {
|
284 | bc9942d1 | Giannis Koutsoubos | menu = new FileContextMenu(images, false, false); |
285 | bc9942d1 | Giannis Koutsoubos | menu.onMultipleSelection(); |
286 | bc9942d1 | Giannis Koutsoubos | } |
287 | 1510f141 | Giannis Koutsoubos | int left = event.getClientX();
|
288 | 1510f141 | Giannis Koutsoubos | int top = event.getClientY();
|
289 | bc9942d1 | Giannis Koutsoubos | menu.setPopupPosition(left, top); |
290 | bc9942d1 | Giannis Koutsoubos | menu.show(); |
291 | bc9942d1 | Giannis Koutsoubos | } |
292 | 1510f141 | Giannis Koutsoubos | return menu;
|
293 | bc9942d1 | Giannis Koutsoubos | } |
294 | bc9942d1 | Giannis Koutsoubos | |
295 | 1510f141 | Giannis Koutsoubos | public FileContextMenu onEmptyEvent(Event event) { |
296 | 1510f141 | Giannis Koutsoubos | FileContextMenu menu=null;
|
297 | b4b188fe | koutsoub | if (GSS.get().getFolders().isTrashItem(GSS.get().getFolders().getCurrent()))
|
298 | b4b188fe | koutsoub | menu = new FileContextMenu(images, true, true); |
299 | 67b7ce51 | koutsoub | else if(((DnDTreeItem)GSS.get().getFolders().getCurrent()).getFolderResource() != null) |
300 | b4b188fe | koutsoub | menu = new FileContextMenu(images, false, true); |
301 | 1510f141 | Giannis Koutsoubos | else return menu; |
302 | b4b188fe | koutsoub | int left = event.getClientX();
|
303 | b4b188fe | koutsoub | int top = event.getClientY();
|
304 | b4b188fe | koutsoub | menu.setPopupPosition(left, top); |
305 | b4b188fe | koutsoub | menu.show(); |
306 | 1510f141 | Giannis Koutsoubos | return menu;
|
307 | b4b188fe | koutsoub | } |
308 | afd3a0ef | Giannis Koutsoubos | |
309 | afd3a0ef | Giannis Koutsoubos | |
310 | 14ad7326 | pastith | } |