Statistics
| Branch: | Tag: | Revision:

root / web_client / src / gr / grnet / pithos / web / client / FolderContextMenu.java @ fbff60ff

History | View | Annotate | Download (16.2 kB)

1 ab1eb3f8 Christos Stathis
/*
2 6dd67d1c Christos Stathis
 * Copyright (c) 2011 Greek Research and Technology Network
3 ab1eb3f8 Christos Stathis
 */
4 ab1eb3f8 Christos Stathis
package gr.grnet.pithos.web.client;
5 ab1eb3f8 Christos Stathis
6 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.CopyCommand;
7 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.CutCommand;
8 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.DeleteCommand;
9 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.EmptyTrashCommand;
10 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.NewFolderCommand;
11 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.PasteCommand;
12 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.PropertiesCommand;
13 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.RefreshCommand;
14 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
15 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
16 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.commands.UploadFileCommand;
17 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.MyFolderResource;
18 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.OtherUserResource;
19 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.OthersFolderResource;
20 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.OthersResource;
21 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.RestResource;
22 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.SharedFolderResource;
23 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.SharedResource;
24 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;
25 ab1eb3f8 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.TrashResource;
26 ab1eb3f8 Christos Stathis
27 ab1eb3f8 Christos Stathis
import com.google.gwt.resources.client.ClientBundle;
28 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.ui.AbstractImagePrototype;
29 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.ui.MenuBar;
30 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.ui.MenuItem;
31 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.ui.PopupPanel;
32 ab1eb3f8 Christos Stathis
33 ab1eb3f8 Christos Stathis
/**
34 ab1eb3f8 Christos Stathis
 * The 'Folder Context' menu implementation.
35 ab1eb3f8 Christos Stathis
 */
36 ab1eb3f8 Christos Stathis
public class FolderContextMenu extends PopupPanel {
37 ab1eb3f8 Christos Stathis
38 ab1eb3f8 Christos Stathis
        /**
39 ab1eb3f8 Christos Stathis
         * The widget's images.
40 ab1eb3f8 Christos Stathis
         */
41 ab1eb3f8 Christos Stathis
        private final Images images;
42 ab1eb3f8 Christos Stathis
43 ab1eb3f8 Christos Stathis
        /**
44 ab1eb3f8 Christos Stathis
         * The image bundle for this widget's images that reuses images defined in
45 ab1eb3f8 Christos Stathis
         * other menus.
46 ab1eb3f8 Christos Stathis
         */
47 ab1eb3f8 Christos Stathis
        public interface Images extends ClientBundle,FileMenu.Images, EditMenu.Images {
48 ab1eb3f8 Christos Stathis
        }
49 ab1eb3f8 Christos Stathis
50 ab1eb3f8 Christos Stathis
        private MenuItem pasteItem;
51 ab1eb3f8 Christos Stathis
52 ab1eb3f8 Christos Stathis
        /**
53 ab1eb3f8 Christos Stathis
         * The widget's constructor.
54 ab1eb3f8 Christos Stathis
         *
55 ab1eb3f8 Christos Stathis
         * @param newImages the image bundle passed on by the parent object
56 ab1eb3f8 Christos Stathis
         */
57 ab1eb3f8 Christos Stathis
        public FolderContextMenu(final Images newImages) {
58 ab1eb3f8 Christos Stathis
                // The popup's constructor's argument is a boolean specifying that it
59 ab1eb3f8 Christos Stathis
                // auto-close itself when the user clicks outside of it.
60 ab1eb3f8 Christos Stathis
                super(true);
61 ab1eb3f8 Christos Stathis
                setAnimationEnabled(true);
62 ab1eb3f8 Christos Stathis
                images = newImages;
63 ab1eb3f8 Christos Stathis
64 ab1eb3f8 Christos Stathis
                pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + "&nbsp;Paste</span>", true, new PasteCommand(this));
65 ab1eb3f8 Christos Stathis
                MenuBar contextMenu = new MenuBar(true);
66 ab1eb3f8 Christos Stathis
                
67 ab1eb3f8 Christos Stathis
                RestResource selectedItem = GSS.get().getTreeView().getSelection();
68 ab1eb3f8 Christos Stathis
69 ab1eb3f8 Christos Stathis
                if(selectedItem != null)
70 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof MyFolderResource){                
71 ab1eb3f8 Christos Stathis
                                MenuItem newFolder = new MenuItem("<span id = 'folderContextMenu.newFolder'>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
72 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(newFolder);
73 ab1eb3f8 Christos Stathis
                                
74 ab1eb3f8 Christos Stathis
                                MenuItem upload = new MenuItem("<span id = 'folderContextMenu.upload'>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
75 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(upload);
76 ab1eb3f8 Christos Stathis
                                                                                        
77 ab1eb3f8 Christos Stathis
                                boolean notRootFolder =(((MyFolderResource) selectedItem).getResource()).getParentURI() != null ? true : false;        
78 ab1eb3f8 Christos Stathis
                                if (notRootFolder) {
79 ab1eb3f8 Christos Stathis
                                        // do not show the copy & cut option for the user's root folder                                        
80 ab1eb3f8 Christos Stathis
                                        MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(this));
81 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem(cut);
82 ab1eb3f8 Christos Stathis
                                        
83 ab1eb3f8 Christos Stathis
                                }
84 ab1eb3f8 Christos Stathis
                                MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(this));                                        
85 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(copy);
86 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(pasteItem);
87 ab1eb3f8 Christos Stathis
                                if (notRootFolder) {
88 ab1eb3f8 Christos Stathis
                                        // do not show delete options for the user's root folder
89 ab1eb3f8 Christos Stathis
                                        MenuItem moveToTrash = new MenuItem("<span id = 'folderContextMenu.moveToTrash'>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(this));                                        
90 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem(moveToTrash);
91 ab1eb3f8 Christos Stathis
                                        
92 ab1eb3f8 Christos Stathis
                                        MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
93 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem(delete);                                        
94 ab1eb3f8 Christos Stathis
                                }
95 ab1eb3f8 Christos Stathis
                                
96 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
97 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
98 ab1eb3f8 Christos Stathis
                                
99 ab1eb3f8 Christos Stathis
                                MenuItem sharing = new MenuItem("<span id = 'folderContextMenu.sharing'>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
100 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(sharing);
101 ab1eb3f8 Christos Stathis
                                
102 ab1eb3f8 Christos Stathis
                                MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, newImages, 0));
103 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(properties);                
104 ab1eb3f8 Christos Stathis
                        }
