Revision f55cf326 web_client/src/gr/grnet/pithos/web/client/DnDFolderPopupMenu.java

b/web_client/src/gr/grnet/pithos/web/client/DnDFolderPopupMenu.java
39 39
import gr.grnet.pithos.web.client.rest.MultiplePostCommand;
40 40
import gr.grnet.pithos.web.client.rest.PostCommand;
41 41
import gr.grnet.pithos.web.client.rest.RestException;
42
import gr.grnet.pithos.web.client.rest.resource.FileResource;
43 42
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
44 43
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
45 44

  
......
47 46
import java.util.List;
48 47

  
49 48
import com.google.gwt.core.client.GWT;
50
import com.google.gwt.http.client.URL;
51 49
import com.google.gwt.user.client.Command;
52 50
import com.google.gwt.user.client.DeferredCommand;
53 51
import com.google.gwt.user.client.ui.AbstractImagePrototype;
......
71 69
        };
72 70

  
73 71
        final MenuBar contextMenu = new MenuBar(true);
74
        final CellTreeView folders = GSS.get().getTreeView();
72
        final CellTreeView folders = Pithos.get().getTreeView();
75 73

  
76 74
        contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + "&nbsp;Move</span>", true, new Command() {
77 75

  
......
81 79
                    moveFolder(target, (Folder) toCopy);
82 80
                }
83 81
                else if (toCopy instanceof List) {
84
                    List<File> files = GSS.get().getFileList().getSelectedFiles();
82
                    List<File> files = Pithos.get().getFileList().getSelectedFiles();
85 83
                    moveFiles(target, files);
86 84
                }
87 85
                hide();
......
95 93
                if (toCopy instanceof Folder)
96 94
                    copyFolder(target, (Folder) toCopy);
97 95
                else if (toCopy instanceof List) {
98
                    List<File> files = GSS.get().getFileList().getSelectedFiles();
96
                    List<File> files = Pithos.get().getFileList().getSelectedFiles();
99 97
                    copyFiles(target, files);
100 98
                }
101 99
                hide();
......
111 109
                    trashFolder(((RestResourceWrapper) toCopy).getResource());
112 110
                }
113 111
                else if (toCopy instanceof List) {
114
                    List<File> files = GSS.get().getFileList().getSelectedFiles();
112
                    List<File> files = Pithos.get().getFileList().getSelectedFiles();
115 113
                    trashFiles(files);
116 114
                }
117 115
                hide();
......
130 128
//
131 129
//            @Override
132 130
//            public void onComplete() {
133
//                GSS.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
134
//                GSS.get().getStatusPanel().updateStats();
131
//                Pithos.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
132
//                Pithos.get().getStatusPanel().updateStats();
135 133
//            }
136 134
//
137 135
//            @Override
......
140 138
//                if (t instanceof RestException) {
141 139
//                    int statusCode = ((RestException) t).getHttpStatusCode();
142 140
//                    if (statusCode == 405)
143
//                        GSS.get().displayError("You don't have the necessary permissions");
141
//                        Pithos.get().displayError("You don't have the necessary permissions");
144 142
//
145 143
//                    else if (statusCode == 409)
146
//                        GSS.get().displayError("A folder with the same name already exists");
144
//                        Pithos.get().displayError("A folder with the same name already exists");
147 145
//                    else if (statusCode == 413)
148
//                        GSS.get().displayError("Your quota has been exceeded");
146
//                        Pithos.get().displayError("Your quota has been exceeded");
149 147
//                    else
150
//                        GSS.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
148
//                        Pithos.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
151 149
//                }
152 150
//                else
153
//                    GSS.get().displayError("System error copying folder:" + t.getMessage());
151
//                    Pithos.get().displayError("System error copying folder:" + t.getMessage());
154 152
//            }
155 153
//        };
156 154
//        DeferredCommand.addCommand(cf);
......
166 164
//            @Override
167 165
//            public void onComplete() {
168 166
//                GWT.log("[MOVE]" + target.getUri() + "   " + toCopy.getParentURI());
169
//                GSS.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
170
//                GSS.get().getTreeView().updateNodeChildrenForRemove(toCopy.getParentURI());
171
//                GSS.get().getStatusPanel().updateStats();
167
//                Pithos.get().getTreeView().updateNodeChildren(new RestResourceWrapper(target));
168
//                Pithos.get().getTreeView().updateNodeChildrenForRemove(toCopy.getParentURI());
169
//                Pithos.get().getStatusPanel().updateStats();
172 170
//            }
173 171
//
174 172
//            @Override
......
177 175
//                if (t instanceof RestException) {
178 176
//                    int statusCode = ((RestException) t).getHttpStatusCode();
179 177
//                    if (statusCode == 405)
180
//                        GSS.get().displayError("You don't have the necessary permissions");
178
//                        Pithos.get().displayError("You don't have the necessary permissions");
181 179
//
182 180
//                    else if (statusCode == 409)
183
//                        GSS.get().displayError("A folder with the same name already exists");
181
//                        Pithos.get().displayError("A folder with the same name already exists");
184 182
//                    else if (statusCode == 413)
185
//                        GSS.get().displayError("Your quota has been exceeded");
183
//                        Pithos.get().displayError("Your quota has been exceeded");
186 184
//                    else
187
//                        GSS.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
185
//                        Pithos.get().displayError("Unable to copy folder:" + ((RestException) t).getHttpStatusText());
188 186
//                }
189 187
//                else
190
//                    GSS.get().displayError("System error copying folder:" + t.getMessage());
188
//                    Pithos.get().displayError("System error copying folder:" + t.getMessage());
191 189
//            }
192 190
//        };
193 191
//        DeferredCommand.addCommand(cf);
......
222 220

  
223 221
            @Override
