Class SelectFilesOperation
java.lang.Object
org.eclipse.ui.wizards.datatransfer.SelectFilesOperation
- All Implemented Interfaces:
IRunnableWithProgress
- Direct Known Subclasses:
PopulateRootOperation
Operation responsible for traversing a specified file system position
recursively and building
- a tree that represents the container structure
- a collection containing all files meeting a specified extension criteria
This is implemented as an Operation in order to provide an escape to the user
(the Cancel button) if the operation drags on for too long
-
Constructor Summary
ConstructorDescriptionSelectFilesOperation
(Object rootObject, IImportStructureProvider structureProvider) Creates a newSelectFilesOperation
. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileSystemElement
createElement
(FileSystemElement parent, Object fileSystemObject) Creates and returns aFileSystemElement
if the specified file system object merits one.protected String
getExtensionFor
(String filename) Returns the extension portion of the passed filename string.Returns the resulting root file system element.protected boolean
hasDesiredExtension
(String filename) Returns a boolean indicating whether the extension of the passed filename is one of the extensions specified as desired by the filter.void
run
(IProgressMonitor monitor) Runs the operation.void
setDesiredExtensions
(String[] extensions) Sets the file extensions which are desired.
-
Constructor Details
-
SelectFilesOperation
Creates a newSelectFilesOperation
.
-
-
Method Details
-
createElement
protected FileSystemElement createElement(FileSystemElement parent, Object fileSystemObject) throws InterruptedException Creates and returns aFileSystemElement
if the specified file system object merits one. The criteria for this are: - if the file system object is a container then it must have either a child container or an associated file - if the file system object is a file then it must have an extension suitable for selection- Throws:
InterruptedException
-
getExtensionFor
Returns the extension portion of the passed filename string. -
getResult
Returns the resulting root file system element. -
hasDesiredExtension
Returns a boolean indicating whether the extension of the passed filename is one of the extensions specified as desired by the filter. -
run
Runs the operation.- Specified by:
run
in interfaceIRunnableWithProgress
- Parameters:
monitor
- the progress monitor to use to display progress and receive requests for cancelation- Throws:
InterruptedException
- if the operation detects a request to cancel, usingIProgressMonitor.isCanceled()
, it should exit by throwingInterruptedException
- See Also:
-
setDesiredExtensions
Sets the file extensions which are desired. A value ofnull
indicates that all files should be kept regardless of extension.
-