Revision 2769 tmp/org.txm.groovy.core/src/groovy/org/txm/macro/imports/OpenImportFormMacro.groovy

OpenImportFormMacro.groovy (revision 2769)
4 4
import groovy.transform.Field
5 5
import org.txm.rcp.swt.widget.parameters.*
6 6
import org.txm.rcp.commands.*
7
import org.txm.Toolbox
7 8

  
8 9
@Field @Option(name="scriptFile", usage="an example file", widget="File", required=true, def="xxxLoader.groovy")
9 10
File scriptFile
......
22 23
	public void run() {
23 24
		try {
24 25
			String path = script.getAbsolutePath()
25
			OpenImportForm.openfile(path);
26
			String rootpath = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/scripts/importer")
27
	
28
			if (path.startsWith(rootpath)) {
29
				OpenImportForm.openfile(path.substring(Toolbox.getTxmHomePath().length()));
30
			} else {
31
				println "Error: import start script must be included in $rootpath"
32
			}
26 33
		} catch (Exception e) {
27 34
			e.printStackTrace();
28 35
		}

Also available in: Unified diff