Statistics
| Revision:

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

History | View | Annotate | Download (1 kB)

1
package org.txm.export
2

    
3
//import org.txm.rcpapplication.views.*
4
import org.txm.functions.classification.*
5
import org.txm.stat.engine.r.*
6
// uncomment this
7
//import org.eclipse.jface.viewers.IStructuredSelection
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 = (IStructuredSelection) tree.getSelection()
23
//                obj = sel.getFirstElement()
24
                }
25
        });
26
println("Selected object: "+obj)
27

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