Changeset 5854
- Timestamp:
- 2003-11-16T17:50:12+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r5847 r5854 1082 1082 } 1083 1083 } 1084 }1085 1086 /** Refresh the Greenstone Collections special mapping in the workspace tree to account for collections being added/removed1087 */1088 public void refreshGreenstoneCollections()1089 {1090 Gatherer.g_man.collection_pane.refreshWorkspaceTree(WorkspaceTree.COLLECTION_CHANGED);1091 1092 /* FileNode root = (FileNode) workspace_model.getRoot();1093 FileNode greenstone_collections_node = null;1094 int root_child_count = root.getChildCount();1095 String greenstone_collections_str = Dictionary.get("Tree.World");1096 for(int i = 0; greenstone_collections_node == null && i < root_child_count; i++) {1097 TreeNode child = root.getChildAt(i);1098 if(child.toString().equals(greenstone_collections_str)) {1099 greenstone_collections_node = (FileNode) child;1100 }1101 child = null;1102 }1103 greenstone_collections_str = null;1104 root = null;1105 if(greenstone_collections_node != null) {1106 TreePath greenstone_collections_path = new TreePath(greenstone_collections_node.getPath());1107 workspace_model.refresh(greenstone_collections_path);1108 greenstone_collections_path = null;1109 greenstone_collections_node = null;1110 } */1111 1084 } 1112 1085 -
trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java
r5724 r5854 47 47 import org.greenstone.gatherer.gui.ModalDialog; 48 48 import org.greenstone.gatherer.gui.SimpleMenuBar; 49 import org.greenstone.gatherer.gui.tree.DragTree; 49 50 import org.greenstone.gatherer.util.ArrayTools; 50 51 import org.greenstone.gatherer.util.GSDLSiteConfig; … … 244 245 */ 245 246 public void actionPerformed(ActionEvent event) { 246 // Ask the collection manager to refresh the 'Greenstone Collections' folder247 Gatherer.c_man.refreshGreenstoneCollections();248 247 // Done 249 248 prompt.dispose(); … … 312 311 File delete_me = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator); 313 312 if(Utility.delete(delete_me)) { 314 if (Gatherer.c_man.getCollection() !=null && collection.getName().equals(Gatherer.c_man.getCollection().getName())) {313 if (Gatherer.c_man.getCollection() != null && collection.getName().equals(Gatherer.c_man.getCollection().getName())) { 315 314 current_coll_deleted = true; 316 315 } 316 list_model.removeElement(collection); 317 318 // Refresh the collects shown in the workspace tree 319 Gatherer.g_man.collection_pane.refreshWorkspaceTree(DragTree.LIBRARY_CONTENTS_CHANGED); 317 320 318 321 resultPrompt(true); 319 list_model.removeElement(collection);320 322 Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection"); 321 323 confirmation.setEnabled(false); -
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r5785 r5854 275 275 files = tools.filter(files, filters[i].filter, filters[i].exclude); 276 276 } 277 278 // If this node just happens to be the greenstone collection directory279 if(Gatherer.c_man != null && Gatherer.c_man.ready() && file.equals(new File(Utility.getCollectionDir(Gatherer.config.gsdl_path)))) {280 // Preclude the directory of any open collection281 String collection_name = Gatherer.c_man.getCollection().getName();282 for(int j = 0; j < files.length; j++) {283 ///ystem.err.println("Does " + files[j].getName() + " equal " + collection_name + "?");284 if(files[j].getName().equals(collection_name)) {285 // Remove the offending directory286 files = ArrayTools.remove(files, j);287 }288 }289 }277 //} 278 // // If this node just happens to be the greenstone collection directory 279 // if(Gatherer.c_man != null && Gatherer.c_man.ready() && file.equals(new File(Utility.getCollectionDir(Gatherer.config.gsdl_path)))) { 280 // // Preclude the directory of any open collection 281 // String collection_name = Gatherer.c_man.getCollection().getName(); 282 // for(int j = 0; j < files.length; j++) { 283 // ///ystem.err.println("Does " + files[j].getName() + " equal " + collection_name + "?"); 284 // if(files[j].getName().equals(collection_name)) { 285 // // Remove the offending directory 286 // files = ArrayTools.remove(files, j); 287 // } 288 // } 289 // } 290 290 // Finally remove any files whose canonical path do not match their absolute one (ie symbolic links). We only do this test under linux, because under windows there is no such thing as a symbolic link, and instead we suffer difficulties with the 16bit truncated file paths not being the same as the canonical ones (i.e Program Files => Progra~1). 291 291 /* This test to eliminate infinite recursions causes more problems than it solves -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r5847 r5854 11 11 static private FileNode workspace_tree_root = null; 12 12 static private WorkspaceTreeModel workspace_tree_model = null; 13 static private FileNode greenstone_collections_mapping = null; 13 14 static private FileNode[] collection_specific_mappings = null; 14 15 … … 27 28 28 29 // Add the Greenstone Collections mapping 29 workspace_tree_root.insert(CollectionManager.getGreenstoneCollectionsMapping()); 30 greenstone_collections_mapping = CollectionManager.getGreenstoneCollectionsMapping(); 31 workspace_tree_root.insert(greenstone_collections_mapping); 30 32 31 33 // Add the local filespace … … 61 63 62 64 65 static public void refreshGreenstoneCollectionsMapping() 66 { 67 greenstone_collections_mapping.unmap(); 68 greenstone_collections_mapping.map(); 69 } 70 71 63 72 static public void refreshCollectionSpecificMappings() 64 73 { -
trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java
r5847 r5854 244 244 collection_tree_sync.add(collection_tree); 245 245 246 refreshWorkspaceTree(DragTree. COLLECTION_CHANGED);247 refreshCollectionTree(DragTree. COLLECTION_CHANGED);246 refreshWorkspaceTree(DragTree.LOADED_COLLECTION_CHANGED); 247 refreshCollectionTree(DragTree.LOADED_COLLECTION_CHANGED); 248 248 249 249 // Enable or disable the control buttons … … 504 504 workspace_tree.refresh(refresh_reason); 505 505 } 506 507 508 /* public void refreshWorkspace() {509 System.err.println("CollectionPane::refreshWorkspace()... (ignored)");510 // workspace = Gatherer.c_man.getWorkspace();511 // workspace_tree.setModel(workspace);512 // workspace_tree_sync.add(workspace_tree);513 } */514 506 515 507 -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r5847 r5854 54 54 static private final int AUTOSCROLL_MARGIN = 12; 55 55 56 static public int COLLECTION_CHANGED = 1; 56 static public int LIBRARY_CONTENTS_CHANGED = 0; 57 static public int LOADED_COLLECTION_CHANGED = 1; 57 58 static public int COLLECTION_CONTENTS_CHANGED = 2; 58 59 static public int TREE_DISPLAY_CHANGED = 3; -
trunk/gli/src/org/greenstone/gatherer/gui/tree/WorkspaceTree.java
r5847 r5854 25 25 System.err.print("WorkspaceTree::refresh()... "); 26 26 27 // A collection has been opened/closed - reload the workspace tree model 28 if (refresh_reason == DragTree.COLLECTION_CHANGED) { 29 System.err.println("Reason: collection changed."); 27 // The collections in the library have changed - refresh the collect directory 28 if (refresh_reason == DragTree.LIBRARY_CONTENTS_CHANGED) { 29 System.err.println("Reason: library contents changed."); 30 String collect_directory_str = Gatherer.config.gsdl_path + Utility.COL_DIR; 31 refreshEveryNodeShowingFolder(collect_directory_str); 32 WorkspaceTreeModel.refreshGreenstoneCollectionsMapping(); 33 } 34 35 // A collection has been opened/closed - reload the whole shebang 36 if (refresh_reason == DragTree.LOADED_COLLECTION_CHANGED) { 37 System.err.println("Reason: loaded collection changed."); 30 38 setModel(WorkspaceTreeModel.getWorkspaceTreeModel()); 31 39 } 32 40 33 // The collection's contents have changed - refresh expanded parts of the collection41 // The collection's contents have changed - refresh collection's import folder 34 42 if (refresh_reason == DragTree.COLLECTION_CONTENTS_CHANGED) { 35 43 System.err.println("Reason: collection contents changed."); 36 37 44 String import_directory_str = Gatherer.c_man.getCollectionImport(); 38 39 TreePath tree_root_path = new TreePath(getModel().getRoot()); 40 Enumeration expanded_tree_paths = getExpandedDescendants(tree_root_path); 41 while (expanded_tree_paths.hasMoreElements()) { 42 TreePath expanded_tree_path = (TreePath) expanded_tree_paths.nextElement(); 43 FileNode tree_node = (FileNode) expanded_tree_path.getLastPathComponent(); 44 45 File tree_node_file = tree_node.getFile(); 46 if (tree_node_file == null) { 47 continue; 48 } 49 50 // Get the path of the open tree node 51 String tree_node_path_str = tree_node_file.toString(); 52 if (!tree_node_path_str.endsWith(File.separator)) { 53 tree_node_path_str = tree_node_path_str + File.separator; 54 } 55 56 // If the collection import directory is open, it must be refreshed 57 if (tree_node_path_str.equals(import_directory_str)) { 58 System.err.println("Must refresh collection import directory!"); 59 ((FileSystemModel) getModel()).refresh(expanded_tree_path); 60 } 61 } 45 refreshEveryNodeShowingFolder(import_directory_str); 62 46 } 63 47 … … 74 58 } 75 59 } 60 61 62 private void refreshEveryNodeShowingFolder(String folder_path_str) 63 { 64 // Search through the expanded tree paths, checking if any show the given folder 65 TreePath tree_root_path = new TreePath(getModel().getRoot()); 66 Enumeration expanded_tree_paths = getExpandedDescendants(tree_root_path); 67 while (expanded_tree_paths.hasMoreElements()) { 68 TreePath expanded_tree_path = (TreePath) expanded_tree_paths.nextElement(); 69 FileNode tree_node = (FileNode) expanded_tree_path.getLastPathComponent(); 70 71 File tree_node_file = tree_node.getFile(); 72 if (tree_node_file == null) { 73 continue; 74 } 75 76 // Get the path of the open tree node 77 String tree_node_path_str = tree_node_file.toString(); 78 if (!tree_node_path_str.endsWith(File.separator)) { 79 tree_node_path_str = tree_node_path_str + File.separator; 80 } 81 82 // If the collection import directory is open, it must be refreshed 83 if (tree_node_path_str.equals(folder_path_str)) { 84 System.err.println("Must refresh node " + tree_node_path_str + "!"); 85 ((FileSystemModel) getModel()).refresh(expanded_tree_path); 86 } 87 } 88 } 76 89 }
Note:
See TracChangeset
for help on using the changeset viewer.