224 222
            public void onComplete() {
225
                GSS.get().getTreeView().updateNodeChildrenForRemove(folder.getParentURI());
226
                GSS.get().getTreeView().updateTrashNode();
223
                Pithos.get().getTreeView().updateNodeChildrenForRemove(folder.getParentURI());
224
                Pithos.get().getTreeView().updateTrashNode();
227 225
                /*for(TreeItem item : items)
228
                        GSS.get().getFolders().updateFolder((DnDTreeItem) item);
229
                GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
226
                        Pithos.get().getFolders().updateFolder((DnDTreeItem) item);
227
                Pithos.get().getFolders().update(Pithos.get().getFolders().getTrashItem());
230 228

  
231
                GSS.get().showFileList(true);
229
                Pithos.get().showFileList(true);
232 230
                */
233 231
            }
234 232

  
......
238 236
                if (t instanceof RestException) {
239 237
                    int statusCode = ((RestException) t).getHttpStatusCode();
240 238
                    if (statusCode == 405)
241
                        GSS.get().displayError("You don't have the necessary permissions");
239
                        Pithos.get().displayError("You don't have the necessary permissions");
242 240
                    else if (statusCode == 404)
243
                        GSS.get().displayError("Folder does not exist");
241
                        Pithos.get().displayError("Folder does not exist");
244 242
                    else
245
                        GSS.get().displayError("Unable to trash folder:" + ((RestException) t).getHttpStatusText());
243
                        Pithos.get().displayError("Unable to trash folder:" + ((RestException) t).getHttpStatusText());
246 244
                }
247 245
                else
248
                    GSS.get().displayError("System error trashing folder:" + t.getMessage());
246
                    Pithos.get().displayError("System error trashing folder:" + t.getMessage());
249 247
            }
250 248
        };
251 249
        DeferredCommand.addCommand(tot);
......
259 257

  
260 258
            @Override
261 259
            public void onComplete() {
262
                GSS.get().showFileList(true);
260
                Pithos.get().showFileList(true);
263 261
            }
264 262

  
265 263
            @Override
......
268 266
                if (t instanceof RestException) {
269 267
                    int statusCode = ((RestException) t).getHttpStatusCode();
270 268
                    if (statusCode == 405)
271
                        GSS.get().displayError("You don't have the necessary permissions");
269
                        Pithos.get().displayError("You don't have the necessary permissions");
272 270
                    else if (statusCode == 404)
273
                        GSS.get().displayError("File does not exist");
271
                        Pithos.get().displayError("File does not exist");
274 272
                    else
275
                        GSS.get().displayError("Unable to trash file:" + ((RestException) t).getHttpStatusText());
273
                        Pithos.get().displayError("Unable to trash file:" + ((RestException) t).getHttpStatusText());
276 274
                }
277 275
                else
278
                    GSS.get().displayError("System error trashing file:" + t.getMessage());
276
                    Pithos.get().displayError("System error trashing file:" + t.getMessage());
279 277
            }
280 278
        };
281 279
        DeferredCommand.addCommand(tot);
......
283 281

  
284 282
    private void executeCopyOrMoveFiles(final int index, final List<String> paths) {
285 283
        if (index >= paths.size()) {
286
            GSS.get().showFileList(true);
287
            GSS.get().getStatusPanel().updateStats();
284
            Pithos.get().showFileList(true);
285
            Pithos.get().getStatusPanel().updateStats();
288 286
            return;
289 287
        }
290 288
        PostCommand cf = new PostCommand(paths.get(index), "", 200) {
......
300 298
                if (t instanceof RestException) {
301 299
                    int statusCode = ((RestException) t).getHttpStatusCode();
302 300
                    if (statusCode == 405)
303
                        GSS.get().displayError("You don't have the necessary permissions");
301
                        Pithos.get().displayError("You don't have the necessary permissions");
304 302
                    else if (statusCode == 404)
305
                        GSS.get().displayError("File not found");
303
                        Pithos.get().displayError("File not found");
306 304
                    else if (statusCode == 409)
307
                        GSS.get().displayError("A file with the same name already exists");
305
                        Pithos.get().displayError("A file with the same name already exists");
308 306
                    else if (statusCode == 413)
309
                        GSS.get().displayError("Your quota has been exceeded");
307
                        Pithos.get().displayError("Your quota has been exceeded");
310 308
                    else
311
                        GSS.get().displayError("Unable to copy file:" + ((RestException) t).getHttpStatusText());
309
                        Pithos.get().displayError("Unable to copy file:" + ((RestException) t).getHttpStatusText());
312 310
                }
313 311
                else
314
                    GSS.get().displayError("System error copying file:" + t.getMessage());
312
                    Pithos.get().displayError("System error copying file:" + t.getMessage());
315 313
            }
316 314
        };
317 315
        DeferredCommand.addCommand(cf);

Also available in: Unified diff