Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / macroproto / cqp / ListSubcorpusMacro.groovy @ 822

History | View | Annotate | Download (1.2 kB)

1
// STANDARD DECLARATIONS
2
package org.txm.macroproto.cqp
3

    
4
import org.kohsuke.args4j.*
5
import groovy.transform.Field
6
import org.txm.rcpapplication.swt.widget.parameters.*
7
import org.txm.Toolbox
8
import org.txm.searchengine.cqp.*
9
import org.txm.searchengine.cqp.corpus.*
10
import org.txm.utils.*
11

    
12
if (!(corpusViewSelection instanceof Corpus)) {
13
        println "Selection is not a Corpus: $corpusViewSelection"
14
        return false
15
}
16

    
17
def CQI = Toolbox.getCqiClient();
18
if ((CQI instanceof NetCqiClient)) {
19
        println "Error: only available in CQP memory mode"
20
        return;
21
}
22

    
23
@Field @Option(name="subcorpusname", usage="an example file", widget="String", required=true, def="A")
24
def subcorpusname
25
@Field @Option(name="inputFile", usage="an example file", widget="FileOpen", required=true, def="C:/Temp/foo.txt")
26
def inputFile
27
@Field @Option(name="replace", usage="an example file", widget="Boolean", required=true, def="true")
28
def replace
29

    
30
// Open the parameters input dialog box
31
if (!ParametersDialog.open(this)) return;
32

    
33
// END OF PARAMETERS
34

    
35
println "corpora selection: "+corpusViewSelection
36

    
37
MainCorpus maincorpus = corpusViewSelection.getMainCorpus()
38
def existing = CQI.listSubcorpora(maincorpus.getQualifiedCqpId())
39
println existing