Class FileUtil
- java.lang.Object
-
- com.inductiveautomation.ignition.designer.util.FileUtil
-
public class FileUtil extends java.lang.ObjectContains 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 Constructor Description FileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringopenFile(java.awt.Component parent, java.lang.String extension)Shows the open file dialog box with a file extension filter for the given extension.static voidsaveToFile(java.awt.Component parent, java.lang.String filename, java.lang.String extension, java.lang.String fileTypeDescription, ClientFileUtilities.FileWritingTask writer)Show a save as dialog box with the givenfilenameas a suggestion.static voidsaveToFile(java.awt.Component parent, java.lang.String filename, java.lang.String extensionList, java.lang.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(java.awt.Component parent, java.lang.String filename, java.lang.String extensionList, java.lang.String forcedDefaultExtension, java.lang.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.
-
-
-
Method Detail
-
openFile
public static java.lang.String openFile(java.awt.Component parent, java.lang.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(java.awt.Component parent, java.lang.String filename, java.lang.String extension, java.lang.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(java.awt.Component parent, java.lang.String filename, java.lang.String extensionList, java.lang.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(java.awt.Component parent, java.lang.String filename, java.lang.String extensionList, java.lang.String forcedDefaultExtension, java.lang.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
-
-