Révision 3437
TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java (revision 3437) | ||
---|---|---|
50 | 50 |
|
51 | 51 |
browser = new Browser(this, SWT.NONE); |
52 | 52 |
browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
53 |
//browser.setText("<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body><video id=\"video\" controls></video></body></html>"); |
|
54 |
String html = "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body><video id=\"video\" style=\"object-fit:contain;\" controls controlsList=\"nofullscreen\"></video></body></html>"; |
|
55 |
System.out.println(html); |
|
56 |
browser.setText(html); |
|
57 |
//browser.setText("<video id=\"video\" width=\"100%\" height=\"100%\" controls><source id=\"source\" src=\"\"></source></video>"); |
|
58 | 53 |
|
54 |
// use flex to center the video |
|
55 |
// use ondataload fix the video size depending on its ratio and the viewport height |
|
56 |
// diable the fullscreen button, use a CSS special rule for webkit |
|
57 |
String html = "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n" + |
|
58 |
"<style>video::-webkit-media-controls-fullscreen-button {display: none;</style></head>\n" + |
|
59 |
"<body><div style=\"display:flex;align-items: center;justify-content: center;\">\n" + |
|
60 |
"<video id=\"video\" controls controlsList=\"nofullscreen nodownload\" onloadeddata=\"v = document.getElementById('video');r = v.videoWidth/v.videoHeight; v.style.width=(95*r)+'vh';\"></video></div></body></html>"; |
|
61 |
|
|
62 |
browser.setText(html); // <source> is set later |
|
63 |
|
|
59 | 64 |
browser.addProgressListener(new ProgressListener() { |
60 | 65 |
|
61 | 66 |
@Override |
TXM/trunk/org.txm.libs.office/src/org/txm/libs/office/WriteODS.java (revision 3437) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.util.ArrayList; |
5 |
import java.util.logging.Level; |
|
6 |
import java.util.logging.Logger; |
|
7 | 5 |
|
8 |
import org.odftoolkit.odfdom.pkg.OdfXMLFactory; |
|
9 | 6 |
import org.odftoolkit.simple.SpreadsheetDocument; |
10 | 7 |
import org.odftoolkit.simple.table.Cell; |
11 | 8 |
import org.odftoolkit.simple.table.Row; |
... | ... | |
16 | 13 |
static { // set Log level to WARNING |
17 | 14 |
try { |
18 | 15 |
SpreadsheetDocument.newSpreadsheetDocument().close(); |
19 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING);
|
|
16 |
ReadODS.static_set_log_level();
|
|
20 | 17 |
} |
21 | 18 |
catch (Exception e) { |
22 | 19 |
// TODO Auto-generated catch block |
TXM/trunk/org.txm.libs.office/src/org/txm/libs/office/ReadODS.java (revision 3437) | ||
---|---|---|
1 | 1 |
package org.txm.libs.office; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
4 | 5 |
import java.util.ArrayList; |
5 | 6 |
import java.util.HashMap; |
6 | 7 |
import java.util.List; |
... | ... | |
20 | 21 |
static { // set Log level to WARNING |
21 | 22 |
try { |
22 | 23 |
SpreadsheetDocument.newSpreadsheetDocument().close(); |
23 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING);
|
|
24 |
static_set_log_level();
|
|
24 | 25 |
} |
25 | 26 |
catch (Exception e) { |
26 | 27 |
// TODO Auto-generated catch block |
... | ... | |
42 | 43 |
|
43 | 44 |
public ReadODS(File tableFile, String sheetname) throws Exception { |
44 | 45 |
|
45 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING);
|
|
46 |
static_set_log_level();
|
|
46 | 47 |
spreadsheet = SpreadsheetDocument.loadDocument(tableFile); |
47 | 48 |
|
48 | 49 |
// the first access to the document causes a very long process |
... | ... | |
64 | 65 |
// table.getRowByIndex(0); |
65 | 66 |
} |
66 | 67 |
|
68 |
public static void static_set_log_level() { |
|
69 |
|
|
70 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING); |
|
71 |
try { |
|
72 |
java.util.logging.LogManager.getLogManager().readConfiguration( |
|
73 |
new java.io.ByteArrayInputStream("org.odftoolkit.level=WARNING".getBytes(java.nio.charset.StandardCharsets.UTF_8))); |
|
74 |
} |
|
75 |
catch (SecurityException e) { |
|
76 |
// TODO Auto-generated catch block |
|
77 |
e.printStackTrace(); |
|
78 |
} |
|
79 |
catch (IOException e) { |
|
80 |
// TODO Auto-generated catch block |
|
81 |
e.printStackTrace(); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
67 | 85 |
public void close() { |
68 | 86 |
spreadsheet.close(); |
69 | 87 |
} |
... | ... | |
140 | 158 |
|
141 | 159 |
public static ArrayList<HashMap<String, String>> toHashMap(File inputFile, String sheetname) throws Exception { |
142 | 160 |
|
143 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING);
|
|
161 |
static_set_log_level();
|
|
144 | 162 |
|
145 | 163 |
SpreadsheetDocument spreadsheet = SpreadsheetDocument.loadDocument(inputFile); |
146 | 164 |
|
... | ... | |
197 | 215 |
*/ |
198 | 216 |
public static ArrayList<ArrayList<String>> toTable(File inputFile, String sheetname) throws Exception { |
199 | 217 |
|
200 |
Logger.getLogger(OdfXMLFactory.class.getName()).setLevel(Level.WARNING);
|
|
218 |
static_set_log_level();
|
|
201 | 219 |
|
202 | 220 |
SpreadsheetDocument spreadsheet = SpreadsheetDocument.loadDocument(inputFile); |
203 | 221 |
|
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java (revision 3437) | ||
---|---|---|
96 | 96 |
} |
97 | 97 |
if (subcorpus == null) { |
98 | 98 |
//subcorpus = corpus.createSubcorpus(cqlQuery, cqlQuery.getQueryString()); |
99 |
subcorpus = new Subcorpus(index); |
|
100 |
subcorpus.compute(false); |
|
101 |
index.setUserPersistable(true); // make the index persistable to avoid bugs later |
|
99 |
subcorpus = new Subcorpus(index) { |
|
100 |
public boolean isInternalPersistable() { // change the corpus behavior |
|
101 |
return false; |
|
102 |
} |
|
103 |
}; |
|
104 |
subcorpus.compute(false); // make it ready |
|
105 |
subcorpus.setUserPersistable(false); |
|
106 |
|
|
107 |
//index.setUserPersistable(true); // make the index persistable to avoid bugs later |
|
102 | 108 |
} |
103 | 109 |
} |
104 | 110 |
catch (Exception e) { |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/InjectWordPropTableMacro.groovy (revision 3437) | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import groovy.transform.Field |
11 | 11 |
|
12 |
import org.txm.core.preferences.TBXPreferences |
|
12 | 13 |
import org.txm.rcp.swt.widget.parameters.* |
13 | 14 |
|
14 | 15 |
@Field @Option(name="inputDirectory", usage="The XML-TXM folder", widget="Folder", required=true, def="") |
... | ... | |
17 | 18 |
@Field @Option(name="outputDirectory", usage="The result folder", widget="Folder", required=true, def="") |
18 | 19 |
def outputDirectory |
19 | 20 |
|
20 |
@Field @Option(name="tsvFile", usage="The annotation TSV file", widget="FileOpen", required=true, def="")
|
|
21 |
def tsvFile
|
|
21 |
@Field @Option(name="csvFile", usage="The annotation TSV file", widget="FileOpen", required=true, def="")
|
|
22 |
def csvFile
|
|
22 | 23 |
|
23 | 24 |
@Field @Option(name="properties", usage="columns to inject separated by commas", widget="String", required=true, def="p1, p2, ... , pn") |
24 | 25 |
def properties |
... | ... | |
39 | 40 |
println "Injecting annotations with the following parameters:" |
40 | 41 |
println "- inputDirectory: $inputDirectory" |
41 | 42 |
println "- outputDirectory: $outputDirectory" |
42 |
println "- tsvFile: $tsvFile"
|
|
43 |
println "- csvFile: $csvFile"
|
|
43 | 44 |
println "- properties: $properties" |
44 | 45 |
|
45 | 46 |
outputDirectory.mkdir() |
... | ... | |
48 | 49 |
return false |
49 | 50 |
} |
50 | 51 |
|
51 |
CsvReader records = new CsvReader(tsvFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8")) |
|
52 |
String separator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR); |
|
53 |
CsvReader records = new CsvReader(csvFile.getAbsolutePath(), separator.charAt(0), Charset.forName("UTF-8")) |
|
52 | 54 |
records.setTextQualifier((char)0) |
53 | 55 |
records.readHeaders(); |
54 | 56 |
|
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/BuildWordPropTableMacro.groovy (revision 3437) | ||
---|---|---|
31 | 31 |
import org.txm.searchengine.cqp.corpus.query.* |
32 | 32 |
import org.txm.concordance.core.functions.Concordance |
33 | 33 |
import org.txm.concordance.core.functions.Line |
34 |
import org.txm.core.preferences.TBXPreferences |
|
34 | 35 |
import org.txm.functions.concordances.* |
35 | 36 |
import org.txm.functions.concordances.comparators.* |
36 | 37 |
import org.txm.searchengine.cqp.ReferencePattern |
... | ... | |
64 | 65 |
@Field @Option(name="references", usage="references to show", widget="String", required=true, def="text_id") |
65 | 66 |
def references |
66 | 67 |
|
67 |
@Field @Option(name="tsvFile", usage="The result TSV file", widget="FileSave", required=true, def="export.tsv")
|
|
68 |
def tsvFile
|
|
68 |
@Field @Option(name="csvFile", usage="The result TSV file", widget="FileSave", required=true, def="export.tsv")
|
|
69 |
def csvFile
|
|
69 | 70 |
|
70 | 71 |
if (!ParametersDialog.open(this)) return; |
71 | 72 |
|
... | ... | |
82 | 83 |
println "- query: $query" |
83 | 84 |
println "- annotation properties: $properties" |
84 | 85 |
println "- references: $properties" |
85 |
println "- TSV file: $tsvFile"
|
|
86 |
println "- CSV file: $csvFile"
|
|
86 | 87 |
|
87 |
tsvFile = tsvFile.getAbsoluteFile()
|
|
88 |
if (!tsvFile.getParentFile().canWrite()) {
|
|
89 |
println "Error: "+tsvFile.getParentFile()+" is not writable."
|
|
88 |
csvFile = csvFile.getAbsoluteFile()
|
|
89 |
if (!csvFile.getParentFile().canWrite()) {
|
|
90 |
println "Error: "+csvFile.getParentFile()+" is not writable."
|
|
90 | 91 |
return; |
91 | 92 |
} |
92 | 93 |
|
... | ... | |
145 | 146 |
concordance.compute() |
146 | 147 |
//println "Conc done "+(System.currentTimeMillis()-start) |
147 | 148 |
|
148 |
def writer = tsvFile.newWriter("UTF-8");
|
|
149 |
def writer = csvFile.newWriter("UTF-8");
|
|
149 | 150 |
|
150 | 151 |
//println "Writing lines..." |
151 | 152 |
start = System.currentTimeMillis() |
152 | 153 |
String annotHeader = "" |
153 |
for (def annot : annots) annotHeader += "\t$annot" |
|
154 |
writer.write("N"+"\t"+"Références"+"\t"+"ContexteGauche"+"\t"+"Pivot"+annotHeader+"\t"+"ContexteDroit"+"\t"+"id"+"\t"+"text_id\n") |
|
154 |
String separator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR); |
|
155 |
for (def annot : annots) annotHeader += "$separator$annot" |
|
156 |
writer.write("N"+separator+"Références"+separator+"ContexteGauche"+separator+"Pivot"+annotHeader+separator+"ContexteDroit"+separator+"id"+separator+"text_id\n") |
|
155 | 157 |
|
156 | 158 |
// define which occurrence properties will be displayed |
157 | 159 |
concordance.setViewProperties([word]) |
... | ... | |
176 | 178 |
|
177 | 179 |
String poss = ""; |
178 | 180 |
for (def annot : annots) { |
179 |
poss += "\t"+l.getViewRef().getValue(annot)
|
|
181 |
poss += separator+l.getViewRef().getValue(annot)
|
|
180 | 182 |
} |
181 | 183 |
|
182 | 184 |
//println l.getKeywordsViewProperties().get(pos) |
183 |
writer.write(""+(l.getKeywordPosition())+"\t"+refValue+"\t"+lcontext+"\t"+pivot+poss+"\t"+rcontext+"\t"+ids+"\t"+ntext+"\n")
|
|
185 |
writer.write(""+(l.getKeywordPosition())+separator+refValue+separator+lcontext+separator+pivot+poss+separator+rcontext+separator+ids+separator+ntext+"\n")
|
|
184 | 186 |
} |
185 | 187 |
writer.flush() |
186 | 188 |
} |
187 |
println "Saved in "+tsvFile.getAbsolutePath()
|
|
189 |
println "Saved in "+csvFile.getAbsolutePath()
|
|
188 | 190 |
writer.close() |
189 | 191 |
|
190 | 192 |
concordance.delete() |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/annotation/ExportWordPropertiesToTableMacro.groovy (revision 3437) | ||
---|---|---|
31 | 31 |
import org.txm.searchengine.cqp.corpus.query.* |
32 | 32 |
import org.txm.concordance.core.functions.Concordance |
33 | 33 |
import org.txm.concordance.core.functions.Line |
34 |
import org.txm.core.preferences.TBXPreferences |
|
34 | 35 |
import org.txm.functions.concordances.* |
35 | 36 |
import org.txm.functions.concordances.comparators.* |
36 | 37 |
import org.txm.searchengine.cqp.ReferencePattern |
... | ... | |
64 | 65 |
@Field @Option(name="references", usage="references to show", widget="String", required=true, def="text_id") |
65 | 66 |
def references |
66 | 67 |
|
67 |
@Field @Option(name="tsvFile", usage="The result TSV file", widget="FileSave", required=true, def="export.tsv")
|
|
68 |
def tsvFile
|
|
68 |
@Field @Option(name="csvFile", usage="The result TSV file", widget="FileSave", required=true, def="export.tsv")
|
|
69 |
def csvFile
|
|
69 | 70 |
|
70 | 71 |
if (!ParametersDialog.open(this)) return; |
71 | 72 |
|
... | ... | |
82 | 83 |
println "- query: $query" |
83 | 84 |
println "- annotation properties: $properties" |
84 | 85 |
println "- references: $properties" |
85 |
println "- TSV file: $tsvFile"
|
|
86 |
println "- CSV file: $csvFile"
|
|
86 | 87 |
|
87 |
tsvFile = tsvFile.getAbsoluteFile()
|
|
88 |
if (!tsvFile.getParentFile().canWrite()) {
|
|
89 |
println "Error: "+tsvFile.getParentFile()+" is not writable."
|
|
88 |
csvFile = csvFile.getAbsoluteFile()
|
|
89 |
if (!csvFile.getParentFile().canWrite()) {
|
|
90 |
println "Error: "+csvFile.getParentFile()+" is not writable."
|
|
90 | 91 |
return; |
91 | 92 |
} |
92 | 93 |
|
... | ... | |
145 | 146 |
concordance.compute() |
146 | 147 |
//println "Conc done "+(System.currentTimeMillis()-start) |
147 | 148 |
|
148 |
def writer = tsvFile.newWriter("UTF-8");
|
|
149 |
def writer = csvFile.newWriter("UTF-8");
|
|
149 | 150 |
|
150 | 151 |
//println "Writing lines..." |
151 | 152 |
start = System.currentTimeMillis() |
152 | 153 |
String annotHeader = "" |
154 |
String separator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR); |
|
153 | 155 |
for (def annot : annots) annotHeader += "\t$annot" |
154 |
writer.write("N"+"\t"+"Références"+"\t"+"ContexteGauche"+"\t"+"Pivot"+annotHeader+"\t"+"ContexteDroit"+"\t"+"id"+"\t"+"text_id\n")
|
|
156 |
writer.write("N"+separator+"Références"+separator+"ContexteGauche"+separator+"Pivot"+annotHeader+separator+"ContexteDroit"+separator+"id"+separator+"text_id\n")
|
|
155 | 157 |
|
156 | 158 |
// define which occurrence properties will be displayed |
157 | 159 |
concordance.setViewProperties([word]) |
... | ... | |
176 | 178 |
|
177 | 179 |
String poss = ""; |
178 | 180 |
for (def annot : annots) { |
179 |
poss += "\t"+l.getViewRef().getValue(annot)
|
|
181 |
poss += separator+l.getViewRef().getValue(annot)
|
|
180 | 182 |
} |
181 | 183 |
|
182 | 184 |
//println l.getKeywordsViewProperties().get(pos) |
183 |
writer.write(""+(l.getKeywordPosition())+"\t"+refValue+"\t"+lcontext+"\t"+pivot+poss+"\t"+rcontext+"\t"+ids+"\t"+ntext+"\n")
|
|
185 |
writer.write(""+(l.getKeywordPosition())+separator+refValue+separator+lcontext+separator+pivot+poss+separator+rcontext+separator+ids+separator+ntext+"\n")
|
|
184 | 186 |
} |
185 | 187 |
writer.flush() |
186 | 188 |
} |
187 |
println "Saved in "+tsvFile.getAbsolutePath()
|
|
189 |
println "Saved in "+csvFile.getAbsolutePath()
|
|
188 | 190 |
writer.close() |
189 | 191 |
|
190 | 192 |
concordance.delete() |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/export/ExportTextsMetadataMacro.groovy (revision 3437) | ||
---|---|---|
15 | 15 |
|
16 | 16 |
// PARAMETERS |
17 | 17 |
|
18 |
@Field @Option(name="tsvFile", usage="CSV file path", widget="File", required=true, def="/tmp/metadata.csv")
|
|
19 |
def File tsvFile
|
|
18 |
@Field @Option(name="csvFile", usage="CSV file path", widget="File", required=true, def="/tmp/metadata.csv")
|
|
19 |
def File csvFile
|
|
20 | 20 |
|
21 | 21 |
@Field @Option(name="columnSeparator", usage="column columnSeparator", widget="String", required=false, def="\t") |
22 | 22 |
def columnSeparator |
... | ... | |
26 | 26 |
// BEGINNING |
27 | 27 |
CQPCorpus corpus = corpusViewSelection |
28 | 28 |
def CQI = CQPSearchEngine.getCqiClient() |
29 |
def writer = tsvFile.newWriter("UTF-8")
|
|
29 |
def writer = csvFile.newWriter("UTF-8")
|
|
30 | 30 |
def internalTextProperties = ["project", "base", "path"] |
31 | 31 |
|
32 |
println "Exporting $corpus metadata to $tsvFile file."
|
|
32 |
println "Exporting $corpus metadata to $csvFile file."
|
|
33 | 33 |
|
34 | 34 |
def text = corpus.getStructuralUnit("text") |
35 | 35 |
def properties = text.getProperties() |
... | ... | |
58 | 58 |
propertyValues[property] = values |
59 | 59 |
} |
60 | 60 |
|
61 |
// writing result to tsvFile
|
|
61 |
// writing result to csvFile
|
|
62 | 62 |
def c = 0 |
63 | 63 |
properties.each { property -> |
64 | 64 |
if (!internalTextProperties.contains(property.getName())) { |
TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLStatisticsMacro.groovy (revision 3437) | ||
---|---|---|
8 | 8 |
@Field @Option(name="inputDirectory", usage="Dossier qui contient les fichiers à parser", widget="Folder", required=true, def="src") |
9 | 9 |
File inputDirectory; |
10 | 10 |
|
11 |
@Field @Option(name="tsvFile", usage="FichierTSV résultat", widget="File", required=true, def="file.tsv")
|
|
12 |
File tsvFile;
|
|
11 |
@Field @Option(name="csvFile", usage="FichierTSV résultat", widget="File", required=true, def="file.tsv")
|
|
12 |
File csvFile;
|
|
13 | 13 |
|
14 | 14 |
@Field @Option(name="usePaths", usage="FichierTSV résultat", widget="Boolean", required=true, def="false") |
15 | 15 |
def usePaths = true |
... | ... | |
20 | 20 |
|
21 | 21 |
if (!ParametersDialog.open(this)) return; |
22 | 22 |
|
23 |
tsvFile = tsvFile.getAbsoluteFile()
|
|
23 |
csvFile = csvFile.getAbsoluteFile()
|
|
24 | 24 |
println "Input directory: "+inputDirectory |
25 |
println "TSV file: "+tsvFile
|
|
25 |
println "CSV file: "+csvFile
|
|
26 | 26 |
println "use paths $usePaths" |
27 | 27 |
println "use attributes $useAttributes" |
28 | 28 |
println "use attributes values $useAttributeValues" |
29 | 29 |
|
30 |
XMLStatistics.processDirectory(inputDirectory, tsvFile, ".xml", usePaths, useAttributes, useAttributeValues); |
|
30 |
XMLStatistics.processDirectory(inputDirectory, csvFile, ".xml", usePaths, useAttributes, useAttributeValues); |
TXM/trunk/org.txm.core/src/java/org/txm/Toolbox.java (revision 3437) | ||
---|---|---|
40 | 40 |
import java.util.Arrays; |
41 | 41 |
import java.util.HashSet; |
42 | 42 |
import java.util.LinkedHashMap; |
43 |
import java.util.List; |
|
43 | 44 |
import java.util.Locale; |
44 | 45 |
import java.util.Set; |
45 | 46 |
import java.util.logging.Level; |
... | ... | |
67 | 68 |
import org.txm.core.preferences.TBXPreferences; |
68 | 69 |
import org.txm.core.preferences.TXMPreferences; |
69 | 70 |
import org.txm.core.results.TXMResult; |
71 |
import org.txm.objects.CorpusBuild; |
|
70 | 72 |
import org.txm.objects.Workspace; |
71 | 73 |
import org.txm.utils.BundleUtils; |
72 | 74 |
import org.txm.utils.DeleteDir; |
... | ... | |
826 | 828 |
} |
827 | 829 |
} |
828 | 830 |
} |
829 |
|
|
831 |
|
|
830 | 832 |
/** |
831 | 833 |
* @return the Eclipse RCP configuration directory (osgi.configuration.area) |
832 | 834 |
*/ |
833 | 835 |
public static String getConfigurationDirectory() { |
834 | 836 |
return OSGIUtils.getDefault().getConfigurationLocation().getURL().toString().substring(5); |
835 | 837 |
} |
836 |
|
|
838 |
|
|
837 | 839 |
public static void writeStartupCorporaDiagnostics(File checkupResultFile) { |
838 | 840 |
|
839 | 841 |
Log.warning(NLS.bind("TXM was not correctly closed, see the report in the ''{0}'' file", checkupResultFile.getAbsolutePath())); |
... | ... | |
850 | 852 |
IProject projects[] = rcpWorkspace.getRoot().getProjects(); |
851 | 853 |
|
852 | 854 |
for (IProject rcpProject : projects) { |
853 |
|
|
855 |
|
|
854 | 856 |
if (rcpProject.equals(corporaDirectory)) continue; |
855 | 857 |
|
856 | 858 |
String s1 = rcpProject.getLocationURI().toString(); |
... | ... | |
862 | 864 |
} |
863 | 865 |
|
864 | 866 |
org.txm.objects.Project project = Toolbox.workspace.getProject(rcpProject.getName().toUpperCase()); |
865 |
|
|
867 |
|
|
866 | 868 |
if (project == null) { |
867 | 869 |
builder.append("Corpus Project: "+rcpProject.getName()+" not found.\n\n"); |
868 | 870 |
continue; |
869 | 871 |
} |
870 | 872 |
|
871 |
File indexes = new File(project.getProjectDirectory(), "data/"+project.getName()); |
|
872 |
if (indexes.exists()) { |
|
873 |
if (indexes.listFiles().length == 0) { |
|
874 |
builder.append(" no CQP data files in directory: "+indexes.getAbsolutePath()); |
|
875 |
builder.append("\n"); |
|
876 |
} |
|
877 |
} else { |
|
878 |
builder.append(" no CQP data directory: "+indexes.getAbsolutePath()); |
|
873 |
CorpusBuild corpus = project.getCorpusBuild(project.getName().toUpperCase()); |
|
874 |
if (corpus == null) { |
|
875 |
builder.append(" no CQP corpus with name: "+project.getName().toUpperCase()); |
|
876 |
builder.append(" the import was not done or failed"); |
|
879 | 877 |
builder.append("\n"); |
880 | 878 |
} |
881 | 879 |
|
882 |
builder.append("Project: "+project.getName()+" at "+project.getProjectDirectory()); |
|
883 |
builder.append("\n"); |
|
884 |
builder.append(" creation: "+project.getCreationDate()); |
|
885 |
builder.append("\n"); |
|
886 |
builder.append(" update: "+project.getLastComputingDate()); |
|
887 |
builder.append("\n"); |
|
888 |
builder.append(" 'default' edition: "+project.getEditionDefinition("default")); |
|
889 |
builder.append("\n"); |
|
890 |
builder.append(" 'facs' edition: "+project.getEditionDefinition("facs")); |
|
891 |
builder.append("\n"); |
|
892 |
builder.append(" 'preferences': "+TXMPreferences.dumpToString(project.getParametersNodePath())); |
|
893 |
builder.append("\n"); |
|
880 |
List<?> errors = corpus.isBuildValid(); |
|
881 |
if (errors != null && errors.size() > 0) { |
|
882 |
builder.append(" corpus built failed with file errors: "+errors); |
|
883 |
builder.append(" the import or update failed"); |
|
884 |
builder.append("\n"); |
|
885 |
} |
|
894 | 886 |
|
895 |
builder.append(" Results: ");
|
|
896 |
builder.append("\n");
|
|
897 |
for (TXMResult result : project.getDeepChildren()) {
|
|
898 |
builder.append(" "+result.getName()+" ("+result.getResultType()+"): "+result.getSimpleDetails());
|
|
887 |
String error = corpus.isReady();
|
|
888 |
if (error != null && error.length() > 0) {
|
|
889 |
builder.append(" corpus is not ready: "+error);
|
|
890 |
builder.append(" the import or update failed");
|
|
899 | 891 |
builder.append("\n"); |
900 |
builder.append(" 'preferences': "+TXMPreferences.dumpToString(result.getParametersNodePath())); |
|
892 |
} |
|
893 |
|
|
894 |
|
|
895 |
if (Log.getLevel().intValue() < Level.INFO.intValue()) { // print more details if log level is lower than INFO |
|
896 |
|
|
897 |
builder.append("Project: "+project.getName()+" at "+project.getProjectDirectory()); |
|
901 | 898 |
builder.append("\n"); |
899 |
builder.append(" creation: "+project.getCreationDate()); |
|
900 |
builder.append("\n"); |
|
901 |
builder.append(" update: "+project.getLastComputingDate()); |
|
902 |
builder.append("\n"); |
|
903 |
builder.append(" 'default' edition: "+project.getEditionDefinition("default")); |
|
904 |
builder.append("\n"); |
|
905 |
builder.append(" 'facs' edition: "+project.getEditionDefinition("facs")); |
|
906 |
builder.append("\n"); |
|
907 |
builder.append(" 'preferences': "+TXMPreferences.dumpToString(project.getParametersNodePath())); |
|
908 |
builder.append("\n"); |
|
909 |
|
|
910 |
builder.append(" Results: "); |
|
911 |
builder.append("\n"); |
|
912 |
for (TXMResult result : project.getDeepChildren()) { |
|
913 |
builder.append(" "+result.getName()+" ("+result.getResultType()+"): "+result.getSimpleDetails()); |
|
914 |
builder.append("\n"); |
|
915 |
builder.append(" 'preferences': "+TXMPreferences.dumpToString(result.getParametersNodePath())); |
|
916 |
builder.append("\n"); |
|
917 |
} |
|
918 |
builder.append("\n"); |
|
902 | 919 |
} |
903 |
builder.append("\n"); |
|
904 | 920 |
} |
905 | 921 |
|
906 | 922 |
IOUtils.write(checkupResultFile, builder.toString()); |
TXM/trunk/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 3437) | ||
---|---|---|
973 | 973 |
public abstract CorpusBuild getRootCorpusBuild(); |
974 | 974 |
|
975 | 975 |
public abstract List<? extends Match> getMatches(); |
976 |
|
|
977 |
/** |
|
978 |
* |
|
979 |
* @return a list of errors if any, empty means the corpus is build is OK |
|
980 |
*/ |
|
981 |
public abstract List<?> isBuildValid(); |
|
982 |
|
|
983 |
/** |
|
984 |
* |
|
985 |
* @return true an error message if the corpus is not ready |
|
986 |
*/ |
|
987 |
public abstract String isReady(); |
|
976 | 988 |
} |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 3437) | ||
---|---|---|
239 | 239 |
if (new File("txm_was_not_closed_correctly.lock").exists()) { // the close control file was not deleted |
240 | 240 |
|
241 | 241 |
File checkupResultFile = new File("startup_diagnostic_"+Toolbox.dateformat.format(new Date())+".txt"); |
242 |
Toolbox.writeStartupCorporaDiagnostics(checkupResultFile); |
|
243 | 242 |
this.syncExec(new Runnable() { |
244 | 243 |
@Override |
245 | 244 |
public void run() { |
246 |
org.txm.rcp.handlers.files.EditFile.openfile(checkupResultFile); |
|
245 |
int choice = MessageDialog.open(MessageDialog.QUESTION_WITH_CANCEL, Display.getDefault().getActiveShell(), |
|
246 |
"TXM was not correctly stopped", |
|
247 |
NLS.bind("Do you want to start a diagnostic of your corpora?\n\n(the diagnostic will be saved in the ''{0}'' file, the path will be copied in the clipboard)", checkupResultFile) |
|
248 |
, SWT.NONE, new String[] {"Cancel", "OK", "OK, open the diagnostic file"}); |
|
249 |
|
|
250 |
if (choice != 0) { |
|
251 |
Toolbox.writeStartupCorporaDiagnostics(checkupResultFile); |
|
252 |
} |
|
253 |
|
|
254 |
if (choice == 2) { |
|
255 |
org.txm.rcp.handlers.files.EditFile.openfile(checkupResultFile); |
|
256 |
} |
|
257 |
|
|
247 | 258 |
} |
248 | 259 |
}); |
249 |
|
|
250 | 260 |
new File("txm_was_not_closed_correctly.lock").delete(); |
251 | 261 |
} |
252 | 262 |
new File("txm_was_not_closed_correctly.lock").createNewFile(); |
... | ... | |
306 | 316 |
public static String getTXMStartMessage() { |
307 | 317 |
|
308 | 318 |
String pretty_version = getTXMVersionPrettyString(); |
309 |
return NLS.bind(TXMUIMessages.startingUpP0, pretty_version);
|
|
319 |
return NLS.bind(TXMUIMessages.startingUpP0, pretty_version); |
|
310 | 320 |
|
311 | 321 |
} |
312 | 322 |
|
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 3437) | ||
---|---|---|
33 | 33 |
import java.util.Arrays; |
34 | 34 |
import java.util.HashMap; |
35 | 35 |
import java.util.HashSet; |
36 |
import java.util.LinkedList; |
|
36 | 37 |
import java.util.List; |
37 | 38 |
import java.util.Map; |
38 | 39 |
import java.util.Set; |
... | ... | |
695 | 696 |
} |
696 | 697 |
return textids; |
697 | 698 |
} |
699 |
|
|
700 |
public File getRegistryFile() { |
|
701 |
return registryFile; |
|
702 |
} |
|
703 |
|
|
704 |
public File getDataDirectory() { |
|
705 |
return dataDirectory; |
|
706 |
} |
|
707 |
|
|
708 |
@Override |
|
709 |
public List<String> isBuildValid() { |
|
710 |
|
|
711 |
LinkedList<String> errors = new LinkedList<>(); |
|
712 |
|
|
713 |
if (!dataDirectory.exists()) { |
|
714 |
errors.add("no data directory: "+dataDirectory); |
|
715 |
} |
|
716 |
|
|
717 |
//File registryFile = new File(this.registryFile); |
|
718 |
if (!registryFile.exists()) { |
|
719 |
errors.add("no registry file: "+registryFile); |
|
720 |
} |
|
721 |
|
|
722 |
errors.addAll(new ReadRegistryFile(registryFile).isCorpusBuildValid(dataDirectory)); |
|
723 |
|
|
724 |
return errors; |
|
725 |
} |
|
726 |
|
|
727 |
@Override |
|
728 |
public String isReady() { |
|
729 |
|
|
730 |
if (!hasBeenComputedOnce()) return "the Maincorpus is not a computed TXMResult"; |
|
731 |
|
|
732 |
try { |
|
733 |
int s = this.getSize(); |
|
734 |
if (s >= 0) return null; |
|
735 |
return "negative size"; |
|
736 |
} |
|
737 |
catch (CqiClientException e) { |
|
738 |
return e.getMessage(); |
|
739 |
} |
|
740 |
} |
|
698 | 741 |
} |
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 3437) | ||
---|---|---|
30 | 30 |
import java.io.File; |
31 | 31 |
import java.io.IOException; |
32 | 32 |
import java.util.ArrayList; |
33 |
import java.util.Arrays; |
|
33 | 34 |
import java.util.HashMap; |
35 |
import java.util.LinkedList; |
|
34 | 36 |
import java.util.List; |
35 | 37 |
import java.util.UUID; |
36 | 38 |
|
... | ... | |
781 | 783 |
return this.getName() + " (" + this.getQualifiedCqpId() + ")"; |
782 | 784 |
} |
783 | 785 |
} |
784 |
|
|
785 |
|
|
786 |
|
|
786 |
|
|
787 |
@Override |
|
788 |
public List<?> isBuildValid() { |
|
789 |
|
|
790 |
if (this.getParent() != null) return new LinkedList<String>(); // ok |
|
791 |
|
|
792 |
return Arrays.asList("No parent corpus result"); |
|
793 |
} |
|
794 |
|
|
795 |
@Override |
|
796 |
public String isReady() { |
|
797 |
|
|
798 |
if (!hasBeenComputedOnce()) return "the subcorpus is not a computed TXMResult"; |
|
799 |
|
|
800 |
try { |
|
801 |
int s = this.getSize(); |
|
802 |
if (s >= 0) return null; |
|
803 |
return "negative size"; |
|
804 |
} |
|
805 |
catch (CqiClientException e) { |
|
806 |
return e.getMessage(); |
|
807 |
} |
|
808 |
} |
|
787 | 809 |
} |
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/view/PropertyField.java (revision 3437) | ||
---|---|---|
61 | 61 |
if (e.widget.isDisposed()) return; |
62 | 62 |
if (first) { |
63 | 63 |
first = false; |
64 |
return; |
|
65 | 64 |
} |
66 | 65 |
if (!t.getText().equals(view.getAnalecVue().getValeurChamp(view.element, t.getToolTipText()))) { |
67 | 66 |
t.setBackground(new Color(t.getDisplay(),254, 216, 177)); |
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/view/ElementPropertiesView.java (revision 3437) | ||
---|---|---|
83 | 83 |
}; |
84 | 84 |
|
85 | 85 |
private org.txm.searchengine.cqp.corpus.CQPCorpus corpus; |
86 |
|
|
87 |
private ToolItem applyButton; |
|
86 | 88 |
|
87 | 89 |
// private KeyListener allControlsKeyListener; |
88 | 90 |
|
... | ... | |
182 | 184 |
public void widgetDefaultSelected(SelectionEvent e) { } |
183 | 185 |
}); |
184 | 186 |
|
187 |
applyButton = new ToolItem(buttons, SWT.ARROW | SWT.END); |
|
188 |
applyButton.setText("OK"); |
|
189 |
applyButton.setToolTipText("Apply all new values in the fields"); |
|
190 |
applyButton.addSelectionListener(new SelectionListener() { |
|
191 |
@Override |
|
192 |
public void widgetSelected(SelectionEvent e) { |
|
193 |
for (PropertyField c : textWidgets.values()) { |
|
194 |
if (c.isDisposed()) continue; |
|
195 |
saveFieldValue(c); |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
201 |
}); |
|
202 |
|
|
185 | 203 |
fields = new Composite(parent, SWT.NONE); |
186 | 204 |
GridData fields_gdata = new GridData(GridData.FILL, GridData.FILL, true, true); |
187 | 205 |
fields.setLayoutData(fields_gdata); |
TXM/trunk/org.txm.analec.rcp/src/org/txm/macro/urs/prototypes/exploit/AllMesuresMacro.groovy (revision 3437) | ||
---|---|---|
12 | 12 |
import org.txm.* |
13 | 13 |
import org.txm.rcp.swt.widget.parameters.* |
14 | 14 |
import org.txm.annotation.urs.* |
15 |
import org.txm.core.preferences.TBXPreferences |
|
16 |
import org.txm.core.preferences.TXMPreferences |
|
15 | 17 |
import org.txm.searchengine.cqp.corpus.* |
16 | 18 |
import org.apache.commons.lang.StringUtils; |
17 | 19 |
|
18 | 20 |
// BEGINNING OF PARAMETERS |
19 | 21 |
|
20 |
@Field @Option(name="tsvFile",usage="", widget="FileSave", required=true, def="result.tsv")
|
|
21 |
File tsvFile
|
|
22 |
@Field @Option(name="csvFile",usage="", widget="FileSave", required=true, def="result.tsv")
|
|
23 |
File csvFile
|
|
22 | 24 |
|
23 | 25 |
@Field @Option(name="default_schema_ursql", usage="TYPE@PROP=REGEX", widget="String", required=true, def="CHAINE") |
24 | 26 |
String default_schema_ursql |
... | ... | |
114 | 116 |
} |
115 | 117 |
|
116 | 118 |
// WRITE RESULTS IN THE TSV FILE |
117 |
tsvFile.withWriter("UTF-8") { writer -> |
|
119 |
def separator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR) |
|
120 |
csvFile.withWriter("UTF-8") { writer -> |
|
118 | 121 |
writer.println "\t"+mesures.join("\t") |
119 | 122 |
table.each { line -> writer.println line.join("\t") } |
120 | 123 |
} |
121 | 124 |
|
122 |
println "Done. Results are saved in ${tsvFile.getAbsolutePath()} file."
|
|
125 |
println "Done. Results are saved in ${csvFile.getAbsolutePath()} file."
|
|
123 | 126 |
|
124 | 127 |
// UTILITY FUNCTIONS |
125 | 128 |
def execMesure(def mesure, def line, def corpus, def params) { |
Formats disponibles : Unified diff