Changeset 12739
- Timestamp:
- 2006-09-14T12:46:05+12:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r12646 r12739 332 332 public void createCollection(String description, String email, String name, String title, File base_collection_directory, ArrayList metadata_sets) 333 333 { 334 // Display a modal progress popup to indicate that the collection is being loaded 335 ModalProgressPopup create_collection_progress_popup = new ModalProgressPopup(Dictionary.get("CollectionManager.Creating_Collection"), Dictionary.get("CollectionManager.Creating_Collection_Please_Wait")); 336 create_collection_progress_popup.display(); 337 338 // Create the collection on a separate thread so the progress bar updates correctly 339 (new CreateCollectionTask(description, email, name, title, base_collection_directory, metadata_sets, create_collection_progress_popup)).start(); 340 } 341 342 343 private class CreateCollectionTask 344 extends Thread 345 { 346 private String description = null; 347 private String email = null; 348 private String name = null; 349 private String title = null; 350 private File base_collection_directory = null; 351 private ArrayList metadata_sets = null; 352 private ModalProgressPopup create_collection_progress_popup = null; 353 354 public CreateCollectionTask(String description, String email, String name, String title, File base_collection_directory, ArrayList metadata_sets, ModalProgressPopup create_collection_progress_popup) 355 { 356 this.description = description; 357 this.email = email; 358 this.name = name; 359 this.title = title; 360 this.base_collection_directory = base_collection_directory; 361 this.metadata_sets = metadata_sets; 362 this.create_collection_progress_popup = create_collection_progress_popup; 363 } 364 365 public void run() 366 { 367 createCollectionInternal(description, email, name, title, base_collection_directory, metadata_sets); 368 create_collection_progress_popup.close(); 369 } 370 } 371 372 373 private void createCollectionInternal(String description, String email, String name, String title, File base_collection_directory, ArrayList metadata_sets) 374 { 334 375 try { 335 376 // first make sure that the collect directory exists … … 339 380 } 340 381 341 // Create a progress monitor342 ProgressMonitor progress = new ProgressMonitor(Gatherer.g_man, Dictionary.get("CollectionManager.Creating_New"), "mkcol.pl", 0, 4);343 344 382 // Create the new collection 345 383 makeCollection(name, email); 346 progress.setProgress(1);347 384 348 385 // Check that the collection has been created successfully … … 351 388 // If there is no collection directory then the creation was unsuccessful, or cancelled 352 389 System.err.println("No collection directory..."); 353 progress.close();354 390 return; 355 391 } … … 360 396 System.err.println("Error: no collect.cfg file has been created!"); 361 397 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Cannot_Create_Collection_With_Reason", Dictionary.get("CollectionManager.No_Config_File")), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 362 progress.close();363 398 return; 364 399 } … … 367 402 File log_dir = new File(collection_directory_path + "log"); 368 403 log_dir.mkdirs(); 369 progress.setNote(Dictionary.get("CollectionManager.Log_Created"));370 404 371 405 // Make sure an import folder exists … … 374 408 import_directory.mkdirs(); 375 409 } 376 377 progress.setProgress(2);378 410 379 411 // Now create the collection object around the directory. … … 465 497 466 498 collection.cdm.save(true); 467 progress.setProgress(3);468 499 469 500 // Create a lock file 470 501 createLockFile(new File(collection_directory_path, LOCK_FILE)); 471 502 472 progress.setProgress(4); 473 progress.setNote(Dictionary.get("CollectionManager.Session_Ready", name)); 474 progress.close(); 503 // We're done. Let everyone know. 504 Gatherer.refresh(Gatherer.COLLECTION_OPENED); 475 505 } 476 506 catch (Exception error) { -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r12609 r12739 786 786 Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), metadata_sets); 787 787 ncd_prompt.dispose(); 788 789 // Return to some initial pane (Gather)790 returnToInitialPane();791 792 // Refresh the workspace tree to allow for the new collection793 refreshWorkspaceTree(WorkspaceTree.LIBRARY_CONTENTS_CHANGED);794 795 // Refresh the rest of the GLI796 Gatherer.refresh(Gatherer.COLLECTION_OPENED);797 788 } 798 789
Note:
See TracChangeset
for help on using the changeset viewer.