Esempio n. 1
0
def doesClassExist(name):
	try:
		IJ.getClassLoader().loadClass(name)
		return True
	except ClassNotFoundException:
		return False
	except NoClassDefFoundError:
		return False
Esempio n. 2
0
def doesClassExist(name):
    try:
        IJ.getClassLoader().loadClass(name)
        return True
    except ClassNotFoundException:
        return False
    except NoClassDefFoundError:
        return False
def checkClassName(name):
  try:
    cl = Class.forName(name)
    return 1
  except ClassNotFoundException:
    try:
      cl = IJ.getClassLoader().loadClass(name)
      print "found :", cl
      return 1
    except NoClassDefFoundError:
      return 0
    except ClassNotFoundException:
      return 0
Esempio n. 4
0
def checkClassName(name):
  try:
    cl = Class.forName(name)
    return 1
  except ClassNotFoundException:
    try:
      cl = IJ.getClassLoader().loadClass(name)
      print "found :", cl
      return 1
    except NoClassDefFoundError:
      return 0
    except ClassNotFoundException:
      return 0
Esempio n. 5
0
def init():
    cl = IJ.getClassLoader()
    if cl is not None:
        Thread.currentThread().setContextClassLoader(cl)
    print "init", cl
    ns = RT.var("clojure.core", "*ns*")
    warn_on_reflection = RT.var("clojure.core", "*warn-on-reflection*")
    unchecked_math = RT.var("clojure.core", "*unchecked-math*")
    compile_path = RT.var("clojure.core", "*compile-path*")
    Var.pushThreadBindings(ns, ns.get(), warn_on_reflection,
                           warn_on_reflection.get(), unchecked_math,
                           unchecked_math.get(), compile_path, "classes")
    in_ns = RT.var("clojure.core", "in-ns")
    refer = RT.var("clojure.core", "refer")
    in_ns.invoke(Symbol.intern("user"))
    refer.invoke(Symbol.intern("clojure.core"))
Esempio n. 6
0
from ij import IJ
from java.lang import Object, Thread
cl = IJ.getClassLoader()
if cl is not None:
    Thread.currentThread().setContextClassLoader(cl)

from clojure.lang import Compiler, LineNumberingPushbackReader, LispReader, Symbol, Var, RT
from java.io import StringReader
from java.util.concurrent import Executors, Callable

exe = Executors.newFixedThreadPool(1)


class Task(Callable):
    def __init__(fn, *args):
        self.fn = fn
        self.args = args

    def call(self):
        return self.fn(*self.args)


def init():
    cl = IJ.getClassLoader()
    if cl is not None:
        Thread.currentThread().setContextClassLoader(cl)
    print "init", cl
    ns = RT.var("clojure.core", "*ns*")
    warn_on_reflection = RT.var("clojure.core", "*warn-on-reflection*")
    unchecked_math = RT.var("clojure.core", "*unchecked-math*")
    compile_path = RT.var("clojure.core", "*compile-path*")