projectviewer.importer
Class FileImporter

java.lang.Object
  extended byprojectviewer.importer.Importer
      extended byprojectviewer.importer.FileImporter
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
OldStyleFileImporter, RootImporter

public class FileImporter
extends Importer

Imports files and/or directories into a project.

Version:
$Id: FileImporter.java 7059 2006-09-17 20:58:10Z ezust $
Author:
Marcelo Vanzin

Nested Class Summary
 
Nested classes inherited from class projectviewer.importer.Importer
Importer.NodeStructureChange, Importer.ShowNode
 
Field Summary
protected  int fileCount
           
protected static int FILTER_MSG_INITIAL_IMPORT
           
protected static int FILTER_MSG_RE_IMPORT
           
protected static int FILTER_MSG_RECURSE
           
protected  java.io.FilenameFilter fnf
           
 
Fields inherited from class projectviewer.importer.Importer
added, fireEvent, postAction, project, removed, selected, viewer
 
Constructor Summary
FileImporter(VPTNode node, ProjectViewer viewer)
           
 
Method Summary
protected  void addTree(java.io.File root, VPTNode where, java.io.FilenameFilter filter, boolean flatten)
          Adds a directory tree to the given node.
protected  ImportDialog getImportDialog()
           
protected  java.util.Collection internalDoImport()
          Queries the user for files to be added by showing a file chooser dialog.
protected  void showFileCount()
          Shows a message in the status bar indicating how many files were imported.
 
Methods inherited from class projectviewer.importer.Importer
doImport, findDirectory, fireProjectEvent, importNode, importNode, loadImportFilterStatus, makePathTo, registerFile, run, saveImportFilterStatus, setViewerEnabled, unregisterFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER_MSG_RECURSE

protected static final int FILTER_MSG_RECURSE
See Also:
Constant Field Values

FILTER_MSG_INITIAL_IMPORT

protected static final int FILTER_MSG_INITIAL_IMPORT
See Also:
Constant Field Values

FILTER_MSG_RE_IMPORT

protected static final int FILTER_MSG_RE_IMPORT
See Also:
Constant Field Values

fileCount

protected int fileCount

fnf

protected java.io.FilenameFilter fnf
Constructor Detail

FileImporter

public FileImporter(VPTNode node,
                    ProjectViewer viewer)
Method Detail

internalDoImport

protected java.util.Collection internalDoImport()
Queries the user for files to be added by showing a file chooser dialog. If any directories are chosen, the user is asked (once) if he wants to import them recursively. If the files to be added are below the project's root path, and they're being added directly to the project or to a node that is a directory and whose path is parent to the files being added, the importer creates the tree to the files and appends that tree to the node.

Specified by:
internalDoImport in class Importer
Returns:
A collection of VPTNode instances.

addTree

protected void addTree(java.io.File root,
                       VPTNode where,
                       java.io.FilenameFilter filter,
                       boolean flatten)
Adds a directory tree to the given node.

Parameters:
root - The root directory from where to look for files.
where - The node to where the new files will be added.
filter - The filter to use to select files.
flatten - Whether to "flat import" (add all files to top directory).

showFileCount

protected void showFileCount()
Shows a message in the status bar indicating how many files were imported.


getImportDialog

protected ImportDialog getImportDialog()