(String s)
| 622 | } |
| 623 | |
| 624 | public static synchronized void log(String s) { |
| 625 | if (s==null) return; |
| 626 | if (logPanel==null && ij!=null) { |
| 627 | TextWindow logWindow = new TextWindow("Log", "", 400, 250); |
| 628 | logPanel = logWindow.getTextPanel(); |
| 629 | logPanel.setFont(new Font("SansSerif", Font.PLAIN, 16)); |
| 630 | } |
| 631 | if (logPanel!=null) { |
| 632 | if (s.startsWith("\\")) |
| 633 | handleLogCommand(s); |
| 634 | else { |
| 635 | if (s.endsWith("\n")) { |
| 636 | if (s.equals("\n\n")) |
| 637 | s= "\n \n "; |
| 638 | else if (s.endsWith("\n\n")) |
| 639 | s = s.substring(0, s.length()-2)+"\n \n "; |
| 640 | else |
| 641 | s = s+" "; |
| 642 | } |
| 643 | logPanel.append(s); |
| 644 | } |
| 645 | } else { |
| 646 | LogStream.redirectSystem(false); |
| 647 | System.out.println(s); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | static void handleLogCommand(String s) { |
| 652 | if (s.equals("\\Closed")) |
no test coverage detected