Package com.jetbrains

Interface JBRFileDialog


@Provided public interface JBRFileDialog
Extensions to the AWT FileDialog that allow clients fully use a native file chooser on supported platforms (currently macOS and Windows; the latter requires setting sun.awt.windows.useCommonItemDialog property to true).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    "all files" item in the file filter combo box
    static final int
    Whether to allow creating directories or not (used on macOS)
    static final String
    "open" button when a directory is selected in the list
    static final String
    "open" button when a file is selected in the list
    static final int
    Whether to select files, directories or both (used when common file dialogs are enabled on Windows, or on macOS)
    static final int
    Whether to select files, directories or both (used when common file dialogs are enabled on Windows, or on macOS)
  • Method Summary

    Modifier and Type
    Method
    Description
    get(FileDialog dialog)
    Get JBRFileDialog from FileDialog, if supported.
    int
    Retrieve extended hints set on file dialog.
    void
    setFileFilterExtensions(String fileFilterDescription, String[] fileFilterExtensions)
    Set file filter - a set of file extensions for files to be visible (Windows) or not greyed out (macOS), and a name for the file filter combo box (Windows).
    void
    setHints(int hints)
    Set file dialog hints: SELECT_FILES_HINT, SELECT_DIRECTORIES_HINT - whether to select files, directories, or both; if neither of the two is set, the behavior is platform-specific CREATE_DIRECTORIES_HINT - whether to allow creating directories or not (macOS)
    void
    Change text of UI elements (Windows).
  • Field Details

    • SELECT_FILES_HINT

      static final int SELECT_FILES_HINT
      Whether to select files, directories or both (used when common file dialogs are enabled on Windows, or on macOS)
      See Also:
    • SELECT_DIRECTORIES_HINT

      static final int SELECT_DIRECTORIES_HINT
      Whether to select files, directories or both (used when common file dialogs are enabled on Windows, or on macOS)
      See Also:
    • CREATE_DIRECTORIES_HINT

      static final int CREATE_DIRECTORIES_HINT
      Whether to allow creating directories or not (used on macOS)
      See Also:
    • OPEN_FILE_BUTTON_KEY

      static final String OPEN_FILE_BUTTON_KEY
      "open" button when a file is selected in the list
      See Also:
    • OPEN_DIRECTORY_BUTTON_KEY

      static final String OPEN_DIRECTORY_BUTTON_KEY
      "open" button when a directory is selected in the list
      See Also:
    • ALL_FILES_COMBO_KEY

      static final String ALL_FILES_COMBO_KEY
      "all files" item in the file filter combo box
      See Also:
  • Method Details

    • get

      static JBRFileDialog get(FileDialog dialog)
      Get JBRFileDialog from FileDialog, if supported.
      Parameters:
      dialog - file dialog
      Returns:
      file dialog extension, or null
    • setHints

      void setHints(int hints)
      Set file dialog hints:
      • SELECT_FILES_HINT, SELECT_DIRECTORIES_HINT - whether to select files, directories, or both; if neither of the two is set, the behavior is platform-specific
      • CREATE_DIRECTORIES_HINT - whether to allow creating directories or not (macOS)
      Parameters:
      hints - bitmask of selected hints
    • getHints

      int getHints()
      Retrieve extended hints set on file dialog.
      Returns:
      bitmask of selected hints
      See Also:
    • setLocalizationString

      void setLocalizationString(String key, String text)
      Change text of UI elements (Windows). Supported keys:
      • OPEN_FILE_BUTTON_KEY - "open" button when a file is selected in the list
      • OPEN_DIRECTORY_BUTTON_KEY - "open" button when a directory is selected in the list
      • ALL_FILES_COMBO_KEY - "all files" item in the file filter combo box
      Parameters:
      key - key
      text - localized text
    • setFileFilterExtensions

      void setFileFilterExtensions(String fileFilterDescription, String[] fileFilterExtensions)
      Set file filter - a set of file extensions for files to be visible (Windows) or not greyed out (macOS), and a name for the file filter combo box (Windows).
      Parameters:
      fileFilterDescription - file filter description
      fileFilterExtensions - file filter extensions