@Override public void run(String arg) { MacroInstaller installer = new MacroInstaller(); installer.install(MACRO_CMD); }
@Override public void run(String arg) { MacroInstaller installer = new MacroInstaller(); installer.install(MACRO_CMD); }
/** Opens a text file in ij.jar as a String (example path: "/macros/Circle_Tool.txt"). */ public static String openFromIJJarAsString(String path) { return (new ij.plugin.MacroInstaller()).openFromIJJar(path); }
/** Opens a text file in ij.jar as a String (example path: "/macros/Circle_Tool.txt"). */ public static String openFromIJJarAsString(String path) { return (new ij.plugin.MacroInstaller()).openFromIJJar(path); }
@Override public void run(String arg) { System.out.println("run of LabelBrush_ ..."); if (IJ.versionLessThan("1.37c")) { System.err.println("Version too old"); return; }else{ System.out.println("loading LabelBrushTool"); } MacroInstaller installer = new MacroInstaller(); installer.install(MACRO_CMD); }
private boolean installToolsetTool(String name) { String path = IJ.getDir("macros")+"toolsets"+File.separator+name+".ijm"; if (!((new File(path)).exists())) { name = name.replaceAll(" ", "_"); path = IJ.getDir("macros")+"toolsets"+File.separator+name+".ijm"; } String text = IJ.openAsString(path); if (text==null || text.startsWith("Error")) return false; new MacroInstaller().installSingleTool(text); return true; }
private void installMacroFromJar(String path) { if (IJ.shiftKeyDown()) showCode(path, (new MacroInstaller()).openFromIJJar(path)); else (new MacroInstaller()).installFromIJJar(path); }
private boolean installToolsetTool(String name) { String path = IJ.getDir("macros")+"toolsets"+File.separator+name+".ijm"; if (!((new File(path)).exists())) { name = name.replaceAll(" ", "_"); path = IJ.getDir("macros")+"toolsets"+File.separator+name+".ijm"; } String text = IJ.openAsString(path); if (text==null || text.startsWith("Error")) return false; new MacroInstaller().installSingleTool(text); return true; }
@Override public void run(String arg) { if (IJ.versionLessThan("1.37c")) return; MacroInstaller installer = new MacroInstaller(); installer.install(MACRO_CMD); }
void installStartupMacroSet() { if (macrosPath==null) { try { (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt"); } catch (Exception e) {} return; f = new File(path); if (!f.exists()) { (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt"); return; boolean isLibrary = f.exists(); try { MacroInstaller mi = new MacroInstaller(); if (isLibrary) mi.installLibrary(libraryPath); mi.installStartupMacros(path);
void openTextFile(String urlString, boolean install) { StringBuffer sb = null; try { URL url = new URL(urlString); InputStream in = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); sb = new StringBuffer() ; String line; while ((line=br.readLine()) != null) sb.append (line + "\n"); in.close (); } catch (IOException e) { if (!(install&&urlString.endsWith("StartupMacros.txt"))) IJ.error("URL Opener", ""+e); sb = null; } if (sb!=null) { if (install) (new MacroInstaller()).install(new String(sb)); else { int index = urlString.lastIndexOf("/"); if (index!=-1 && index<=urlString.length()-1) urlString = urlString.substring(index+1); (new Editor()).create(urlString, new String(sb)); } } }
private void installMacroFromJar(String path) { if (IJ.shiftKeyDown()) showCode(path, (new MacroInstaller()).openFromIJJar(path)); else (new MacroInstaller()).installFromIJJar(path); }
void openTextFile(String urlString, boolean install) { StringBuffer sb = null; try { URL url = new URL(urlString); InputStream in = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); sb = new StringBuffer() ; String line; while ((line=br.readLine()) != null) sb.append (line + "\n"); in.close (); } catch (IOException e) { if (!(install&&urlString.endsWith("StartupMacros.txt"))) IJ.error("URL Opener", ""+e); sb = null; } if (sb!=null) { if (install) (new MacroInstaller()).install(new String(sb)); else { int index = urlString.lastIndexOf("/"); if (index!=-1 && index<=urlString.length()-1) urlString = urlString.substring(index+1); (new Editor()).create(urlString, new String(sb)); } } }
private void installMagicMontageTools() { String name = "MagicMontageTools.txt"; String path = "/macros/"+name; MacroInstaller mi = new MacroInstaller(); if (IJ.shiftKeyDown()) Toolbar.showCode(name, mi.openFromIJJar(path)); else try { mi.installFromIJJar(path); } catch (Exception e) {} }
void installMacros(String text, boolean installInPluginsMenu) { String functions = Interpreter.getAdditionalFunctions(); if (functions!=null && text!=null) { if (!(text.endsWith("\n") || functions.startsWith("\n"))) text = text + "\n" + functions; else text = text + functions; } installer = new MacroInstaller(); installer.setFileName(getTitle()); int nShortcutsOrTools = installer.install(text, macrosMenu); if (installInPluginsMenu || nShortcutsOrTools>0) installer.install(null); dontShowWindow = installer.isAutoRunAndHide(); currentMacroEditor = this; }
private void installMagicMontageTools() { String name = "MagicMontageTools.txt"; String path = "/macros/"+name; MacroInstaller mi = new MacroInstaller(); if (IJ.shiftKeyDown()) Toolbar.showCode(name, mi.openFromIJJar(path)); else try { mi.installFromIJJar(path); } catch (Exception e) {} }
void installMacros(String text, boolean installInPluginsMenu) { String functions = Interpreter.getAdditionalFunctions(); if (functions!=null && text!=null) { if (!(text.endsWith("\n") || functions.startsWith("\n"))) text = text + "\n" + functions; else text = text + functions; } installer = new MacroInstaller(); installer.setFileName(getTitle()); int nShortcutsOrTools = installer.install(text, macrosMenu); if (installInPluginsMenu || nShortcutsOrTools>0) installer.install(null); dontShowWindow = installer.isAutoRunAndHide(); currentMacroEditor = this; }
private void installStartupMacros() { resetTools(); String path = IJ.getDir("macros")+"StartupMacros.txt"; File f = new File(path); if (!f.exists()) { path = IJ.getDir("macros")+"StartupMacros.ijm"; f = new File(path); } if (!f.exists()) { path = IJ.getDir("macros")+"StartupMacros.fiji.ijm"; f = new File(path); } if (!f.exists()) { IJ.error("StartupMacros not found in\n \n"+IJ.getDir("macros")); return; } if (IJ.shiftKeyDown()) { IJ.open(path); IJ.setKeyUp(KeyEvent.VK_SHIFT); } else { try { MacroInstaller mi = new MacroInstaller(); mi.installFile(path); } catch (Exception ex) {} } }
MacroInstaller installer = new ij.plugin.MacroInstaller(); installer.install(LabelBrush_.MACRO_CMD);
void showText() { String title = getFirstString(); String text = null; if (interp.nextToken()==',') text = getLastString(); else interp.getRightParen(); if (text==null) { text = title; title = "Untitled"; } Frame frame = WindowManager.getFrame(title); Editor ed = null; boolean useExisting = frame instanceof Editor; if (useExisting) { ed = (Editor)frame; TextArea ta = ed.getTextArea(); ta.selectAll(); ta.replaceRange(text, ta.getSelectionStart(), ta.getSelectionEnd()); } else { ed = new Editor(); ed.setSize(350, 300); ed.create(title, text); } if (title.equals("Untitled") && text.contains("Test Action Tool")) new MacroInstaller().installSingleTool(text); }