public abstract class FileImporter extends java.lang.Object implements java.lang.Comparable<FileImporter>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
enabled |
ExtensionFileFilter |
filter
The extension file filter used to accept files.
|
| Constructor and Description |
|---|
FileImporter(ExtensionFileFilter filter)
Constructs a new
FileImporter with the given extension file filter. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptFile(java.io.File pathname)
Determines if this file importer accepts the given file.
|
int |
compareTo(FileImporter other) |
private static void |
displayCancel(java.lang.Throwable t) |
private static void |
displayError(java.io.File f,
java.lang.Exception e) |
double |
getPriority()
If multiple files (with multiple file formats) are selected,
they are opened in the order of their priorities.
|
void |
importData(java.io.File file,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns false.
|
void |
importData(java.util.List<java.io.File> files,
ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns true.
|
boolean |
importDataHandleExceptions(java.io.File f,
ProgressMonitor progressMonitor)
Wrapper to
importData(File, ProgressMonitor) to give meaningful output if things go wrong. |
boolean |
importDataHandleExceptions(java.util.List<java.io.File> files,
ProgressMonitor progressMonitor)
Wrapper to
importData(List, ProgressMonitor) to give meaningful output if things go wrong. |
boolean |
isBatchImporter()
A batch importer is a file importer that prefers to read multiple files at the same time.
|
boolean |
isEnabled()
Returns the enabled state of this
FileImporter. |
void |
setEnabled(boolean enabled)
Sets the enabled state of the
FileImporter. |
public final ExtensionFileFilter filter
private boolean enabled
public FileImporter(ExtensionFileFilter filter)
FileImporter with the given extension file filter.filter - The extension file filterpublic boolean acceptFile(java.io.File pathname)
pathname - The file to testtrue if this file importer accepts the given file, false otherwisepublic boolean isBatchImporter()
true if this importer is a batch importerpublic void importData(java.io.File file, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
file - file to importprogressMonitor - progress monitorjava.io.IOException - if any I/O error occursIllegalDataException - if invalid data is readpublic void importData(java.util.List<java.io.File> files, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
files - files to importprogressMonitor - progress monitorjava.io.IOException - if any I/O error occursIllegalDataException - if invalid data is readpublic boolean importDataHandleExceptions(java.io.File f, ProgressMonitor progressMonitor)
importData(File, ProgressMonitor) to give meaningful output if things go wrong.f - data file to importprogressMonitor - progress monitorprivate static void displayError(java.io.File f, java.lang.Exception e)
private static void displayCancel(java.lang.Throwable t)
public boolean importDataHandleExceptions(java.util.List<java.io.File> files, ProgressMonitor progressMonitor)
importData(List, ProgressMonitor) to give meaningful output if things go wrong.files - data files to importprogressMonitor - progress monitorpublic double getPriority()
public int compareTo(FileImporter other)
compareTo in interface java.lang.Comparable<FileImporter>public final boolean isEnabled()
FileImporter. When enabled, it is listed and usable in "File->Open" dialog.FileImporter is enabledpublic final void setEnabled(boolean enabled)
FileImporter. When enabled, it is listed and usable in "File->Open" dialog.enabled - true to enable this FileImporter, false to disable it