Package org.openstreetmap.josm.actions
Class OpenFileAction.OpenFileTask
- java.lang.Object
-
- org.openstreetmap.josm.gui.PleaseWaitRunnable
-
- org.openstreetmap.josm.actions.OpenFileAction.OpenFileTask
-
- All Implemented Interfaces:
java.lang.Runnable,ProgressMonitor.CancelListener
- Enclosing class:
- OpenFileAction
public static class OpenFileAction.OpenFileTask extends PleaseWaitRunnable
Task to open files.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancanceledprivate java.util.Set<java.lang.String>failedAllprivate javax.swing.filechooser.FileFilterfileFilterprivate java.util.Set<java.lang.String>fileHistoryprivate java.util.List<java.io.File>filesprivate java.util.EnumSet<Options>optionsprivate java.util.List<java.io.File>successfullyOpenedFiles-
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
progressMonitor
-
-
Constructor Summary
Constructors Constructor Description OpenFileTask(java.util.List<java.io.File> files, javax.swing.filechooser.FileFilter fileFilter)Constructs a newOpenFileTask.OpenFileTask(java.util.List<java.io.File> files, javax.swing.filechooser.FileFilter fileFilter, java.lang.String title)Constructs a newOpenFileTask.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidalertFilesNotMatchingWithImporter(java.util.Collection<java.io.File> files, FileImporter importer)protected voidalertFilesWithUnknownImporter(java.util.Collection<java.io.File> files)protected voidcancel()User pressed cancel button.private static voidcheckNewLayers(java.util.List<Layer> oldLayers)protected voidfinish()Finish up the data work.java.util.Set<Options>getOptions()Get the options for this taskjava.util.List<java.io.File>getSuccessfullyOpenedFiles()Replies the list of files that have been successfully opened.voidimportData(FileImporter importer, java.util.List<java.io.File> files)Import data files with the given importer.booleanisRecordHistory()Determines if filename must be saved in history (for list of recently opened files).protected voidrealRun()Called in the worker thread to do the actual work.voidsetOptions(Options... options)Set the options for the task.-
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
-
-
-
-
Field Detail
-
files
private final java.util.List<java.io.File> files
-
successfullyOpenedFiles
private final java.util.List<java.io.File> successfullyOpenedFiles
-
fileHistory
private final java.util.Set<java.lang.String> fileHistory
-
failedAll
private final java.util.Set<java.lang.String> failedAll
-
fileFilter
private final javax.swing.filechooser.FileFilter fileFilter
-
canceled
private boolean canceled
-
-
Constructor Detail
-
OpenFileTask
public OpenFileTask(java.util.List<java.io.File> files, javax.swing.filechooser.FileFilter fileFilter, java.lang.String title)
Constructs a newOpenFileTask.- Parameters:
files- files to openfileFilter- file filtertitle- message for the user
-
OpenFileTask
public OpenFileTask(java.util.List<java.io.File> files, javax.swing.filechooser.FileFilter fileFilter)
Constructs a newOpenFileTask.- Parameters:
files- files to openfileFilter- file filter
-
-
Method Detail
-
setOptions
public void setOptions(Options... options)
Set the options for the task.- Parameters:
options- The options to set- Since:
- 17556
- See Also:
Options
-
isRecordHistory
public boolean isRecordHistory()
Determines if filename must be saved in history (for list of recently opened files).- Returns:
trueif filename must be saved in history
-
getOptions
public java.util.Set<Options> getOptions()
Get the options for this task- Returns:
- A set of options
- Since:
- 17534
-
cancel
protected void cancel()
Description copied from class:PleaseWaitRunnableUser pressed cancel button.- Specified by:
cancelin classPleaseWaitRunnable
-
finish
protected void finish()
Description copied from class:PleaseWaitRunnableFinish up the data work. Is guaranteed to be called if realRun is called. Finish is called in the gui thread just after the dialog disappeared.- Specified by:
finishin classPleaseWaitRunnable
-
alertFilesNotMatchingWithImporter
protected void alertFilesNotMatchingWithImporter(java.util.Collection<java.io.File> files, FileImporter importer)
-
alertFilesWithUnknownImporter
protected void alertFilesWithUnknownImporter(java.util.Collection<java.io.File> files)
-
realRun
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
Description copied from class:PleaseWaitRunnableCalled in the worker thread to do the actual work. When any of the exception is thrown, a message box will be displayed and closeDialog is called. finish() is called in any case.- Specified by:
realRunin classPleaseWaitRunnable- Throws:
org.xml.sax.SAXException- if a SAX error occursjava.io.IOException- if an I/O error occursOsmTransferException- if a communication error with the OSM server occurs
-
checkNewLayers
private static void checkNewLayers(java.util.List<Layer> oldLayers)
-
importData
public void importData(FileImporter importer, java.util.List<java.io.File> files)
Import data files with the given importer.- Parameters:
importer- file importerfiles- data files to import
-
getSuccessfullyOpenedFiles
public java.util.List<java.io.File> getSuccessfullyOpenedFiles()
Replies the list of files that have been successfully opened.- Returns:
- The list of files that have been successfully opened.
-
-