Changeset 8787
- Timestamp:
- 2004-12-13T14:50:39+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/file
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r8784 r8787 157 157 158 158 159 public void add(MutableTreeNode child) 160 { 161 insert(child, child_nodes.size()); 162 } 163 164 159 165 protected abstract FileNode addChildNode(File file); 160 166 … … 208 214 } 209 215 return path; 210 }211 212 213 public void insert(MutableTreeNode child) {214 insert(child, child_nodes.size());215 216 } 216 217 -
trunk/gli/src/org/greenstone/gatherer/file/FileSystem.java
r8783 r8787 2 2 3 3 import java.io.File; 4 import javax.swing.filechooser.FileSystemView;5 4 import org.greenstone.gatherer.DebugStream; 6 5 import org.greenstone.gatherer.Dictionary; … … 13 12 static public WorkspaceTreeNode getLocalFilespaceNode(FileSystemModel model) 14 13 { 15 WorkspaceTreeNode file_system_root = null;16 17 14 // Get all the available roots mounted on the filesystem 18 15 File[] roots = File.listRoots(); … … 21 18 } 22 19 23 // If there is just one root use it as the tree root ( Linux)20 // If there is just one root use it as the tree root (Unix) 24 21 if (roots.length == 1) { 25 file_system_root =new WorkspaceTreeNode(roots[0], Dictionary.get("Tree.Root"));22 return new WorkspaceTreeNode(roots[0], Dictionary.get("Tree.Root")); 26 23 } 27 24 28 // Otherwise build a dummy node which has the roots as children 25 // Otherwise build a dummy node which has the roots as children (Windows) 29 26 else { 30 file_system_root = new WorkspaceTreeNode(null, Dictionary.get("Tree.Root")); 31 file_system_root.setModel(model); 32 33 // Sort the roots into alphabetical order 34 ArrayTools.sort(roots); 35 for (int i = 0; i < roots.length; i++) { 36 // Only add root if it isn't a floppy drive 37 if (!FileSystemView.getFileSystemView().isFloppyDrive(roots[i])) { 38 file_system_root.insert(new WorkspaceTreeNode(roots[i])); 39 } 40 } 27 return new WorkspaceTreeNode(null, Dictionary.get("Tree.Root")); 41 28 } 42 43 return file_system_root;44 29 } 45 30 … … 74 59 static public WorkspaceTreeNode getDownloadedFilesNode() 75 60 { 76 return new WorkspaceTreeNode(Utility.getCacheDir(), "Downloaded Files"); 61 // Return a mapping to the downloaded files folder 62 return new WorkspaceTreeNode(Utility.getCacheDir(), Dictionary.get("Tree.DownloadedFiles")); 77 63 } 78 64 } -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r8783 r8787 78 78 // Add the "Documents in Greenstone Collections" node 79 79 greenstone_collections_node = new WorkspaceTreeNode(null, Dictionary.get("Tree.World")); 80 workspace_tree_root. insert(greenstone_collections_node);80 workspace_tree_root.add(greenstone_collections_node); 81 81 82 82 // Add the "Local Filespace" node 83 83 local_filespace_node = FileSystem.getLocalFilespaceNode(workspace_tree_model); 84 workspace_tree_root. insert(local_filespace_node);84 workspace_tree_root.add(local_filespace_node); 85 85 86 86 // Add the "Home Folder" node 87 workspace_tree_root. insert(FileSystem.getHomeFolderNode());87 workspace_tree_root.add(FileSystem.getHomeFolderNode()); 88 88 89 89 // Add the "Downloaded Files" node, if Mirroring is enabled 90 90 if (Gatherer.g_man.mirror_pane != null) { 91 91 downloaded_files_node = FileSystem.getDownloadedFilesNode(); 92 workspace_tree_root. insert(downloaded_files_node);92 workspace_tree_root.add(downloaded_files_node); 93 93 } 94 94 -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeNode.java
r8785 r8787 30 30 import java.io.*; 31 31 import java.util.*; 32 import javax.swing.filechooser.FileSystemView; 32 33 import org.greenstone.gatherer.Configuration; 33 34 import org.greenstone.gatherer.Dictionary; … … 96 97 public void map() 97 98 { 98 // Special Case: if the name of this node is the Tree.World string, then we actually map the collections installed in greenstone. The file in this case will actually be the collect directory of greenstone.99 // Special Case: "Documents in Greenstone Collections" -- map the collections installed in Greenstone 99 100 if (file == null && title.equals(Dictionary.get("Tree.World"))) { 100 101 // If this node has already been mapped, don't bother doing it again … … 160 161 } 161 162 163 // Special Case: "Local Filespace" on Windows -- create a node for each filesystem root (drive letter) 164 else if (file == null && title.equals(Dictionary.get("Tree.Root"))) { 165 // If this node has already been mapped, don't bother doing it again 166 if (child_nodes != null) { 167 return; 168 } 169 child_nodes = new ArrayList(); 170 171 // Sort the roots into alphabetical order 172 File[] roots = File.listRoots(); 173 ArrayTools.sort(roots); 174 for (int i = 0; i < roots.length; i++) { 175 // Only add root if it isn't a floppy drive 176 if (!FileSystemView.getFileSystemView().isFloppyDrive(roots[i])) { 177 child_nodes.add(addChildNode(roots[i])); 178 } 179 } 180 } 181 162 182 // General case 163 183 else {
Note:
See TracChangeset
for help on using the changeset viewer.