Package docking.widgets.filechooser

# Class LocalFileChooserModel

java.lang.Object
docking.widgets.filechooser.LocalFileChooserModel

All Implemented Interfaces:
  `GhidraFileChooserModel`

public class LocalFileChooserModel extends Object implements GhidraFileChooserModel
A default implementation of the file chooser model that browses the local file system.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocalFileChooserModel()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `createDirectory(File directory, String name)`
  Creates a directory in the specified directory with the specified name.
  `String`
  `getDescription(File file)`
  Returns a description for the specified file.
  `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.
  `File`
  `getHomeDirectory()`
  Returns the home directory.
  `Icon`
  `getIcon(File file)`
  Returns an icon for the specified file.
  `List<File>`
  `getListing(File directory, FileFilter filter)`
  Returns an array of the files that exist in the specified directory.
  `List<File>`
  `getRoots(boolean forceUpdate)`
  Returns a list of the root drives/directories.
  `char`
  `getSeparator()`
  Returns the file separator char.
  `boolean`
  `isAbsolute(File file)`
  Tests whether this abstract pathname is absolute.
  `boolean`
  `isDirectory(File file)`
  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`
  `setModelUpdateCallback(Callback callback)`
  Set the model update callback.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LocalFileChooserModel

    public LocalFileChooserModel()

- ## Method Details

  - ### getSeparator

    public char getSeparator()
    Description copied from interface: `GhidraFileChooserModel`
    Returns the file separator char. On windows, '\' On linux, '/'.
    Specified by:
      `getSeparator` in interface `GhidraFileChooserModel`
    Returns:
      the file separator char

  - ### setModelUpdateCallback

    public void setModelUpdateCallback(Callback callback)
    Description copied from interface: `GhidraFileChooserModel`
    Set the model update callback.
    Specified by:
      `setModelUpdateCallback` in interface `GhidraFileChooserModel`
    Parameters:
      `callback` - the new model update callback handler

  - ### getHomeDirectory

    public File getHomeDirectory()
    Description copied from interface: `GhidraFileChooserModel`
    Returns the home directory.
    Specified by:
      `getHomeDirectory` in interface `GhidraFileChooserModel`
    Returns:
      the home directory

  - ### getDesktopDirectory

    public File getDesktopDirectory()
    Description copied from interface: `GhidraFileChooserModel`
    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"

    Specified by:
      `getDesktopDirectory` in interface `GhidraFileChooserModel`
    Returns:
      desktop directory

  - ### getRoots

    public List<File> getRoots(boolean forceUpdate)
    Description copied from interface: `GhidraFileChooserModel`
    Returns a list of the root drives/directories.

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

    On linux, "/".

    Specified by:
      `getRoots` in interface `GhidraFileChooserModel`
    Parameters:
      `forceUpdate` - if true, request a fresh listing, if false allow a cached result
    Returns:
      the root drives

  - ### getListing

    public List<File> getListing(File directory, FileFilter filter)
    Description copied from interface: `GhidraFileChooserModel`
    Returns an array of the files that exist in the specified directory.
    Specified by:
      `getListing` in interface `GhidraFileChooserModel`
    Parameters:
      `directory` - the directory
      `filter` - the file filter; may be null
    Returns:
      list of files

  - ### getIcon

    public Icon getIcon(File file)
    Description copied from interface: `GhidraFileChooserModel`
    Returns an icon for the specified file.
    Specified by:
      `getIcon` in interface `GhidraFileChooserModel`
    Parameters:
      `file` - the file
    Returns:
      an icon for the specified file

  - ### getDescription

    public String getDescription(File file)
    Description copied from interface: `GhidraFileChooserModel`
    Returns a description for the specified file.
    Specified by:
      `getDescription` in interface `GhidraFileChooserModel`
    Parameters:
      `file` - the file
    Returns:
      a description for the specified file

  - ### createDirectory

    public boolean createDirectory(File directory, String name)
    Description copied from interface: `GhidraFileChooserModel`
    Creates a directory in the specified directory with the specified name.
    Specified by:
      `createDirectory` in interface `GhidraFileChooserModel`
    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

    public boolean isDirectory(File file)
    Description copied from interface: `GhidraFileChooserModel`
    Tests whether the file denoted by this abstract pathname is a directory.
    Specified by:
      `isDirectory` in interface `GhidraFileChooserModel`
    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

    public boolean isAbsolute(File file)
    Description copied from interface: `GhidraFileChooserModel`
    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 `"\\"`.
    Specified by:
      `isAbsolute` in interface `GhidraFileChooserModel`
    Parameters:
      `file` - the file
    Returns:
      `true` if this abstract pathname is absolute, `false` otherwise

  - ### renameFile

    public boolean renameFile(File src, File dest)
    Description copied from interface: `GhidraFileChooserModel`
    Renames the src file to the destination file.
    Specified by:
      `renameFile` in interface `GhidraFileChooserModel`
    Parameters:
      `src` - the file to be renamed
      `dest` - the new file
    Returns:
      true if the file was renamed