Changeset 7484 for trunk/gli/src/org/greenstone/gatherer/file
- Timestamp:
- 2004-05-28T13:41:13+12:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/file
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileManager.java
r7361 r7484 131 131 FileNode folder_node = new FileNode(folder_file); 132 132 SynchronizedTreeModelTools.insertNodeInto(model, parent_node, folder_node); 133 134 // Refresh workspace tree (collection tree is done automatically) 135 Gatherer.g_man.refreshWorkspaceTree(DragTree.COLLECTION_CONTENTS_CHANGED); 136 133 137 folder_node = null; 134 138 } -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r7203 r7484 2 2 3 3 import javax.swing.tree.TreePath; 4 import org.greenstone.gatherer.Gatherer; 4 5 import org.greenstone.gatherer.collection.CollectionManager; 5 6 import org.greenstone.gatherer.file.FileNode; … … 13 14 static private FileNode workspace_tree_root = null; 14 15 static private WorkspaceTreeModel workspace_tree_model = null; 16 15 17 static private FileNode greenstone_collections_mapping = null; 16 18 static private FileNode local_filespace_mapping = null; 17 static private FileNode web_cache_mapping = null;18 static private FileNode[] collection_specific_mappings = null;19 // static private FileNode web_cache_mapping = null; 20 static private FileNode[] folder_shortcuts = null; 19 21 20 22 … … 43 45 44 46 // Add public and private web caches if applicable 45 loadWebCacheMappings();47 // loadWebCacheMappings(); 46 48 47 // Add any collection specific mappings48 loadCollectionSpecificMappings();49 // Add any folder shortcuts the user has created 50 refreshFolderShortcuts(); 49 51 50 52 return workspace_tree_model; … … 52 54 53 55 54 static private void loadWebCacheMappings()55 {56 // If mirroring is enabled show the public and private caches57 web_cache_mapping = MirrorPane.getWebCacheMapping();58 if (web_cache_mapping != null) {59 workspace_tree_root.insert(web_cache_mapping);60 }61 }62 63 64 static private void loadCollectionSpecificMappings()65 {66 ///ystem.err.print("Load Collection Specific Mappings... ");67 // Add the current collection specific mappings68 collection_specific_mappings = CollectionManager.getCollectionSpecificMappings();69 ///ystem.err.print("Retrieved Mappings... ");70 if (collection_specific_mappings != null) {71 for (int i = 0; i < collection_specific_mappings.length; i++) {72 ///ystem.err.print("Setting " + i + " Mapping... ");73 SynchronizedTreeModelTools.insertNodeInto(workspace_tree_model, workspace_tree_root, collection_specific_mappings[i], false);74 }75 }76 ///ystem.err.println("Done.");77 }78 79 80 // !! NEEDS WORK !!81 56 static public void refreshGreenstoneCollectionsMapping() 82 57 { … … 86 61 87 62 88 // !! NEEDS WORK !! 89 static public void refreshWebCacheMappings() 63 static public void refreshFolderShortcuts() 90 64 { 91 if (web_cache_mapping != null) {92 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, web_cache_mapping);93 }65 // Check for new/deleted folder shortcuts 66 FileNode[] old_folder_shortcuts = folder_shortcuts; 67 folder_shortcuts = CollectionManager.getFolderShortcuts(); 94 68 95 loadWebCacheMappings(); 96 97 } 98 99 100 // !! NEEDS WORK !! 101 static public void refreshCollectionSpecificMappings() 102 { 103 // Remove all the old collection specific mappings 104 if (collection_specific_mappings != null) { 105 for (int i = 0; i < collection_specific_mappings.length; i++) { 106 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 107 collection_specific_mappings[i]); 69 // Remove any deleted shortcuts from the tree 70 if (old_folder_shortcuts != null) { 71 for (int i = 0; i < old_folder_shortcuts.length; i++) { 72 if (!doesArrayContain(folder_shortcuts, old_folder_shortcuts[i])) { 73 Gatherer.println("Deleted shortcut: " + old_folder_shortcuts[i]); 74 SynchronizedTreeModelTools.removeNodeFromParent(workspace_tree_model, 75 old_folder_shortcuts[i]); 76 } 108 77 } 109 78 } 110 79 111 loadCollectionSpecificMappings(); 80 // Add any new shortcuts to the tree 81 if (folder_shortcuts != null) { 82 for (int i = 0; i < folder_shortcuts.length; i++) { 83 if (!doesArrayContain(old_folder_shortcuts, folder_shortcuts[i])) { 84 Gatherer.println("Added shortcut: " + folder_shortcuts[i]); 85 SynchronizedTreeModelTools.insertNodeInto(workspace_tree_model, workspace_tree_root, folder_shortcuts[i], false); 86 } 87 } 88 } 112 89 } 113 90 … … 132 109 } 133 110 } 111 112 113 static private boolean doesArrayContain(Object[] array, Object item) 114 { 115 if (array == null) { 116 return false; 117 } 118 119 for (int i = 0; i < array.length; i++) { 120 if (item.toString().equals(array[i].toString())) { 121 return true; 122 } 123 } 124 125 return false; 126 } 134 127 }
Note:
See TracChangeset
for help on using the changeset viewer.