public class RemoveFileCommand extends Command
RemoveFileCommand class implements the command to delete
the file(s) that are associated with the selected element(s) from their
container. To remove the files from disk, see RemoveFromDiskCommand.Command| Constructor and Description |
|---|
RemoveFileCommand()
Constructor.
|
RemoveFileCommand(int cmdId,
int type) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
buildFileNamesString(java.util.List elementList)
Build a list of file names
|
protected boolean |
canRemove(Element element,
Folder ownerFolder)
Returns true if the specified
ownerFolder allows
the element to be removed. |
protected boolean |
canRemove(TNode[] tnodes,
Folder ownerFolder,
java.util.List removedFiles,
java.util.List unremovedFiles)
Returns
true if the ownerFolder allows
the elements encapsulated by the specified tnodes
to be removed. |
protected UpdateMessage |
createUpdateMessage()
Creates an
UpdateMessage whose ID is
UpdateMessage.CHILD_REMOVED and stores the
command ID as a user property. |
int |
doit()
Presents the user with the selected list of element files to delete
from disk using SelectFilesPanel.showDialog().
|
Node[] |
getAffectedNodes()
This method should return an array of Nodes affected by the execution
of this command.
|
protected boolean |
isNeedConfirmClose() |
protected int |
remove(java.util.List files,
Folder owner,
boolean close) |
protected int |
remove(java.util.List files,
Folder owner,
boolean close,
java.util.List output)
Remove the list of
files from their folder owner. |
protected boolean |
remove(Node node,
Folder owner)
Removes
element from owner. |
enableConfirmation, getContext, getData, getId, getName, getProgressHandle, getType, isGlobal, setContext, setData, setTaskInfo, undopublic RemoveFileCommand()
public RemoveFileCommand(int cmdId,
int type)
public int doit()
throws java.lang.Exception
public Node[] getAffectedNodes()
CommandgetAffectedNodes in class Commandprotected int remove(java.util.List files,
Folder owner,
boolean close)
protected int remove(java.util.List files,
Folder owner,
boolean close,
java.util.List output)
files from their folder owner.
If the close parameter is true, the files
are closed before they are removed from their owner.
Files that could not be removed are added to the output
list.protected UpdateMessage createUpdateMessage()
UpdateMessage whose ID is
UpdateMessage.CHILD_REMOVED and stores the
command ID as a user property.UpdateMessage whose ID is
UpdateMessage.CHILD_REMOVED.UpdateMessage.CHILD_REMOVEDprotected boolean remove(Node node, Folder owner)
element from owner.false if the element could not be removed.protected java.lang.String buildFileNamesString(java.util.List elementList)
protected boolean canRemove(Element element, Folder ownerFolder)
ownerFolder allows
the element to be removed.
Precondition: element cannot be null.protected boolean canRemove(TNode[] tnodes, Folder ownerFolder, java.util.List removedFiles, java.util.List unremovedFiles)
true if the ownerFolder allows
the elements encapsulated by the specified tnodes
to be removed. The elements that can be reomved are listed
in the removeFiles list while the ones that cannot
be removed are listed in the unremovedFiles list.
Precondition: none of the given parameters can be null.protected boolean isNeedConfirmClose()
true if the user should be prompted to save
dirty nodes prior to removing them. This allows suppression of
the 'Save Files' dialog when the files are about to be removed
from disk altogether.