- Timestamp:
- 2007-01-19T16:16:22+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFile.java
r13577 r13706 48 48 static private File loaded_file = null; 49 49 static private Document loaded_file_document = null; 50 static private boolean loaded_file_changed = false; 50 51 51 52 … … 60 61 // If this metadata.xml file isn't the one currently loaded, load it now 61 62 if (loaded_file != this) { 63 // First we must save out the currently loaded file 64 saveLoadedFile(); 65 62 66 // Parse the metadata.xml file 63 67 Document document = XMLTools.parseXMLFile(this); … … 177 181 } 178 182 179 // Re write the metadata.xml file180 XMLTools.writeXMLFile(this, loaded_file_document);183 // Remember that we've changed the file so it gets saved when a new one is loaded 184 loaded_file_changed = true; 181 185 } 182 186 … … 186 190 // If this metadata.xml file isn't the one currently loaded, load it now 187 191 if (loaded_file != this) { 192 // First we must save out the currently loaded file 193 saveLoadedFile(); 194 188 195 // Parse the metadata.xml file 189 196 Document document = XMLTools.parseXMLFile(this); … … 319 326 // If this metadata.xml file isn't the one currently loaded, load it now 320 327 if (loaded_file != this) { 328 // First we must save out the currently loaded file 329 saveLoadedFile(); 330 321 331 // Parse the metadata.xml file 322 332 Document document = XMLTools.parseXMLFile(this); … … 413 423 } 414 424 415 // Re write the metadata.xml file416 XMLTools.writeXMLFile(this, loaded_file_document);425 // Remember that we've changed the file so it gets saved when a new one is loaded 426 loaded_file_changed = true; 417 427 } 418 428 … … 422 432 // If this metadata.xml file isn't the one currently loaded, load it now 423 433 if (loaded_file != this) { 434 // First we must save out the currently loaded file 435 saveLoadedFile(); 436 424 437 // Parse the metadata.xml file 425 438 Document document = XMLTools.parseXMLFile(this); … … 524 537 } 525 538 526 // Rewrite the metadata.xml file 527 XMLTools.writeXMLFile(this, loaded_file_document); 539 // Remember that we've changed the file so it gets saved when a new one is loaded 540 loaded_file_changed = true; 541 } 542 543 544 static public void saveLoadedFile() 545 { 546 // If we have a file loaded into memory and it has been modified, save it now 547 if (loaded_file != null && loaded_file_changed == true) { 548 XMLTools.writeXMLFile(loaded_file, loaded_file_document); 549 loaded_file_changed = false; 550 } 528 551 } 529 552
Note:
See TracChangeset
for help on using the changeset viewer.