105 ab1eb3f8 Christos Stathis
                
106 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof SharedFolderResource){
107 ab1eb3f8 Christos Stathis
                                MenuItem newFolder = new MenuItem("<span id = 'folderContextMenu.newFolder'>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
108 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(newFolder);
109 ab1eb3f8 Christos Stathis
                                
110 ab1eb3f8 Christos Stathis
                                MenuItem upload = new MenuItem("<span id = 'folderContextMenu.upload'>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
111 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(upload);
112 ab1eb3f8 Christos Stathis
                                
113 ab1eb3f8 Christos Stathis
                                MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(this));
114 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(cut);
115 ab1eb3f8 Christos Stathis
                                
116 ab1eb3f8 Christos Stathis
                                MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(this));
117 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(copy);
118 ab1eb3f8 Christos Stathis
                                
119 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(pasteItem);
120 ab1eb3f8 Christos Stathis
                                
121 ab1eb3f8 Christos Stathis
                                MenuItem moveToTrash = new MenuItem("<span id = 'folderContextMenu.moveToTrash'>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(this));
122 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(moveToTrash);
123 ab1eb3f8 Christos Stathis
                                
124 ab1eb3f8 Christos Stathis
                                MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
125 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(delete);
126 ab1eb3f8 Christos Stathis
127 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
128 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
129 ab1eb3f8 Christos Stathis
                                
130 ab1eb3f8 Christos Stathis
                                MenuItem sharing = new MenuItem("<span id = 'folderContextMenu.sharing'>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
131 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(sharing);
132 ab1eb3f8 Christos Stathis
                                
133 ab1eb3f8 Christos Stathis
                                MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, newImages, 0));
134 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(properties);
135 ab1eb3f8 Christos Stathis
                                
136 ab1eb3f8 Christos Stathis
                        }
137 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof TrashFolderResource){
138 ab1eb3f8 Christos Stathis
                                MenuItem restore = new MenuItem("<span id = 'folderContextMenu.restore'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Restore folder and contents</span>", true, new RestoreTrashCommand(this));
139 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(restore);
140 ab1eb3f8 Christos Stathis
                                
141 ab1eb3f8 Christos Stathis
                                MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
142 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(delete);
143 ab1eb3f8 Christos Stathis
                                
144 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
145 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
146 ab1eb3f8 Christos Stathis
                                
147 ab1eb3f8 Christos Stathis
                        }
