Browse Source

REPORT-23038 修复部分插件与日志输出死锁的问题

research/11.0
vito 5 years ago
parent
commit
ba6aa472c0
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

20
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -199,6 +200,7 @@ public class DesignerLogHandler {
jTextArea.addMouseListener(new MouseAdapter() { jTextArea.addMouseListener(new MouseAdapter() {
// check for right click // check for right click
@Override
public void mousePressed(MouseEvent event) { public void mousePressed(MouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON3) { if (event.getButton() == MouseEvent.BUTTON3) {
@ -219,6 +221,7 @@ public class DesignerLogHandler {
ActionMap actionMap = resultPane.getActionMap(); ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() { actionMap.put("clear", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
resultPane.setText(""); resultPane.setText("");
@ -260,21 +263,25 @@ public class DesignerLogHandler {
printMessage(message, intLevel, date, null); printMessage(message, intLevel, date, null);
} }
private void printMessage(String msg, int intLevel, Date date, Throwable e) { private void printMessage(final String msg, final int intLevel, final Date date, final Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0); @Override
public void run() {
LogHandlerArea.this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
String message = appendLocaleMark(msg, intLevel); String message = appendLocaleMark(msg, intLevel);
this.log(message, intLevel); LogHandlerArea.this.log(message, intLevel);
setMessage(message, intLevel); setMessage(message, intLevel);
if (e == null) { if (e == null) {
return; return;
} }
StackTraceElement[] traceElements = e.getStackTrace(); StackTraceElement[] traceElements = e.getStackTrace();
for (int i = 0; i < traceElements.length; i++) { for (StackTraceElement traceElement : traceElements) {
this.log("\t" + "at " + traceElements[i].toString() + "\n", 0); LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0);
} }
} }
});
}
private void log(String str, int style) { private void log(String str, int style) {
@ -346,6 +353,7 @@ public class DesignerLogHandler {
ActionListener popupListener = new ActionListener() { ActionListener popupListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) { if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) {

Loading…
Cancel
Save