| 38 | } |
| 39 | |
| 40 | static class Implementation implements ImageJInstance { |
| 41 | int counter = 0; |
| 42 | |
| 43 | public void sendArgument(String cmd) { |
| 44 | if (IJ.debugMode) IJ.log("SocketServer.sendArgument: \""+ cmd+"\""); |
| 45 | if (cmd.startsWith("open ")) |
| 46 | (new Opener(Opener.OpenOption.SKIP_UI)).openAndAddToRecent(cmd.substring(5)); |
| 47 | else if (cmd.startsWith("macro ")) { |
| 48 | String name = cmd.substring(6); |
| 49 | String name2 = name; |
| 50 | String arg = null; |
| 51 | int index = name2.indexOf(DELIMETER); |
| 52 | if (index!=-1) { |
| 53 | name = name2.substring(0, index); |
| 54 | arg = name2.substring(index+DELIMETER.length(), name2.length()); |
| 55 | } |
| 56 | IJ.runMacroFile(name, arg); |
| 57 | } else if (cmd.startsWith("run ")) |
| 58 | IJ.run(cmd.substring(4)); |
| 59 | else if (cmd.startsWith("eval ")) { |
| 60 | String rtn = IJ.runMacro(cmd.substring(5)); |
| 61 | if (rtn!=null) |
| 62 | System.out.print(rtn); |
| 63 | } else if (cmd.startsWith("user.dir ")) { |
| 64 | OpenDialog.setDefaultDirectory(cmd.substring(9)); |
| 65 | System.setProperty("user.dir", cmd.substring(9)); |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | @AstroImageJ(reason = "Replace method of cross-instance communication", modified = true) |
| 71 | public static String getStubPath() { |
nothing calls this directly
no outgoing calls
no test coverage detected