|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprojectviewer.importer.Importer
Base class for importers. Importers are classes that select a set of nodes (which can be of any kind) and add them to a given node.
Trees are updated in the following manner: when a node is inserted, the folder tree is updated immediately. The other two trees (which are a "flat" version of the file list, basically) are updated once at the end of the importing (to make the code simpler for those trees).
Since a lot of time may be required to import large number of files, the importing is done in its own separate thread, so that the GUI may be used normally during the process. This behaviour can be prevented if wished. If importing in a separate thread, the PV GUI will be blocked during the import phase (but the rest of jEdit will be usable).
Nested Class Summary | |
protected class |
Importer.NodeStructureChange
|
protected class |
Importer.ShowNode
Makes sure a node is visible. |
Field Summary | |
protected java.util.ArrayList |
added
The list of added files, if any, for event firing purposes. |
protected boolean |
fireEvent
Whether this class should automatically fire the project event. |
protected java.lang.Runnable |
postAction
An action to be executed after the import occurs. |
protected VPTProject |
project
|
protected java.util.ArrayList |
removed
The list of removed files, if any, for event firing purposes. |
protected VPTNode |
selected
|
protected ProjectViewer |
viewer
The node to where the imported nodes will be added. |
Constructor Summary | |
Importer(VPTNode node)
|
|
Importer(VPTNode node,
boolean noThread)
|
|
Importer(VPTNode node,
ProjectViewer viewer)
|
|
Importer(VPTNode node,
ProjectViewer viewer,
boolean noThread)
If noThread is true, inhibits the use of a separate Thread to do the importing. |
Method Summary | |
void |
doImport()
Main import method. |
protected VPTNode |
findDirectory(java.io.File dir,
VPTNode parent,
boolean create)
Looks, in the children list for the given parent, for a directory with the given path. |
protected void |
fireProjectEvent()
Fires an event based on the imported file(s). |
protected void |
importNode(VPTNode node)
Imports the node into the selected parent. |
protected void |
importNode(VPTNode child,
VPTNode where)
Imports a child into the given parent. |
protected abstract java.util.Collection |
internalDoImport()
Method to be called when importing nodes. |
protected void |
loadImportFilterStatus(VPTProject project,
ImportDialog dlg)
|
protected VPTNode |
makePathTo(java.lang.String path,
java.util.ArrayList added)
Inserts all nodes from the root up to and including the given path, if the nodes are not yet inserted. |
protected void |
registerFile(VPTFile file)
Registers the file in the project. |
void |
run()
|
protected void |
saveImportFilterStatus(VPTProject project,
ImportDialog dlg)
|
protected void |
setViewerEnabled(boolean flag)
|
protected void |
unregisterFile(VPTFile file)
Unregisters a file from a project and adds the file to the list of files that have been removed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final ProjectViewer viewer
protected VPTNode selected
protected VPTProject project
protected java.util.ArrayList added
protected java.util.ArrayList removed
protected boolean fireEvent
protected java.lang.Runnable postAction
Constructor Detail |
public Importer(VPTNode node, ProjectViewer viewer, boolean noThread)
public Importer(VPTNode node, ProjectViewer viewer)
public Importer(VPTNode node)
public Importer(VPTNode node, boolean noThread)
Method Detail |
public void doImport()
protected void importNode(VPTNode child, VPTNode where)
Important: when using a separate thread, wrap a call to this method in a call to SwingUtilities.invokeLater() or SwingUtilities.invokeAndWait(), to ensure thread safety.
protected void importNode(VPTNode node)
Important: when using a separate thread, wrap a call to this method in a call to SwingUtilities.invokeLater() or SwingUtilities.invokeAndWait(), to ensure thread safety.
protected abstract java.util.Collection internalDoImport()
importNode(VPTNode)
will be called for
each element of the collection.
protected VPTNode findDirectory(java.io.File dir, VPTNode parent, boolean create)
dir
- The directory to look for.parent
- The node where to look for the directory.create
- Whether to create a new node if a corresponding path is
not found in the parent node.protected VPTNode makePathTo(java.lang.String path, java.util.ArrayList added)
protected void registerFile(VPTFile file)
protected void unregisterFile(VPTFile file)
protected void setViewerEnabled(boolean flag)
public void run()
run
in interface java.lang.Runnable
protected void fireProjectEvent()
protected void saveImportFilterStatus(VPTProject project, ImportDialog dlg)
protected void loadImportFilterStatus(VPTProject project, ImportDialog dlg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |