- if(treeitem.getUserObject() instanceof FolderResource){
- FolderResource currentObject = (FolderResource) treeitem.getUserObject();
- GWT.log("currentObject.toString() ='"+currentObject.toString() +"'");
- GWT.log("currentObject.getParentURI() ='"+currentObject.getParentURI()+"'");
- if(currentObject.getParentURI() == null){
- if(containsFolder(treeitem, "Trash")){
-// case: selected folders below Trash folder
- String partialUri = constructPartialPath(treeitem);
- name = name +"Files/trash/" + partialUri;
- GWT.log("name = '"+name+"'");
- } else{
-// case: home folders are selected
- name = name + "Files/files/" + currentObject.getName();
- GWT.log("name = '"+name+"'");
- }
- }
- else if(treeitem.getParentItem() == null){
-// this is the case when the user uses the browser's forward arrow to navigate through other's
-// shared folders and item.getParentItem is null only inside other's shared folder
- String apiPath = GSS.get().getApiPath();
- String newPath = currentObject.getParentURI().substring(apiPath.lastIndexOf("/"));
- name = name + "Files"+ newPath + currentObject.getName();
- GWT.log("name = '"+name+"'");
- }
- else if(containsFolder(treeitem, "My Shared")){
-// case: selected folders below My Shared folder
- String partialUri = constructPartialPath(treeitem);
- name = name + "Files/shared/" + partialUri;
- GWT.log("name = '"+name+"'");
- }else if(containsFolder(treeitem, "Other's Shared")){
-// case: selected folders below Other's Shared folder
- String partialPath = constructPartialPath(treeitem);
- name = name + "Files/others/"+ partialPath;
- GWT.log("name = '"+name+"'");
- }
- else{
-// case:all folders in user's folders tree
- String finalUri = currentObject.getParentURI().substring(path.lastIndexOf("/")) + currentObject.getName();
- name = name + "Files"+ finalUri;
- GWT.log("name = '"+name+"'");
- }