Extension SDK 10.1.2

oracle.ide.cmd
Class RemoveFileCommand

java.lang.Object
  extended byoracle.ide.addin.AbstractCommand
      extended byoracle.ide.cmd.RemoveFileCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
RemoveFromDiskCommand

public class RemoveFileCommand
extends AbstractCommand

The RemoveFileCommand class implements the command to delete the file(s) on disk that are associated with the selected element(s).

See Also:
Command, AbstractCommand

Field Summary
 
Fields inherited from class oracle.ide.addin.AbstractCommand
cmdId, context, name, type
 
Fields inherited from interface oracle.ide.addin.Command
CANCEL, EXECUTING, NO_CHANGE, NO_UNDO, NORMAL, OK
 
Constructor Summary
RemoveFileCommand()
          Constructor.
RemoveFileCommand(int cmdId, int type)
           
 
Method Summary
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 oracle.ide.addin.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().
protected  Folder findOwner(TNode[] tnodes, Context context)
          Find the owner of the given tnode.
protected  Folder findOwner(TNode tnode, Context context)
          Find the owner of the given tnode.
 Document[] getAffectedDocuments()
          For commands of the NORMAL and NO_UNDO this method should return an array of documents affected by the execution of this command.
protected  boolean remove(Document element, Folder owner)
          Removes element from owner.
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.
 
Methods inherited from class oracle.ide.addin.AbstractCommand
getContext, getData, getId, getName, getType, setContext, setData, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoveFileCommand

public RemoveFileCommand()
Constructor.


RemoveFileCommand

public RemoveFileCommand(int cmdId,
                         int type)
Method Detail

doit

public int doit()
         throws java.lang.Exception
Presents the user with the selected list of element files to delete from disk using SelectFilesPanel.showDialog(). Any files selected by the user are then removed from their containing folders and deleted from disk. Note that although the Action associated with this command is enabled (otherwise we should never get here), it has been enabled with a quick check version of canRemove() called on each selected element's folder. A more thorough version of canRemove() check is performed here prior to actually performing the remove().

Throws:
java.lang.Exception

getAffectedDocuments

public Document[] getAffectedDocuments()
Description copied from interface: Command
For commands of the NORMAL and NO_UNDO this method should return an array of documents affected by the execution of this command. This array should not include the primary document on which this command is operating, it should only include other documents affected as a side effect of executing this command. The affected documents undo stack will be flushed. The CommandProcessor uses the return value to clear the undo stack of the affected documents. Commands of type NO_CHANGE should return null.

Specified by:
getAffectedDocuments in interface Command
Overrides:
getAffectedDocuments in class AbstractCommand

remove

protected int remove(java.util.List files,
                     Folder owner,
                     boolean close)

remove

protected int remove(java.util.List files,
                     Folder owner,
                     boolean close,
                     java.util.List output)
Remove the list of 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.


createUpdateMessage

protected UpdateMessage createUpdateMessage()
Creates an UpdateMessage whose ID is oracle.ide.addin.UpdateMessage.CHILD_REMOVED and stores the command ID as a user property.

Returns:
an UpdateMessage whose ID is oracle.ide.addin.UpdateMessage.CHILD_REMOVED.
See Also:
UpdateMessage.CHILD_REMOVED

remove

protected boolean remove(Document element,
                         Folder owner)
Removes element from owner.

Returns:
false if the element could not be removed.

buildFileNamesString

protected java.lang.String buildFileNamesString(java.util.List elementList)
Build a list of file names


findOwner

protected Folder findOwner(TNode[] tnodes,
                           Context context)
Find the owner of the given tnode. Precondition: tnodes and context cannot be null. If multiple owners are found, this method returns null. Removing files owned by mutiple folders is currently not allowed.


findOwner

protected Folder findOwner(TNode tnode,
                           Context context)
Find the owner of the given tnode. Precondition: tnode and context cannot be null.


canRemove

protected boolean canRemove(Element element,
                            Folder ownerFolder)
Returns true if the specified ownerFolder allows the element to be removed. Precondition: element and ownerFolder cannot be null.


canRemove

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. 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.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.