com.mucommander.desktop.windows
Class WindowsTrash

java.lang.Object
  extended by com.mucommander.desktop.AbstractTrash
      extended by com.mucommander.desktop.QueuedTrash
          extended by com.mucommander.desktop.windows.WindowsTrash

public class WindowsTrash
extends QueuedTrash

WindowsTrash is an AbstractTrash implementation for the Microsoft Windows' Recycle Bin.

Native methods in the Shell32 Windows API are used to access the Recycle Bin. There is an overhead associated with invoking those methods (via JNA), so for performance reasons, this trash is implemented as a QueuedTrash in order to group calls to QueuedTrash.moveToTrash(com.mucommander.file.AbstractFile).

Author:
Maxence Bernard
See Also:
WindowsTrashProvider

Field Summary
 
Fields inherited from class com.mucommander.desktop.QueuedTrash
moveToTrashLock, moveToTrashThread, QUEUE_PERIOD
 
Constructor Summary
WindowsTrash()
           
 
Method Summary
 boolean canEmpty()
          Implementation notes: always returns true: empty() is implemented.
 boolean canMoveToTrash(AbstractFile file)
          Implementation notes: returns true only for local files that are not archive entries.
 boolean canOpen()
          Implementation notes: always returns true: open() is implemented.
 boolean empty()
          Attempts to empty this trash and returns true if it was successfully emptied.
 int getItemCount()
          Implementation notes: returns the number of items for all Recycle Bins on all drives.
 boolean isTrashFile(AbstractFile file)
          Implementation notes: always returns false.
protected  boolean moveToTrash(java.util.Vector queuedFiles)
          Moves the AbstractFile instances contained in the given Vector to the trash.
 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

WindowsTrash

public WindowsTrash()
Method Detail

canMoveToTrash

public boolean canMoveToTrash(AbstractFile file)
Implementation notes: returns true only for local files that are not archive entries.

Specified by:
canMoveToTrash in class AbstractTrash
Parameters:
file - the file to test
Returns:
true if the given file can be moved to the trash

canEmpty

public boolean canEmpty()
Implementation notes: always returns true: empty() is implemented.

Specified by:
canEmpty in class AbstractTrash
Returns:
true if the trash can be emptied.

empty

public boolean empty()
Description copied from class: AbstractTrash
Attempts to empty this trash and returns true if it was successfully emptied.

Specified by:
empty in class AbstractTrash
Returns:
true if the trash was successfully emptied

isTrashFile

public boolean isTrashFile(AbstractFile file)
Implementation notes: always returns false.

Specified by:
isTrashFile in class AbstractTrash
Parameters:
file - the file to test
Returns:
true if the given file is a trash folder, or one of its children.

getItemCount

public int getItemCount()
Implementation notes: returns the number of items for all Recycle Bins on all drives. This information is not available on certain versions of Windows such as Windows 2000.

Specified by:
getItemCount in class AbstractTrash
Returns:
the number of items that currently are in this trash, -1 if this information is not available

canOpen

public boolean canOpen()
Implementation notes: always returns true: open() is implemented.

Specified by:
canOpen in class AbstractTrash
Returns:
true if this trash can be opened in the default file manager of the current OS/Desktop manager.

open

public void open()
Description copied from class: AbstractTrash
Opens the trash in the default file manager of the current OS/Desktop manager.

Specified by:
open in class AbstractTrash

moveToTrash

protected boolean moveToTrash(java.util.Vector queuedFiles)
Description copied from class: QueuedTrash
Moves the AbstractFile instances contained in the given Vector to the trash. Returns true if all files were moved successfully.

Specified by:
moveToTrash in class QueuedTrash
Parameters:
queuedFiles - a Vector of AbstractFile to move to the trash
Returns:
true if all files were moved successfully


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard