Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / export / ExportCAH.groovy @ 499

History | View | Annotate | Download (943 Bytes)

1
package org.txm.export
2

    
3
import org.txm.cah.core.functions.CAH
4
import org.txm.rcp.views.*
5
import org.txm.stat.engine.r.*
6
// uncomment this
7
import org.eclipse.jface.viewers.*
8

    
9
// Select the CAH result in the CorporaView and run this script
10

    
11
// PARAMETER: the output file
12
def outfile = new File("/home/mdecorde/Bureau/CAH.txt")
13

    
14
// get selected object from Corpora view
15
def obj = null;
16
monitor.syncExec(new Runnable() {
17
        @Override
18
        public void run() {
19
                def corporaview = CorporaView.getInstance()
20
                def tree = corporaview.getTreeViewer()
21
                // uncomment these 2 lines
22
                def sel = tree.getSelection()
23
                obj = sel.getFirstElement()
24
                }
25
        });
26
println("Selected object: "+obj)
27

    
28
if (obj != null && obj instanceof CAH) {
29
        def rw = RWorkspace.getRWorkspaceInstance()
30
        rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")")
31
        rw.eval("print("+((CAH)obj).getSymbol()+")")
32
        rw.eval("sink()")
33
        println("CAH saved in file: "+outfile)
34
}