public class FileClipboard extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
FileClipboard.FileClipboardSource |
Modifier and Type | Field and Description |
---|---|
boolean |
isCut |
FileClipboard.FileClipboardSource |
source |
File |
sourceDir |
String[] |
sourceFiles |
Constructor and Description |
---|
FileClipboard() |
Modifier and Type | Method and Description |
---|---|
boolean |
canPasteInto(File folder) |
void |
clear() |
protected void |
clear(int message) |
Handle[] |
copyTo(File dest,
boolean copyDirectoryChildren)
This method prepares to do a Copy/Paste operation that
will run in a separate Thread, copying the source
files to the destination and deleting them from the source IF the
"isCut" field is true.
|
Handle |
delete(boolean deleteDirectoryChildren)
This method prepares to do a delete operation that
will run in a separate Thread, deleting the source
files.
|
boolean |
hasDirectories()
This will return true if the source file list contains directories.
|
boolean |
hasFiles() |
boolean |
isCut(File parent,
String file)
See if the specified file is in the list and is considered
"cut".
|
boolean |
isInClipboard(File parent,
String file)
See if the specified file is in the list.
|
void |
set(File sourceDir,
String[] sourceFiles,
boolean isCut,
FileClipboard.FileClipboardSource source) |
void |
taken() |
public File sourceDir
public String[] sourceFiles
public boolean isCut
public FileClipboard.FileClipboardSource source
public void set(File sourceDir, String[] sourceFiles, boolean isCut, FileClipboard.FileClipboardSource source)
public boolean hasDirectories()
public boolean isInClipboard(File parent, String file)
parent
- the parent file.file
- the named file.public boolean isCut(File parent, String file)
parent
- the parent file.file
- the named file.public boolean hasFiles()
public void taken()
public void clear()
protected void clear(int message)
public boolean canPasteInto(File folder)
public Handle[] copyTo(File dest, boolean copyDirectoryChildren)
The method returns an array of two Handles. The Handle at index 0 is the main progress handle. You must call start() on that Handle to begin the operation. You should then monitor the state of that Handle. When the Stopped bit is set the operation is complete.
The Handle at index 1 indicates the progress of each individual file as they are copied.
During the operation, if any error occurs the continueAfterError() method is called on the FileClipboardSource Object set as the "source" field. If that method returns true then the operation continues on the next file. If that method returns false OR if the "source" field is null the operation will fail with an IOException.
dest
- the destination directory.copyDirectoryChildren
- if this is true then the files in any
directories are also copied. If it is false only the directory are
created in the destination, but no child files are copied.public Handle delete(boolean deleteDirectoryChildren)
The method returns a Handle. You must call start() on that Handle to begin the operation. You should then monitor the state of that Handle. When the Stopped bit is set the operation is complete.
During the operation, if any error occurs the continueAfterError() method is called on the FileClipboardSource Object set as the "source" field. If that method returns true then the operation continues on the next file. If that method returns false OR if the "source" field is null the operation will fail with an IOException.
deleteDirectoryChildren
- if this is true then the files in any
directories are also delete. If it is false then the directories will
be deleted if they are empty only.