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

Method run

ij/src/main/java/ij/plugin/NewPlugin.java:26–80  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

24 private Editor ed;
25
26 public void run(String arg) {
27 type = -1;
28 if (arg.startsWith("text")||arg.equals("")) {
29 type = TEXT_FILE;
30 if (IJ.altKeyDown())
31 name = "Untitled.ijm";
32 else
33 name = "Untitled.txt";
34 } else if (arg.equals("macro")) {
35 type = MACRO;
36 name = "Macro.ijm";
37 } else if (arg.equals("macro-tool")) {
38 type = TEMPLATE;
39 name = "Circle_Tool.txt";
40 } else if (arg.equals("javascript")) {
41 type = JAVASCRIPT;
42 name = "Script.js";
43 } else if (arg.equals("plugin")) {
44 type = TEMPLATE;
45 name = "My_Plugin.src";
46 } else if (arg.equals("frame")) {
47 type = TEMPLATE;
48 name = "Plugin_Frame.src";
49 } else if (arg.equals("plugin-tool")) {
50 type = TEMPLATE;
51 name = "Prototype_Tool.src";
52 } else if (arg.equals("filter")) {
53 type = TEMPLATE;
54 name = "Filter_Plugin.src";
55 } else if (arg.equals("table")) {
56 String options = Macro.getOptions();
57 if (IJ.isMacro() && options!=null && options.indexOf("[Text File]")!=-1) {
58 type = TEXT_FILE;
59 name = "Untitled.txt";
60 arg = "text+dialog";
61 } else {
62 type = TABLE;
63 name = "Table";
64 }
65 }
66 menuBar = true;
67 if (arg.equals("text+dialog") || type==TABLE) {
68 if (!showDialog()) return;
69 }
70 if (type==-1)
71 createPlugin("Converted_Macro.java", PLUGIN, arg);
72 else if (type==TEMPLATE || type==MACRO || type==TEXT_FILE || type==JAVASCRIPT) {
73 if (type==TEXT_FILE && name.equals("Macro"))
74 name = "Untitled.txt";
75 createMacro(name);
76 } else if (type==TABLE)
77 createTable();
78 else
79 createPlugin(name, type, arg);
80 }
81
82 public void createMacro(String name) {
83 int options = (monospaced?Editor.MONOSPACED:0)+(menuBar?Editor.MENU_BAR:0);

Callers

nothing calls this directly

Calls 10

altKeyDownMethod · 0.95
getOptionsMethod · 0.95
isMacroMethod · 0.95
showDialogMethod · 0.95
createPluginMethod · 0.95
createMacroMethod · 0.95
createTableMethod · 0.95
startsWithMethod · 0.80
equalsMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected