public void run(String arg) { if (IJ.getApplet()!=null) return; CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); try { listAllThreads(pw); new TextWindow("Threads", caw.toString(), 420, 420); } catch (Exception e) {} }
public void run(String arg) { if (IJ.getApplet()!=null) return; CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); try { listAllThreads(pw); new TextWindow("Threads", caw.toString(), 420, 420); } catch (Exception e) {} }
public long getMemorySetting() { if (IJ.getApplet()!=null) return 0L; long max = 0L; if (IJ.isMacOSX()) { String appPath = System.getProperty("java.class.path"); if (appPath==null) return 0L; int index = appPath.indexOf(".app/"); if (index==-1) return 0L; appPath = appPath.substring(0,index+5); max = getMemorySetting(appPath+"Contents/Info.plist"); } else max = getMemorySetting("ImageJ.cfg"); return max; }
public long getMemorySetting() { if (IJ.getApplet()!=null) return 0L; long max = 0L; if (IJ.isMacOSX()) { String appPath = System.getProperty("java.class.path"); if (appPath==null) return 0L; int index = appPath.indexOf(".app/"); if (index==-1) return 0L; appPath = appPath.substring(0,index+5); max = getMemorySetting(appPath+"Contents/Info.plist"); } else max = getMemorySetting("ImageJ.cfg"); return max; }
/** * Writes a string to an output channel. IJ cannot write if an applet, divert to showStatus instead. * @param s the String that will be output. */ static void write(String s) { if (IJ.getApplet() == null) IJ.write(s); else IJ.showStatus(s); } /**
public void run(String arg) { if (IJ.getApplet()!=null) return; String host = System.getProperty("http.proxyHost"); if (host!=null) proxyhost = host; String port = System.getProperty("http.proxyPort"); if (port!=null) { double portNumber = Tools.parseDouble(port); if (!Double.isNaN(portNumber)) proxyport = (int)portNumber; } if (!showDialog()) return; if (!proxyhost.equals("")) props.put("proxySet", "true"); else props.put("proxySet", "false"); props.put("http.proxyHost", proxyhost); props.put("http.proxyPort", ""+proxyport); Prefs.set("proxy.server", proxyhost); Prefs.set("proxy.port", proxyport); try { System.setProperty("java.net.useSystemProxies", Prefs.useSystemProxies?"true":"false"); } catch(Exception e) {} if (IJ.debugMode) logProperties(); }
public DicomDecoder(String directory, String fileName) { this.directory = directory; this.fileName = fileName; String path = null; if (dictionary==null && IJ.getApplet()==null) { path = Prefs.getImageJDir()+"DICOM_Dictionary.txt"; File f = new File(path); if (f.exists()) try { dictionary = new Properties(); InputStream is = new BufferedInputStream(new FileInputStream(f)); dictionary.load(is); is.close(); if (IJ.debugMode) IJ.log("DicomDecoder: using "+dictionary.size()+" tag dictionary at "+path); } catch (Exception e) { dictionary = null; } } if (dictionary==null) { DicomDictionary d = new DicomDictionary(); dictionary = d.getDictionary(); if (IJ.debugMode) IJ.log("DicomDecoder: "+path+" not found; using "+dictionary.size()+" tag built in dictionary"); } }
public DicomDecoder(String directory, String fileName) { this.directory = directory; this.fileName = fileName; String path = null; if (dictionary==null && IJ.getApplet()==null) { path = Prefs.getImageJDir()+"DICOM_Dictionary.txt"; File f = new File(path); if (f.exists()) try { dictionary = new Properties(); InputStream is = new BufferedInputStream(new FileInputStream(f)); dictionary.load(is); is.close(); if (IJ.debugMode) IJ.log("DicomDecoder: using "+dictionary.size()+" tag dictionary at "+path); } catch (Exception e) { dictionary = null; } } if (dictionary==null) { DicomDictionary d = new DicomDictionary(); dictionary = d.getDictionary(); if (IJ.debugMode) IJ.log("DicomDecoder: "+path+" not found; using "+dictionary.size()+" tag built in dictionary"); } }
public void run(String arg) { if (IJ.getApplet()!=null) return; String host = System.getProperty("http.proxyHost"); if (host!=null) proxyhost = host; String port = System.getProperty("http.proxyPort"); if (port!=null) { double portNumber = Tools.parseDouble(port); if (!Double.isNaN(portNumber)) proxyport = (int)portNumber; } if (!showDialog()) return; if (!proxyhost.equals("")) props.put("proxySet", "true"); else props.put("proxySet", "false"); props.put("http.proxyHost", proxyhost); props.put("http.proxyPort", ""+proxyport); Prefs.set("proxy.server", proxyhost); Prefs.set("proxy.port", proxyport); try { System.setProperty("java.net.useSystemProxies", Prefs.useSystemProxies?"true":"false"); } catch(Exception e) {} if (IJ.debugMode) logProperties(); }
void openStartupMacros() { Applet applet = IJ.getApplet(); if (applet!=null) IJ.run("URL...", "url="+IJ.URL+"/applet/StartupMacros.txt"); else { String path = IJ.getDirectory("macros")+"StartupMacros.txt"; File f = new File(path); if (!f.exists()) { path = IJ.getDirectory("macros")+"StartupMacros.ijm"; f = new File(path); } if (!f.exists()) { path = IJ.getDirectory("macros")+"StartupMacros.fiji.ijm"; f = new File(path); } if (!f.exists()) IJ.error("\"StartupMacros.txt\" not found in ImageJ/macros/"); else IJ.open(path); } }
void openStartupMacros() { Applet applet = IJ.getApplet(); if (applet!=null) IJ.run("URL...", "url="+IJ.URL+"/applet/StartupMacros.txt"); else { String path = IJ.getDirectory("macros")+"StartupMacros.txt"; File f = new File(path); if (!f.exists()) { path = IJ.getDirectory("macros")+"StartupMacros.ijm"; f = new File(path); } if (!f.exists()) { path = IJ.getDirectory("macros")+"StartupMacros.fiji.ijm"; f = new File(path); } if (!f.exists()) IJ.error("\"StartupMacros.txt\" not found in ImageJ/macros/"); else IJ.open(path); } }
/** Runs the specified plugin and returns a reference to it. */ public static Object runPlugIn(String commandName, String className, String arg) { if (arg==null) arg = ""; if (IJ.debugMode) IJ.log("runPlugIn: "+className+argument(arg)); // Load using custom classloader if this is a user // plugin and we are not running as an applet if (!className.startsWith("ij.") && applet==null) return runUserPlugIn(commandName, className, arg, false); Object thePlugIn=null; try { Class c = Class.forName(className); thePlugIn = c.newInstance(); if (thePlugIn instanceof PlugIn) ((PlugIn)thePlugIn).run(arg); else new PlugInFilterRunner(thePlugIn, commandName, arg); } catch (ClassNotFoundException e) { if (IJ.getApplet()==null) log("Plugin or class not found: \"" + className + "\"\n(" + e+")"); } catch (InstantiationException e) {log("Unable to load plugin (ins)");} catch (IllegalAccessException e) {log("Unable to load plugin, possibly \nbecause it is not public.");} redirectErrorMessages = false; return thePlugIn; }
/** Runs the specified plugin and returns a reference to it. */ public static Object runPlugIn(String commandName, String className, String arg) { if (arg==null) arg = ""; if (IJ.debugMode) IJ.log("runPlugIn: "+className+argument(arg)); // Load using custom classloader if this is a user // plugin and we are not running as an applet if (!className.startsWith("ij.") && applet==null) return runUserPlugIn(commandName, className, arg, false); Object thePlugIn=null; try { Class c = Class.forName(className); thePlugIn = c.newInstance(); if (thePlugIn instanceof PlugIn) ((PlugIn)thePlugIn).run(arg); else new PlugInFilterRunner(thePlugIn, commandName, arg); } catch (ClassNotFoundException e) { if (IJ.getApplet()==null) log("Plugin or class not found: \"" + className + "\"\n(" + e+")"); } catch (InstantiationException e) {log("Unable to load plugin (ins)");} catch (IllegalAccessException e) {log("Unable to load plugin, possibly \nbecause it is not public.");} redirectErrorMessages = false; return thePlugIn; }
state = Interpreter.isBatchMode(); else if (arg.indexOf("applet")!=-1) state = IJ.getApplet()!=null; else if (arg.indexOf("virtual")!=-1) state = getImage().getStack().isVirtual();
state = Interpreter.isBatchMode(); else if (arg.indexOf("applet")!=-1) state = IJ.getApplet()!=null; else if (arg.indexOf("virtual")!=-1) state = getImage().getStack().isVirtual();
public static void updateImageJMenus() { jarFiles = macroFiles = null; Menus m = new Menus(IJ.getInstance(), IJ.getApplet()); String err = m.addMenuBar(); if (err!=null) IJ.error(err); m.installStartupMacroSet(); IJ.resetClassLoader(); IJ.runPlugIn("ij.plugin.ClassChecker", ""); IJ.showStatus("Menus updated: "+m.nPlugins + " commands, " + m.nMacros + " macros"); }
public static void updateImageJMenus() { jarFiles = macroFiles = null; Menus m = new Menus(IJ.getInstance(), IJ.getApplet()); String err = m.addMenuBar(); if (err!=null) IJ.error(err); m.installStartupMacroSet(); IJ.resetClassLoader(); IJ.runPlugIn("ij.plugin.ClassChecker", ""); IJ.showStatus("Menus updated: "+m.nPlugins + " commands, " + m.nMacros + " macros"); }
if (ij!=null && ij.quitting() && IJ.getApplet()==null) return true; for (int i=0; i<nonImages.length; i++) {
if (roi!=null && (roi instanceof PointRoi) && ((PointRoi)roi).promptBeforeDeleting()) changes = true; if (ij==null || ij.quittingViaMacro() || IJ.getApplet()!=null || Interpreter.isBatchMode() || IJ.macroRunning() || virtual) changes = false; if (changes) {
if (roi!=null && (roi instanceof PointRoi) && ((PointRoi)roi).promptBeforeDeleting()) changes = true; if (ij==null || ij.quittingViaMacro() || IJ.getApplet()!=null || Interpreter.isBatchMode() || IJ.macroRunning() || virtual) changes = false; if (changes) {