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

Method runMacro

ij/src/main/java/ij/plugin/frame/Editor.java:556–593  ·  view source on GitHub ↗
(boolean debug)

Source from the content-addressed store, hash-verified

554 }
555
556 final void runMacro(boolean debug) {
557 if (path!=null)
558 Macro_Runner.setFilePath(path);
559 if (getTitle().endsWith(".js"))
560 {evaluateJavaScript(); return;}
561 else if (getTitle().endsWith(".bsh"))
562 {evaluateScript(".bsh"); return;}
563 else if (getTitle().endsWith(".py"))
564 {evaluateScript(".py"); return;}
565 int start = ta.getSelectionStart();
566 int end = ta.getSelectionEnd();
567 String text;
568 if (start==end)
569 text = ta.getText();
570 else
571 text = ta.getSelectedText();
572 Interpreter.abort(); // abort any currently running macro
573 if (checkForCurlyQuotes) {
574 // replace curly quotes with standard quotes
575 text = text.replaceAll("\u201C", "\"");
576 text = text.replaceAll("\u201D", "\"");
577 if (start==end)
578 ta.setText(text);
579 else {
580 String text2 = ta.getText();
581 text2 = text2.replaceAll("\u201C", "\"");
582 text2 = text2.replaceAll("\u201D", "\"");
583 ta.setText(text2);
584 }
585 checkForCurlyQuotes = false;
586 }
587 currentMacroEditor = this;
588 text = doInclude(text);
589 MacroRunner mr = new MacroRunner();
590 if (debug)
591 mr.setEditor(this);
592 mr.run(text);
593 }
594
595 /** Process optional #include statment at begining of macro. */
596 public static String doInclude(String code) {

Callers 5

evaluateMacroMethod · 0.95
evaluateLineMethod · 0.95
actionPerformedMethod · 0.95
openExampleMethod · 0.95
keyReleasedMethod · 0.95

Calls 15

setFilePathMethod · 0.95
evaluateJavaScriptMethod · 0.95
evaluateScriptMethod · 0.95
abortMethod · 0.95
doIncludeMethod · 0.95
setEditorMethod · 0.95
runMethod · 0.95
isMacOSXMethod · 0.95
changeExtensionMethod · 0.95
enterInteractiveModeMethod · 0.95
insertTextMethod · 0.95
getCurrentImageMethod · 0.95

Tested by

no test coverage detected