From: <jtc...@li...> - 2006-03-27 17:30:29
|
Update of /cvsroot/jtcfrost/frost-wot/source/frost/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16796/source/frost/ext Modified Files: AltEdit.java Log Message: fixes Index: AltEdit.java =================================================================== RCS file: /cvsroot/jtcfrost/frost-wot/source/frost/ext/AltEdit.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AltEdit.java 22 Mar 2006 20:15:20 -0000 1.4 --- AltEdit.java 27 Mar 2006 17:30:24 -0000 1.5 *************** *** 27,30 **** --- 27,31 ---- import frost.*; + import frost.gui.*; import frost.util.gui.translation.*; *************** *** 34,40 **** * @author bback */ ! public class AltEdit { ! Language language = Language.getInstance(); private Frame parentFrame; --- 35,41 ---- * @author bback */ ! public class AltEdit extends Thread { ! private Language language = Language.getInstance(); private Frame parentFrame; *************** *** 47,64 **** private final String TEXT_MARKER = language.getString("*--- Enter your text after this line ---*"); ! private String reportSubject = null; ! private String reportText = null; ! public AltEdit(String subject, String text, Frame parentFrame) { this.parentFrame = parentFrame; this.oldSubject = subject; this.oldText = text; } ! public boolean run() { // paranoia if( Core.frostSettings.getBoolValue("useAltEdit") == false ) { ! return false; } --- 48,76 ---- private final String TEXT_MARKER = language.getString("*--- Enter your text after this line ---*"); ! private Object transferObject; ! private MessageFrame callbackTarget; ! public AltEdit(String subject, String text, Frame parentFrame, Object transferObject, MessageFrame callbackTarget) { this.parentFrame = parentFrame; this.oldSubject = subject; this.oldText = text; + this.transferObject = transferObject; + this.callbackTarget = callbackTarget; + } + + private void callbackMessageFrame(final String newSubject, final String newText) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + callbackTarget.altEditCallback(transferObject, newSubject, newText); + } + }); } ! public void run() { // paranoia if( Core.frostSettings.getBoolValue("useAltEdit") == false ) { ! callbackMessageFrame(null, null); ! return; } *************** *** 70,74 **** "Error", JOptionPane.ERROR_MESSAGE); ! return false; } --- 82,87 ---- "Error", JOptionPane.ERROR_MESSAGE); ! callbackMessageFrame(null, null); ! return; } *************** *** 78,82 **** language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! return false; } --- 91,96 ---- language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! callbackMessageFrame(null, null); ! return; } *************** *** 93,97 **** language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! return false; } editFile.deleteOnExit(); --- 107,112 ---- language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! callbackMessageFrame(null, null); ! return; } editFile.deleteOnExit(); *************** *** 111,115 **** language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! return false; } sb = null; --- 126,131 ---- language.getString("Error"), JOptionPane.ERROR_MESSAGE); ! callbackMessageFrame(null, null); ! return; } sb = null; *************** *** 124,128 **** JOptionPane.ERROR_MESSAGE); editFile.delete(); ! return false; } --- 140,145 ---- JOptionPane.ERROR_MESSAGE); editFile.delete(); ! callbackMessageFrame(null, null); ! return; } *************** *** 134,138 **** JOptionPane.ERROR_MESSAGE); editFile.delete(); ! return false; } --- 151,156 ---- JOptionPane.ERROR_MESSAGE); editFile.delete(); ! callbackMessageFrame(null, null); ! return; } *************** *** 157,161 **** JOptionPane.ERROR_MESSAGE); editFile.delete(); ! return false; } line = (String)it.next(); --- 175,180 ---- JOptionPane.ERROR_MESSAGE); editFile.delete(); ! callbackMessageFrame(null, null); ! return; } line = (String)it.next(); *************** *** 166,170 **** JOptionPane.ERROR_MESSAGE); editFile.delete(); ! return false; } newSubject = line.trim(); --- 185,190 ---- JOptionPane.ERROR_MESSAGE); editFile.delete(); ! callbackMessageFrame(null, null); ! return; } newSubject = line.trim(); *************** *** 184,203 **** JOptionPane.ERROR_MESSAGE); editFile.delete(); ! return false; } // finished, we have a newSubject and a newText now ! reportSubject = newSubject; ! reportText = newTextSb.toString(); ! ! return true; ! } ! ! public String getNewSubject() { ! return reportSubject; ! } ! ! public String getNewText() { ! return reportText; } } --- 204,213 ---- JOptionPane.ERROR_MESSAGE); editFile.delete(); ! callbackMessageFrame(null, null); ! return; } // finished, we have a newSubject and a newText now ! callbackMessageFrame(newSubject, newTextSb.toString()); } } |