Package ij.plugin

Examples of ij.plugin.MacroInstaller


          "<http://rsb.info.nih.gov/ij/macros/toolsets/>."
          );
        return;
      } else if (label.endsWith("*")) {
                // load from ij.jar
                MacroInstaller mi = new MacroInstaller();
                label = label.substring(0, label.length()-1) + ".txt";
                path = "/macros/"+label;
        if (IJ.shiftKeyDown()) {
          String macros = mi.openFromIJJar(path);
                    Editor ed = new Editor();
                    ed.setSize(350, 300);
                    ed.create(label, macros);
                  IJ.setKeyUp(KeyEvent.VK_SHIFT);
        } else
          mi.installFromIJJar(path);
            } else {
                // load from ImageJ/macros/toolsets
                if (label.equals("Startup Macros"))
                    path = IJ.getDirectory("macros")+"StartupMacros.txt";
                else if (label.endsWith(" "))
                    path = IJ.getDirectory("macros")+"toolsets/"+label.substring(0, label.length()-1)+".ijm";
                else
                    path = IJ.getDirectory("macros")+"toolsets/"+label+".txt";
                try {
                    if (IJ.shiftKeyDown()) {
                        IJ.open(path);
                    IJ.setKeyUp(KeyEvent.VK_SHIFT);
                    } else
                        new MacroInstaller().run(path);
                }
                catch(Exception ex) {}
            }
    }
  }
View Full Code Here


      }
      IJ.runPlugIn("ij.plugin.URLOpener", docBase+"StartupMacros.txt");
      return;
    }
    if (macrosPath==null) {
      (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
      return;
    }
    String path = macrosPath + "StartupMacros.txt";
    File f = new File(path);
    if (!f.exists()) {
      path = macrosPath + "StartupMacros.ijm";
      f = new File(path);
      if (!f.exists()) {
        (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
        return;
      }
    }
    String libraryPath = macrosPath + "Library.txt";
    f = new File(libraryPath);
    boolean isLibrary = f.exists();
    try {
      MacroInstaller mi = new MacroInstaller();
      if (isLibrary) mi.installLibrary(libraryPath);
      mi.installFile(path);
      nMacros += mi.getMacroCount();
    } catch (Exception e) {}
  }
View Full Code Here

          "<"+IJ.URL+"/macros/toolsets/>."
          );
        return;
      } else if (label.endsWith("*")) {
                // load from ij.jar
                MacroInstaller mi = new MacroInstaller();
                label = label.substring(0, label.length()-1) + ".txt";
                path = "/macros/"+label;
        if (IJ.shiftKeyDown()) {
          String macros = mi.openFromIJJar(path);
                    Editor ed = new Editor();
                    ed.setSize(350, 300);
                    ed.create(label, macros);
                  IJ.setKeyUp(KeyEvent.VK_SHIFT);
        } else
          mi.installFromIJJar(path);
            } else {
                // load from ImageJ/macros/toolsets
                if (label.equals("Startup Macros"))
                    path = IJ.getDirectory("macros")+"StartupMacros.txt";
                else if (label.endsWith(" "))
                    path = IJ.getDirectory("macros")+"toolsets/"+label.substring(0, label.length()-1)+".ijm";
                else
                    path = IJ.getDirectory("macros")+"toolsets/"+label+".txt";
                try {
                    if (IJ.shiftKeyDown()) {
                        IJ.open(path);
                    IJ.setKeyUp(KeyEvent.VK_SHIFT);
                    } else
                        new MacroInstaller().run(path);
                }
                catch(Exception ex) {}
            }
    }
  }
View Full Code Here

      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();
View Full Code Here

      }
      IJ.runPlugIn("ij.plugin.URLOpener", docBase+"StartupMacros.txt");
      return;
    }
    if (macrosPath==null) {
      (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
      return;
    }
    String path = macrosPath + "StartupMacros.txt";
    File f = new File(path);
    if (!f.exists()) {
      path = macrosPath + "StartupMacros.ijm";
      f = new File(path);
      if (!f.exists()) {
        (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
        return;
      }
    }
    String libraryPath = macrosPath + "Library.txt";
    f = new File(libraryPath);
    boolean isLibrary = f.exists();
    try {
      MacroInstaller mi = new MacroInstaller();
      if (isLibrary) mi.installLibrary(libraryPath);
      mi.installFile(path);
      nMacros += mi.getMacroCount();
    } catch (Exception e) {}
  }
View Full Code Here

      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();
View Full Code Here

          "<http://rsb.info.nih.gov/ij/macros/toolsets/>."
          );
        return;
      } else if (label.endsWith("*")) {
                // load from ij.jar
                MacroInstaller mi = new MacroInstaller();
                label = label.substring(0, label.length()-1) + ".txt";
                path = "/macros/"+label;
        if (IJ.shiftKeyDown()) {
          String macros = mi.openFromIJJar(path);
                    Editor ed = new Editor();
                    ed.setSize(350, 300);
                    ed.create(label, macros);
                  IJ.setKeyUp(KeyEvent.VK_SHIFT);
        } else
          mi.installFromIJJar(path);
            } else {
                // load from ImageJ/macros/toolsets
                if (label.equals("Startup Macros"))
                    path = IJ.getDirectory("macros")+"StartupMacros.txt";
                else if (label.endsWith(" "))
                    path = IJ.getDirectory("macros")+"toolsets/"+label.substring(0, label.length()-1)+".ijm";
                else
                    path = IJ.getDirectory("macros")+"toolsets/"+label+".txt";
                try {
                    if (IJ.shiftKeyDown()) {
                        IJ.open(path);
                    IJ.setKeyUp(KeyEvent.VK_SHIFT);
                    } else
                        new MacroInstaller().run(path);
                }
                catch(Exception ex) {}
            }
    }
  }
View Full Code Here

      }
      IJ.runPlugIn("ij.plugin.URLOpener", docBase+"StartupMacros.txt");
      return;
    }
    if (macrosPath==null) {
      (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
      return;
    }
    String path = macrosPath + "StartupMacros.txt";
    File f = new File(path);
    if (!f.exists()) {
      path = macrosPath + "StartupMacros.ijm";
      f = new File(path);
      if (!f.exists()) {
        (new MacroInstaller()).installFromIJJar("/macros/StartupMacros.txt");
        return;
      }
    }
    String libraryPath = macrosPath + "Library.txt";
    f = new File(libraryPath);
    boolean isLibrary = f.exists();
    try {
      MacroInstaller mi = new MacroInstaller();
      if (isLibrary) mi.installLibrary(libraryPath);
      mi.installFile(path);
      nMacros += mi.getMacroCount();
    } catch (Exception e) {}
  }
View Full Code Here

TOP

Related Classes of ij.plugin.MacroInstaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.