-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathgroovy.groovy
44 lines (35 loc) · 904 Bytes
/
groovy.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//@ImageJ ij
//@UIService ui
//@LogService log
//@ScriptService script
//@DisplayService display
//header
import bar.Utils
/**
* Parses the given file into a class and initializes it
*
* @param filename the file to be parsed (in the BAR lib directory)
* @return a reference to the initialized lib class
*/
def loadBARLib(filename) {
file = new File(Utils.getLibDir() + filename)
lib = null
if (file.exists()) {
loader = new GroovyClassLoader()
lib = loader.parseClass(file).newInstance()
}
lib
}
def main() {
// Load template BAR lib. Exit if file is not available
// (see 'BAR>Utilities>Install Multi-language libs...')
lib = loadBARLib("BARlib.groovy")
if (!lib) {
ui.showDialog("File not found: BARlib.groovy", "Error")
return
}
// Your code here... e.g., confirm access to loaded file
//lib.metaClass.respondsTo(lib, "confirmLoading")
lib.confirmLoading()
}
main()