Class FileImporter

    • Constructor Detail

      • FileImporter

        protected FileImporter​(ExtensionFileFilter filter)
        Constructs a new FileImporter with the given extension file filter.
        Parameters:
        filter - The extension file filter
    • Method Detail

      • acceptFile

        public boolean acceptFile​(java.io.File pathname)
        Determines if this file importer accepts the given file.
        Parameters:
        pathname - The file to test
        Returns:
        true if this file importer accepts the given file, false otherwise
      • isBatchImporter

        public boolean isBatchImporter()
        A batch importer is a file importer that prefers to read multiple files at the same time.
        Returns:
        true if this importer is a batch importer
      • importData

        public void importData​(java.io.File file,
                               ProgressMonitor progressMonitor)
                        throws java.io.IOException,
                               IllegalDataException
        Needs to be implemented if isBatchImporter() returns false.
        Parameters:
        file - file to import
        progressMonitor - progress monitor
        Throws:
        java.io.IOException - if any I/O error occurs
        IllegalDataException - if invalid data is read
      • importData

        public void importData​(java.util.List<java.io.File> files,
                               ProgressMonitor progressMonitor)
                        throws java.io.IOException,
                               IllegalDataException
        Needs to be implemented if isBatchImporter() returns true.
        Parameters:
        files - files to import
        progressMonitor - progress monitor
        Throws:
        java.io.IOException - if any I/O error occurs
        IllegalDataException - if invalid data is read
      • displayError

        private static void displayError​(java.io.File f,
                                         java.lang.Exception e)
      • displayCancel

        private static void displayCancel​(java.lang.Throwable t)
      • getPriority

        public double getPriority()
        If multiple files (with multiple file formats) are selected, they are opened in the order of their priorities. Highest priority comes first.
        Returns:
        priority
      • isEnabled

        public final boolean isEnabled()
        Returns the enabled state of this FileImporter. When enabled, it is listed and usable in "File → Open" dialog.
        Returns:
        true if this FileImporter is enabled
        Since:
        5459
      • setEnabled

        public final void setEnabled​(boolean enabled)
        Sets the enabled state of the FileImporter. When enabled, it is listed and usable in "File → Open" dialog.
        Parameters:
        enabled - true to enable this FileImporter, false to disable it
        Since:
        5459
      • setOptions

        public final void setOptions​(Options[] options)
        Set the options for the FileImporter.
        Parameters:
        options - The options to set
        Since:
        17534