/** * Resolves the user Trash folder and its "info" and "files" subfolders once and for all. The * trash folder is created if it doesn't already exist. */ static { TRASH_FOLDER = getTrashFolder(); if (TRASH_FOLDER != null) { TRASH_INFO_SUBFOLDER = TRASH_FOLDER.getChildSilently("info"); TRASH_FILES_SUBFOLDER = TRASH_FOLDER.getChildSilently("files"); TRASH_VOLUME = TRASH_FOLDER.getVolume(); } else { TRASH_INFO_SUBFOLDER = null; TRASH_FILES_SUBFOLDER = null; TRASH_VOLUME = null; } }
@Override public AbstractFile getVolume() { return file.getVolume(); }
/** * Implementation notes: returns <code>true</code> only for local files that are not archive * entries and that reside on the same volume as the trash folder. */ @Override public boolean canMoveToTrash(AbstractFile file) { return TRASH_FOLDER != null && file.getTopAncestor() instanceof LocalFile && file.getVolume().equals(TRASH_VOLUME); }