|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.desktop.AbstractTrash
com.mucommander.desktop.QueuedTrash
com.mucommander.desktop.osx.OSXTrash
public class OSXTrash
OSXTrash provides access to the Mac OS X Finder's trash. Only local files (or locally mounted files) can be moved to the trash.
Implementation notes:
This trash is implemented as a QueuedTrash for several reasons:
AppleScript to interact with the trash.
OSXTrashProvider| Field Summary |
|---|
| Fields inherited from class com.mucommander.desktop.QueuedTrash |
|---|
moveToTrashLock, moveToTrashThread, QUEUE_PERIOD |
| Constructor Summary | |
|---|---|
OSXTrash()
|
|
| Method Summary | |
|---|---|
boolean |
canEmpty()
Implementation notes: always returns true. |
boolean |
canMoveToTrash(AbstractFile file)
Implementation notes: returns true only for local files that are not archive entries. |
boolean |
canOpen()
Implementation notes: always returns true. |
boolean |
empty()
Attempts to empty this trash and returns true if it was successfully emptied. |
int |
getItemCount()
Implementation notes: this method is implemented and returns -1 only if an error ocurred while
retrieving the trash item count. |
boolean |
isTrashFile(AbstractFile file)
Returns true if the given file is a trash folder, or one of its children. |
protected boolean |
moveToTrash(java.util.Vector queuedFiles)
Performs the actual job of moving files to the trash using AppleScript. |
void |
open()
Opens the trash in the default file manager of the current OS/Desktop manager. |
| Methods inherited from class com.mucommander.desktop.QueuedTrash |
|---|
moveToTrash, waitForPendingOperations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OSXTrash()
| Method Detail |
|---|
public boolean canMoveToTrash(AbstractFile file)
true only for local files that are not archive entries.
canMoveToTrash in class AbstractTrashfile - the file to test
public boolean canEmpty()
true.
canEmpty in class AbstractTrashpublic boolean empty()
AbstractTrashtrue if it was successfully emptied.
empty in class AbstractTrashpublic boolean isTrashFile(AbstractFile file)
AbstractTrashtrue if the given file is a trash folder, or one of its children.
For example, if /home/someuser/.Trash is a trash folder, calling this method with:
/home/someuser/.Trash will return true
/home/someuser/.Trash/somefolder/somefile will return true
/home/someuser/Desktop will return false
Note that this method does not check the existence of the given file, the test is solely based on the file's path.
isTrashFile in class AbstractTrashfile - the file to test
public int getItemCount()
-1 only if an error ocurred while
retrieving the trash item count.
getItemCount in class AbstractTrash-1 if this information is not availablepublic void open()
AbstractTrash
open in class AbstractTrashpublic boolean canOpen()
true.
canOpen in class AbstractTrashprotected boolean moveToTrash(java.util.Vector queuedFiles)
The thread starts by waiting QueuedTrash.QUEUE_PERIOD milliseconds before moving them to give additional
files a chance to be queued and regrouped as a single AppleScript call. If some files were queued during
that period, the thread will wait an additional QueuedTrash.QUEUE_PERIOD, and so on.
There are several reasons for doing that instead of executing an AppleScript synchroneously for each file
passed to QueuedTrash.moveToTrash(com.mucommander.file.AbstractFile) :
moveToTrash in class QueuedTrashqueuedFiles - a Vector of AbstractFile to move to the trash
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard