Class SelectFilesOperation

  • All Implemented Interfaces:
    IRunnableWithProgress
    Direct Known Subclasses:
    PopulateRootOperation

    public class SelectFilesOperation
    extends java.lang.Object
    implements IRunnableWithProgress
    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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected FileSystemElement createElement​(FileSystemElement parent, java.lang.Object fileSystemObject)
      Creates and returns a FileSystemElement if the specified file system object merits one.
      protected java.lang.String getExtensionFor​(java.lang.String filename)
      Returns the extension portion of the passed filename string.
      FileSystemElement getResult()
      Returns the resulting root file system element.
      protected boolean hasDesiredExtension​(java.lang.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​(java.lang.String[] extensions)
      Sets the file extensions which are desired.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SelectFilesOperation

        public SelectFilesOperation​(java.lang.Object rootObject,
                                    IImportStructureProvider structureProvider)
        Creates a new SelectFilesOperation.
    • Method Detail

      • createElement

        protected FileSystemElement createElement​(FileSystemElement parent,
                                                  java.lang.Object fileSystemObject)
                                           throws java.lang.InterruptedException
        Creates and returns a FileSystemElement 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:
        java.lang.InterruptedException
      • getExtensionFor

        protected java.lang.String getExtensionFor​(java.lang.String filename)
        Returns the extension portion of the passed filename string.
      • getResult

        public FileSystemElement getResult()
        Returns the resulting root file system element.
      • hasDesiredExtension

        protected boolean hasDesiredExtension​(java.lang.String filename)
        Returns a boolean indicating whether the extension of the passed filename is one of the extensions specified as desired by the filter.
      • setDesiredExtensions

        public void setDesiredExtensions​(java.lang.String[] extensions)
        Sets the file extensions which are desired. A value of null indicates that all files should be kept regardless of extension.