(String name, int type, String methods)
| 106 | } |
| 107 | |
| 108 | public void createPlugin(String name, int type, String methods) { |
| 109 | ed = (Editor)IJ.runPlugIn("ij.plugin.frame.Editor", ""); |
| 110 | if (ed==null) return; |
| 111 | String pluginName = name; |
| 112 | if (!(name.endsWith(".java") || name.endsWith(".JAVA"))) |
| 113 | name = SaveDialog.setExtension(name, ".java"); |
| 114 | String className = pluginName.substring(0, pluginName.length()-5); |
| 115 | String text = ""; |
| 116 | text += "import ij.*;\n"; |
| 117 | text += "import ij.process.*;\n"; |
| 118 | text += "import ij.gui.*;\n"; |
| 119 | text += "import java.awt.*;\n"; |
| 120 | text += "import ij.plugin.*;\n"; |
| 121 | text += "\n"; |
| 122 | text += "public class "+className+" implements PlugIn {\n"; |
| 123 | text += "\n"; |
| 124 | text += "\tpublic void run(String arg) {\n"; |
| 125 | text += methods; |
| 126 | text += "\t}\n"; |
| 127 | text += "\n"; |
| 128 | text += "}\n"; |
| 129 | text = text.replaceAll("\\t"," "); |
| 130 | ed.create(pluginName, text); |
| 131 | } |
| 132 | |
| 133 | public boolean showDialog() { |
| 134 | String title; |
no test coverage detected