From ceaddf2019255bda89bdbb678849db7e6d14757e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 27 Jul 2013 15:32:25 +0200 Subject: [PATCH] Errors logging fix --- .../decompiler/flash/gui/ErrorLogFrame.java | 4 +- .../jpexs/decompiler/flash/gui/MainFrame.java | 56 +++++++++++-------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java index 7e2372ca2..4a990e030 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java @@ -43,6 +43,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; /** * @@ -88,7 +89,7 @@ public class ErrorLogFrame extends AppFrame { } private void log(final Level level, final String msg, final String detail) { - View.execInEventDispatch(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JPanel pan = new JPanel(); @@ -197,6 +198,7 @@ public class ErrorLogFrame extends AppFrame { } }); + } public void log(Level level, String msg) { diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index eb94647d0..2237b125f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -1401,30 +1401,42 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel private int pos = 0; @Override - public void publish(LogRecord record) { - if (record.getLevel() == Level.SEVERE) { - errorNotificationButton.setIcon(View.getIcon("error16")); - errorNotificationButton.setToolTipText(translate("errors.present")); - if (timer != null) { - timer.cancel(); - } - timer = new Timer(); - timer.schedule(new TimerTask() { - @Override - public void run() { - pos++; - if ((pos % 2) == 0) { - errorNotificationButton.setIcon(View.getIcon("error16")); - } else { - errorNotificationButton.setIcon(null); - errorNotificationButton.setSize(16, 16); - } - if (pos >= 4) { - cancel(); + public void publish(final LogRecord record) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (record.getLevel() == Level.SEVERE) { + errorNotificationButton.setIcon(View.getIcon("error16")); + errorNotificationButton.setToolTipText(translate("errors.present")); + if (timer != null) { + timer.cancel(); } + timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + View.execInEventDispatch(new Runnable() { + @Override + public void run() { + pos++; + if ((pos % 2) == 0 || (pos>=4)) { + errorNotificationButton.setIcon(View.getIcon("error16")); + } else { + errorNotificationButton.setIcon(null); + errorNotificationButton.setSize(16, 16); + } + } + }); + + if (pos >= 4) { + cancel(); + } + } + }, 500, 500); } - }, 500, 500); - } + } + }); + } @Override