Class FileUtilities


  • @Service(FileUtilities.class)
    public class FileUtilities
    extends java.lang.Object
    File-related utility methods.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtilities()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void editFile​(java.io.File file)
      Edits/opens a given file via the Desktop utilities.
      The corresponding application will be chosen according to the mime/file type.
      static FileUtilities getInstance()
      The singleton.
      java.io.File selectFile​(java.lang.String prefName, java.lang.String prefKey, java.lang.String fileExtension, java.lang.String fileType, javafx.stage.Stage owner)
      Selects a file via filechooser dialog and remembers the decision in the user preferences.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileUtilities

        public FileUtilities()
    • Method Detail

      • getInstance

        public static FileUtilities getInstance()
        The singleton.
        Returns:
        the singleton
      • selectFile

        public java.io.File selectFile​(java.lang.String prefName,
                                       java.lang.String prefKey,
                                       java.lang.String fileExtension,
                                       java.lang.String fileType,
                                       javafx.stage.Stage owner)
        Selects a file via filechooser dialog and remembers the decision in the user preferences.
        Parameters:
        prefName - the preferences name
        prefKey - the preferences key
        fileExtension - the filename extension (including the leading dot)
        fileType - the localized name of the file type
        owner - the dialog owner for the selection dialog, null if none
        Returns:
        the selected file, null if aborted
      • editFile

        public void editFile​(java.io.File file)
        Edits/opens a given file via the Desktop utilities.
        The corresponding application will be chosen according to the mime/file type.
        Parameters:
        file - the file