public void showFileList(RestResource r, boolean clearSelection) { RestResource currentFolder = r; if (currentFolder != null) { List<FileResource> files = null; if (currentFolder instanceof RestResourceWrapper) { RestResourceWrapper folder = (RestResourceWrapper) currentFolder; files = folder.getResource().getFiles(); } else if (currentFolder instanceof TrashResource) { TrashResource folder = (TrashResource) currentFolder; files = folder.getFiles(); } else if (currentFolder instanceof SharedResource) { SharedResource folder = (SharedResource) currentFolder; files = folder.getFiles(); } else if (currentFolder instanceof OtherUserResource) { OtherUserResource folder = (OtherUserResource) currentFolder; files = folder.getFiles(); } if (files != null) getFileList().setFiles(files); else getFileList().setFiles(new ArrayList<FileResource>()); } fileList.updateFileCache(clearSelection /*clear selection*/); inner.selectTab(0); }