Interface Rename.RenameListener

  • All Known Implementing Classes:
    CardLayoutEditor
    Enclosing class:
    Rename

    public static interface Rename.RenameListener
    A listener for file rename events. Rename events are fired when the rename command is used to rename a project file, or the delete command is used to delete a project file. The event is fired after the rename or delete takes place. Renaming or deleting a file from outside of the project system will not fire an event. (Other parts of the project system may also fire rename events when renaming or moving files.)
    • Method Detail

      • fileRenamed

        void fileRenamed​(Project p,
                         Member newMember,
                         java.io.File oldFile,
                         java.io.File newFile)
        Called when a file is renamed or deleted through the project system. The value of oldFile is always the file that was changed. If the file is being renamed, then newFile is the new (and current) name of the file. If the file is being deleted, then newFile will be null. The value of newMember may be the project member instance of the newFile, if one has already been created. Whether or not it is null depends on the source of the rename action. When a file is renamed with the rename action, it should be available. When the file is being moved by a drag or paste in the project pane, it will be null since the tree is not updated until the entire operation is completed. If you need to access the new member and the value is null, you can post an EventQueue.invokeLater event that calls Project.findMember( newFile ) to locate it.
        Parameters:
        p - the project in which the command was issued
        newMember - the new member associated with the file, if available
        oldFile - the original file name
        newFile - the new file name, or null if the file was deleted