java.lang.Object
com.inductiveautomation.ignition.designer.util.FileUtil

public class FileUtil extends Object
Contains a few static file-related functions that were ported from the FactoryPMI-provided FPMIFileUtilites class for general use in the SR Designer
  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • openFile

      public static String openFile(Component parent, String extension)
      Shows the open file dialog box with a file extension filter for the given extension.
      Parameters:
      extension - a filename extension, like "pdf", without the prepending period.
      Returns:
      a string representing the path to the selected file, or None(null) if canceled.
    • saveToFile

      public static void saveToFile(Component parent, String filename, String extension, String fileTypeDescription, ClientFileUtilities.FileWritingTask writer)
      Show a save as dialog box with the given filename as a suggestion. If save is selected, the FileWritingTask will be invoked to write to the file.
    • saveToFile

      public static void saveToFile(Component parent, String filename, String extensionList, String fileTypeDescriptionList, ClientFileUtilities.FileWritingTaskFactory factory)
      Similar to the other saveToFile overload, but takes a factory that can create different writing tasks for various extensions.
    • saveToFile

      public static boolean saveToFile(Component parent, String filename, String extensionList, String forcedDefaultExtension, String fileTypeDescriptionList, ClientFileUtilities.FileWritingTaskFactory factory)
      Similar to the other saveToFile overloads, but takes a forced default extension which will automatically be appended to the end of the user's chosen file name if it has an extension that is not in the provided extensionList. If a null forcedDefaultExtension is provided, this behavior will not occur, meaning the file written will be with whatever extension the user chooses).
      Returns:
      true if write was successful