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

Method evaluateScript

ij/src/main/java/ij/plugin/frame/Editor.java:665–697  ·  view source on GitHub ↗
(String ext)

Source from the content-addressed store, hash-verified

663 }
664
665 public void evaluateScript(String ext) {
666 if (downloading) {
667 IJ.beep();
668 IJ.showStatus("Download in progress");
669 return;
670 }
671 if (ext.endsWith(".js")) {
672 evaluateJavaScript();
673 return;
674 }
675 if (!getTitle().endsWith(ext))
676 setWindowTitle(SaveDialog.setExtension(getTitle(), ext));
677 int start = ta.getSelectionStart();
678 int end = ta.getSelectionEnd();
679 String text;
680 if (start==end)
681 text = ta.getText();
682 else
683 text = ta.getSelectedText();
684 if (text.equals("")) return;
685 String plugin, url;
686 if (ext.equals(".bsh")) {
687 plugin = "bsh";
688 url = "/plugins/bsh/BeanShell.jar";
689 } else {
690 // download Jython from http://imagej.net/ij/plugins/jython/
691 plugin = "Jython";
692 url = "/plugins/jython/Jython.jar";
693 }
694 Object obj = IJ.runPlugIn(plugin, text);
695 if (obj==null)
696 download(url);
697 }
698
699 private void download(String url) {
700 this.downloadUrl = url;

Callers 2

runMacroMethod · 0.95
actionPerformedMethod · 0.95

Calls 12

beepMethod · 0.95
showStatusMethod · 0.95
evaluateJavaScriptMethod · 0.95
setWindowTitleMethod · 0.95
setExtensionMethod · 0.95
runPlugInMethod · 0.95
downloadMethod · 0.95
getTitleMethod · 0.65
getSelectionStartMethod · 0.45
getSelectionEndMethod · 0.45
getTextMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected