(String s)
| 649 | } |
| 650 | |
| 651 | static void handleLogCommand(String s) { |
| 652 | if (s.equals("\\Closed")) |
| 653 | logPanel = null; |
| 654 | else if (s.startsWith("\\Update:")) { |
| 655 | int n = logPanel.getLineCount(); |
| 656 | String s2 = s.substring(8, s.length()); |
| 657 | if (n==0) |
| 658 | logPanel.append(s2); |
| 659 | else |
| 660 | logPanel.setLine(n-1, s2); |
| 661 | } else if (s.startsWith("\\Update")) { |
| 662 | int cindex = s.indexOf(":"); |
| 663 | if (cindex==-1) |
| 664 | {logPanel.append(s); return;} |
| 665 | String nstr = s.substring(7, cindex); |
| 666 | int line = (int)Tools.parseDouble(nstr, -1); |
| 667 | if (line<0 || line>25) |
| 668 | {logPanel.append(s); return;} |
| 669 | int count = logPanel.getLineCount(); |
| 670 | while (line>=count) { |
| 671 | log(""); |
| 672 | count++; |
| 673 | } |
| 674 | String s2 = s.substring(cindex+1, s.length()); |
| 675 | logPanel.setLine(line, s2); |
| 676 | } else if (s.equals("\\Clear")) { |
| 677 | logPanel.clear(); |
| 678 | } else if (s.startsWith("\\Heading:")) { |
| 679 | logPanel.updateColumnHeadings(s.substring(10)); |
| 680 | } else if (s.equals("\\Close")) { |
| 681 | Frame f = WindowManager.getFrame("Log"); |
| 682 | if (f!=null && (f instanceof TextWindow)) |
| 683 | ((TextWindow)f).close(); |
| 684 | } else |
| 685 | logPanel.append(s); |
| 686 | } |
| 687 | |
| 688 | /** Returns the contents of the Log window or null if the Log window is not open. */ |
| 689 | public static synchronized String getLog() { |
no test coverage detected