()
| 57 | } |
| 58 | |
| 59 | public void run() { |
| 60 | if (command==null) |
| 61 | return; |
| 62 | if (listeners.size()>0) synchronized (listeners) { |
| 63 | for (int i=0; i<listeners.size(); i++) { |
| 64 | CommandListener listener = (CommandListener)listeners.elementAt(i); |
| 65 | command = listener.commandExecuting(command); |
| 66 | if (command==null) return; |
| 67 | } |
| 68 | } |
| 69 | try { |
| 70 | if (IJ.recording()) { |
| 71 | Recorder.setCommand(command); |
| 72 | runCommand(command); |
| 73 | Recorder.saveCommand(); |
| 74 | } else |
| 75 | runCommand(command); |
| 76 | int len = command.length(); |
| 77 | if (len>0 && command.charAt(len-1)!=']') |
| 78 | IJ.setKeyUp(IJ.ALL_KEYS); // set keys up except for "<", ">", "+" and "-" shortcuts |
| 79 | } catch(Throwable e) { |
| 80 | IJ.showStatus(""); |
| 81 | IJ.showProgress(1, 1); |
| 82 | ImagePlus imp = WindowManager.getCurrentImage(); |
| 83 | if (imp!=null) imp.unlock(); |
| 84 | String msg = e.getMessage(); |
| 85 | if (e instanceof OutOfMemoryError) |
| 86 | IJ.outOfMemory(command); |
| 87 | else if (e instanceof RuntimeException && msg!=null && msg.equals(Macro.MACRO_CANCELED)) |
| 88 | ; //do nothing |
| 89 | else { |
| 90 | CharArrayWriter caw = new CharArrayWriter(); |
| 91 | PrintWriter pw = new PrintWriter(caw); |
| 92 | e.printStackTrace(pw); |
| 93 | String s = caw.toString(); |
| 94 | if (IJ.isMacintosh()) { |
| 95 | if (s.indexOf("ThreadDeath")>0) |
| 96 | return; |
| 97 | s = Tools.fixNewLines(s); |
| 98 | } |
| 99 | int w=500, h=340; |
| 100 | if (s.indexOf("UnsupportedClassVersionError")!=-1) { |
| 101 | if (s.indexOf("version 49.0")!=-1) { |
| 102 | s = e + "\n \nThis plugin requires Java 1.5 or later."; |
| 103 | w=700; h=150; |
| 104 | } |
| 105 | if (s.indexOf("version 50.0")!=-1) { |
| 106 | s = e + "\n \nThis plugin requires Java 1.6 or later."; |
| 107 | w=700; h=150; |
| 108 | } |
| 109 | if (s.indexOf("version 51.0")!=-1) { |
| 110 | s = e + "\n \nThis plugin requires Java 1.7 or later."; |
| 111 | w=700; h=150; |
| 112 | } |
| 113 | if (s.indexOf("version 52.0")!=-1) { |
| 114 | s = e + "\n \nThis plugin requires Java 1.8 or later."; |
| 115 | w=700; h=150; |
| 116 | } |
no test coverage detected