package net.sf.jpluck.util;
import org.syntax.jedit.JEditTextArea;
import org.syntax.jedit.SyntaxDocument;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import javax.swing.text.BadLocationException;
public class JEditTextAreaHandler extends Handler {
private JEditTextArea textArea;
private Formatter formatter;
public JEditTextAreaHandler(JEditTextArea textArea, Formatter formatter) {
this.textArea = textArea;
this.formatter = formatter;
}
public void close() throws SecurityException {
}
public void flush() {
}
public synchronized void publish(LogRecord record) {
try {
SyntaxDocument document = textArea.getDocument();
document.insertString(document.getLength(), formatter.format(record), null);
} catch (BadLocationException e) {
}
}
}