Interface GhidraFileChooserModel

All Known Implementing Classes:
LocalFileChooserModel

public interface GhidraFileChooserModel
Interface for the GhidraFileChooser data model. This allows the GhidraFileChooser to operate on files from different sources, other than just the local file system.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    createDirectory(File directory, String name)
    Creates a directory in the specified directory with the specified name.
    Returns a description for the specified file.
    Returns the user's desktop directory, as defined by their operating system and/or their windowing environment, or null if there is no desktop directory.
    Returns the home directory.
    getIcon(File file)
    Returns an icon for the specified file.
    getListing(File directory, FileFilter filter)
    Returns an array of the files that exist in the specified directory.
    getRoots(boolean forceUpdate)
    Returns a list of the root drives/directories.
    char
    Returns the file separator char.
    boolean
    Tests whether this abstract pathname is absolute.
    boolean
    Tests whether the file denoted by this abstract pathname is a directory.
    boolean
    renameFile(File src, File dest)
    Renames the src file to the destination file.
    void
    Set the model update callback.
  • Method Details

    • setModelUpdateCallback

      void setModelUpdateCallback(Callback callback)
      Set the model update callback.
      Parameters:
      callback - the new model update callback handler
    • getHomeDirectory

      File getHomeDirectory()
      Returns the home directory.
      Returns:
      the home directory
    • getDesktopDirectory

      File getDesktopDirectory()
      Returns the user's desktop directory, as defined by their operating system and/or their windowing environment, or null if there is no desktop directory.

      Example: "/home/the_user/Desktop" or "c:/Users/the_user/Desktop"

      Returns:
      desktop directory
    • getRoots

      List<File> getRoots(boolean forceUpdate)
      Returns a list of the root drives/directories.

      On windows, "C:\", "D:\", etc.

      On linux, "/".

      Parameters:
      forceUpdate - if true, request a fresh listing, if false allow a cached result
      Returns:
      the root drives
    • getListing

      List<File> getListing(File directory, FileFilter filter)
      Returns an array of the files that exist in the specified directory.
      Parameters:
      directory - the directory
      filter - the file filter; may be null
      Returns:
      list of files
    • getIcon

      Icon getIcon(File file)
      Returns an icon for the specified file.
      Parameters:
      file - the file
      Returns:
      an icon for the specified file
    • getDescription

      String getDescription(File file)
      Returns a description for the specified file.
      Parameters:
      file - the file
      Returns:
      a description for the specified file
    • createDirectory

      boolean createDirectory(File directory, String name)
      Creates a directory in the specified directory with the specified name.
      Parameters:
      directory - the directory in which to create the new directory
      name - the name of the directory
      Returns:
      true if the new directory was create.
    • isDirectory

      boolean isDirectory(File file)
      Tests whether the file denoted by this abstract pathname is a directory.
      Parameters:
      file - the file
      Returns:
      true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise
    • isAbsolute

      boolean isAbsolute(File file)
      Tests whether this abstract pathname is absolute. The definition of absolute pathname is system dependent. On UNIX systems, a pathname is absolute if its prefix is "/". On Microsoft Windows systems, a pathname is absolute if its prefix is a drive specifier followed by "\\", or if its prefix is "\\".
      Parameters:
      file - the file
      Returns:
      true if this abstract pathname is absolute, false otherwise
    • renameFile

      boolean renameFile(File src, File dest)
      Renames the src file to the destination file.
      Parameters:
      src - the file to be renamed
      dest - the new file
      Returns:
      true if the file was renamed
    • getSeparator

      char getSeparator()
      Returns the file separator char. On windows, '\' On linux, '/'.
      Returns:
      the file separator char