Changeset 37699


Ignore:
Timestamp:
2023-04-21T18:46:30+12:00 (12 months ago)
Author:
anupama
Message:

Related to commits r 37690, 37691 (and 37698). 1. Shifted the section that calls moveAnyKeepOldToArchives() to before the SpecialCharacter is added to start of the build log, it made no difference to a Cancel press appearing in the end as an Error message and error status value (not a fatal issue, and has always worked this way in GLI). 2. Calling document.appendLine directly instead of calling shell.fireMessage() to add informative statemenst when moving archives_keepold to archives in moveAnyKeepOldToArchives(). This is because fireMessage prepends a propt starting import.pl to the messages displayed, which implies that my messages are emanating from import.pl, which is not correct (they are GLI code, after import.pl has been cancelled/on error). 3. Added useful debug statement back in, commented out, should we need to debug even status and type again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r37691 r37699  
    623623        simple_cancel_button.setEnabled(false);
    624624        simple_preview_button.setEnabled(been_built);
    625         if(event.getStatus() == GShell.CANCELLED) {
    626         document.setSpecialCharacter(OptionsPane.CANCELLED);
    627         }
    628         else {
    629         document.setSpecialCharacter(OptionsPane.UNSUCCESSFUL);
    630         }
    631 
     625
     626       
    632627        // If import was cancelled OR an error occurred, move any archives_keepold to archives
    633628        if(event.getType() == GShell.IMPORT &&
    634629           (event.getStatus() == GShell.CANCELLED || event.getStatus() == GShell.ERROR)) {
     630
     631        //System.err.println("processComplete(), got status: " + event.getStatus()
     632        //+ " - build type: " + event.getType());
     633       
    635634        moveAnyKeepOldToArchives();
    636635        }
     636       
     637        if(event.getStatus() == GShell.CANCELLED) {
     638        document.setSpecialCharacter(OptionsPane.CANCELLED);
     639        }
     640        else {
     641        document.setSpecialCharacter(OptionsPane.UNSUCCESSFUL);
     642        }
     643
    637644       
    638645        options_pane.resetFileEntry();
     
    654661        if(archives_keepold_dir.exists()) {
    655662        String statusMsg = "archives_keepold folder detected. Attempting to restore it as archives...";
    656         //log_textarea.setCaretPosition(document.getLengthToNearestLine());
    657         //document.appendLine(statusMsg);
    658         System.err.println(statusMsg);
    659         this.shell.fireMessage(statusMsg);
     663        log_textarea.setCaretPosition(document.getLengthToNearestLine());       
     664        //System.err.println(statusMsg);
     665        document.appendLine(statusMsg); //this.shell.fireMessage(statusMsg);
    660666       
    661667        String archives = CollectionManager.getLoadedCollectionArchivesDirectoryPath();
     
    669675            statusMsg = "Failed to delete " + archives_dir
    670676            + "  in attempt to rename archives_keepold to archives";
    671             System.err.println(statusMsg);
    672             this.shell.fireMessage(statusMsg);
     677            //System.err.println(statusMsg);           
     678            document.appendLine(statusMsg); //this.shell.fireMessage(statusMsg);
    673679        }     
    674680
     
    678684            statusMsg = "Failed to rename " + archives_keepold_dir
    679685                + "\n  to " + archives_dir;
    680             System.err.println(statusMsg);
    681             this.shell.fireMessage(statusMsg);
     686            //System.err.println(statusMsg);           
     687            document.appendLine(statusMsg); //this.shell.fireMessage(statusMsg);
    682688            }
    683         }       
     689        }
     690
     691        // repeating what CreatePane::message() does (called by GShell::firemessage())
     692        log_textarea.setCaretPosition(document.getLengthToNearestLine());
    684693        }
    685694    }
Note: See TracChangeset for help on using the changeset viewer.