Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.cmd
Class RemoveFileCommand

java.lang.Object
  extended by oracle.ide.controller.Command
      extended by oracle.ide.cmd.RemoveFileCommand

Direct Known Subclasses:
RemoveFromDiskCommand

public class RemoveFileCommand
extends Command

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

See Also:
Command

Field Summary

 

Fields inherited from class oracle.ide.controller.Command
CANCEL, context, EXECUTING, MULTI_NODE, NO_CHANGE, NO_UNDO, NORMAL, OK, type

 

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

 

Methods inherited from class oracle.ide.controller.Command
enableConfirmation, getContext, getData, getId, getName, getType, isGlobal, 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().
Specified by:
doit in class Command
Throws:
java.lang.Exception

getAffectedNodes

public Node[] getAffectedNodes()
Description copied from class: Command
This method should return an array of Nodes affected by the execution of this command. The array should not include the primary Node on which this command is operating (as returned from getContext().getNode()), but rather should only include other Nodes additionally affected as a side effect of executing this command. If there is no primary Node, then all Nodes affected should be returned in the array. The CommandProcessor uses the return value when deciding how to treat the undo stack of the affected Nodes. Commands of type NO_CHANGE should return null.
Overrides:
getAffectedNodes in class Command
Returns:
the Nodes affected by this command, otherwise, null.

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 UpdateMessage.CHILD_REMOVED and stores the command ID as a user property.
Returns:
an UpdateMessage whose ID is UpdateMessage.CHILD_REMOVED.
See Also:
UpdateMessage.CHILD_REMOVED

remove

protected boolean remove(Node node,
                         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

canRemove

protected boolean canRemove(Element element,
                            Folder ownerFolder)
Returns true if the specified ownerFolder allows the element to be removed. Precondition: element 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.

isNeedConfirmClose

protected boolean isNeedConfirmClose()
Returns:
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.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


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