148 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof OthersFolderResource){                                
149 ab1eb3f8 Christos Stathis
                                MenuItem newFolder = new MenuItem("<span id = 'folderContextMenu.newFolder'>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
150 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(newFolder);
151 ab1eb3f8 Christos Stathis
152 ab1eb3f8 Christos Stathis
                                MenuItem upload = new MenuItem("<span id ='folderContextMenu.upload'>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
153 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(upload);
154 ab1eb3f8 Christos Stathis
                                
155 ab1eb3f8 Christos Stathis
                                MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(this));
156 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(cut);
157 ab1eb3f8 Christos Stathis
                                
158 ab1eb3f8 Christos Stathis
                                MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(this));
159 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(copy);
160 ab1eb3f8 Christos Stathis
                                
161 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(pasteItem);
162 ab1eb3f8 Christos Stathis
                                
163 ab1eb3f8 Christos Stathis
                                MenuItem moveToTrash = new MenuItem("<span id = 'folderContextMenu.moveToTrash'>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(this));
164 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(moveToTrash);
165 ab1eb3f8 Christos Stathis
                                
166 ab1eb3f8 Christos Stathis
                                MenuItem delete = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
167 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(delete);
168 ab1eb3f8 Christos Stathis
169 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.delete'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
170 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
171 ab1eb3f8 Christos Stathis
                                
172 ab1eb3f8 Christos Stathis
                                MenuItem sharing = new MenuItem("<span id = 'folderContextMenu.sharing'>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
173 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(sharing);
174 ab1eb3f8 Christos Stathis
                                
175 ab1eb3f8 Christos Stathis
                                MenuItem properties = new MenuItem("<span id = 'folderContextMenu.properties'>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, newImages, 0));
176 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(properties);
177 ab1eb3f8 Christos Stathis
                                
178 ab1eb3f8 Christos Stathis
                        }
179 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof TrashResource){
180 ab1eb3f8 Christos Stathis
                                MenuItem restore = new MenuItem("<span id ='folderContextMenu.restore'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Restore Trash</span>", true, new RestoreTrashCommand(this));
181 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(restore);
182 ab1eb3f8 Christos Stathis
                                
183 ab1eb3f8 Christos Stathis
                                MenuItem emptyTrash = new MenuItem("<span id = 'folderContextMenu.emptyTrash'>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Empty Trash</span>", true, new EmptyTrashCommand(this));
184 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(emptyTrash);
185 ab1eb3f8 Christos Stathis
                                
186 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
187 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
188 ab1eb3f8 Christos Stathis
                                
189 ab1eb3f8 Christos Stathis
                        }
190 ab1eb3f8 Christos Stathis
                        if(selectedItem instanceof SharedResource || selectedItem instanceof OthersResource || selectedItem instanceof OtherUserResource){
191 ab1eb3f8 Christos Stathis
                                MenuItem refresh = new MenuItem("<span id = 'folderContextMenu.refresh'>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
192 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(refresh);
193 ab1eb3f8 Christos Stathis
                                
194 ab1eb3f8 Christos Stathis
                        }
195 ab1eb3f8 Christos Stathis
                        
196 ab1eb3f8 Christos Stathis
                        /*
197 ab1eb3f8 Christos Stathis
                        if(folders.isTrashItem(selectedItem)){
198 ab1eb3f8 Christos Stathis
                                if (folders.isTrash(selectedItem)){
199 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Empty Trash</span>", true, new EmptyTrashCommand(this));
200 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
201 ab1eb3f8 Christos Stathis
                                }
202 ab1eb3f8 Christos Stathis
                                else {
203 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Restore folder and contents</span>", true, new RestoreTrashCommand(this));
204 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
205 ab1eb3f8 Christos Stathis
                                        contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
206 ab1eb3f8 Christos Stathis
                                }
207 ab1eb3f8 Christos Stathis
                        }
208 ab1eb3f8 Christos Stathis
                        else if(folders.isFileItem(selectedItem)){
209 ab1eb3f8 Christos Stathis
                                
210 ab1eb3f8 Christos Stathis
                        }
211 ab1eb3f8 Christos Stathis
                        else if(!folders.isMyShares(selectedItem) && folders.isMySharedItem(selectedItem)){
212 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
213 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
214 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(this));
215 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(this));
216 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(pasteItem);
217 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(this));
218 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
219 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
220 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
221 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, newImages, 0));
222 ab1eb3f8 Christos Stathis
                        }
223 ab1eb3f8 Christos Stathis
                        else if(!folders.isOthersShared(selectedItem) && folders.isOthersSharedItem(selectedItem) && !(GSS.get().getCurrentSelection() instanceof OtherUserResource)){
224 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.folderNew()).getHTML() + "&nbsp;New Folder</span>", true, new NewFolderCommand(this, images));
225 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + "&nbsp;Upload</span>", true, new UploadFileCommand(this));
226 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Cut</span>", true, new CutCommand(this));
227 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + "&nbsp;Copy</span>", true, new CopyCommand(this));
228 ab1eb3f8 Christos Stathis
                                contextMenu.addItem(pasteItem);
229 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + "&nbsp;Move to Trash</span>", true, new ToTrashCommand(this));
230 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + "&nbsp;Delete</span>", true, new DeleteCommand(this, newImages));
231 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
232 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + "&nbsp;Sharing</span>", true, new PropertiesCommand(this, newImages, 1));
233 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + "&nbsp;Properties</span>", true, new PropertiesCommand(this, newImages, 0));
234 ab1eb3f8 Christos Stathis
                        } else if(!selectedItem.equals(folders.getSharesItem()))
235 ab1eb3f8 Christos Stathis
                                contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + "&nbsp;Refresh</span>", true, new RefreshCommand(this, images));
236 ab1eb3f8 Christos Stathis
                        */
237 ab1eb3f8 Christos Stathis
                
238 ab1eb3f8 Christos Stathis
                add(contextMenu);
239 ab1eb3f8 Christos Stathis
                if (GSS.get().getClipboard().hasFolderOrFileItem())
240 ab1eb3f8 Christos Stathis
                        pasteItem.setVisible(true);
241 ab1eb3f8 Christos Stathis
                else
242 ab1eb3f8 Christos Stathis
                        pasteItem.setVisible(false);
243 ab1eb3f8 Christos Stathis
        }
244 ab1eb3f8 Christos Stathis
245 ab1eb3f8 Christos Stathis
}