MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / createPlugin

Method createPlugin

ij/src/main/java/ij/plugin/NewPlugin.java:108–131  ·  view source on GitHub ↗
(String name, int type, String methods)

Source from the content-addressed store, hash-verified

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;

Callers 1

runMethod · 0.95

Calls 6

runPlugInMethod · 0.95
setExtensionMethod · 0.95
substringMethod · 0.80
replaceAllMethod · 0.80
lengthMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected