Class FileUtil
java.lang.Object
com.inductiveautomation.ignition.designer.util.FileUtil
Contains a few static file-related functions that were ported from the FactoryPMI-provided FPMIFileUtilites class for
general use in the SR Designer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringShows the open file dialog box with a file extension filter for the given extension.static voidsaveToFile(Component parent, String filename, String extension, String fileTypeDescription, ClientFileUtilities.FileWritingTask writer) Show a save as dialog box with the givenfilenameas a suggestion.static voidsaveToFile(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.static booleansaveToFile(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.
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
openFile
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 givenfilenameas 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
-