Révision 3925
TXM/trunk/bundles/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/SaveAnnotationsAndUpdateCorpus.java (revision 3925) | ||
---|---|---|
38 | 38 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
39 | 39 |
|
40 | 40 |
ISelection sel = HandlerUtil.getCurrentSelection(event); |
41 |
// if (!(sel instanceof IStructuredSelection)) {
|
|
42 |
// Log.info("No available selection to target the corpus annotations to save");
|
|
43 |
// return null;
|
|
44 |
// }
|
|
41 |
if (!(sel instanceof IStructuredSelection)) { |
|
42 |
Log.info("No available selection to target the corpus annotations to save"); |
|
43 |
return null; |
|
44 |
} |
|
45 | 45 |
IStructuredSelection selection = (IStructuredSelection) sel; |
46 | 46 |
|
47 | 47 |
List<MainCorpus> corpora = Workspace.getInstance().getDeepChildren(MainCorpus.class); |
TXM/trunk/bundles/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 3925) | ||
---|---|---|
171 | 171 |
Annotation a = annotationLine.getAnnotation(); |
172 | 172 |
if (value == null) value = a.getValue(); |
173 | 173 |
|
174 |
if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
|
|
174 |
if (a.getStart() < line.matchGetStart()) { |
|
175 | 175 |
value = "… " + value; //$NON-NLS-1$ |
176 |
} else if (a.getStart() > line.matchGetStart()) { |
|
177 |
//value = "> " + value; //$NON-NLS-1$ |
|
176 | 178 |
} |
177 | 179 |
|
178 |
if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
|
|
180 |
if (a.getEnd() > line.matchGetEnd()) { |
|
179 | 181 |
value = value + " …"; //$NON-NLS-1$ |
182 |
} else if (a.getEnd() < line.matchGetEnd()) { |
|
183 |
//value = value + " <"; //$NON-NLS-1$ |
|
180 | 184 |
} |
181 | 185 |
return value; |
182 | 186 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 3925) | ||
---|---|---|
182 | 182 |
Annotation a = annotationLine.getAnnotation(); |
183 | 183 |
if (value == null) value = a.getValue(); |
184 | 184 |
|
185 |
if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
|
|
185 |
if (a.getStart() < line.matchGetStart()) { |
|
186 | 186 |
value = "… " + value; //$NON-NLS-1$ |
187 |
} else if (a.getStart() > line.matchGetStart()) { |
|
188 |
//value = "> " + value; //$NON-NLS-1$ |
|
187 | 189 |
} |
188 | 190 |
|
189 |
if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
|
|
191 |
if (a.getEnd() > line.matchGetEnd()) { |
|
190 | 192 |
value = value + " …"; //$NON-NLS-1$ |
193 |
} else if (a.getEnd() < line.matchGetEnd()) { |
|
194 |
//value = value + " <"; //$NON-NLS-1$ |
|
191 | 195 |
} |
192 | 196 |
return value; |
193 | 197 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 3925) | ||
---|---|---|
449 | 449 |
Annotation a = annotationLine.getAnnotation(); |
450 | 450 |
if (value == null) value = a.getValue(); |
451 | 451 |
|
452 |
if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
|
|
452 |
if (a.getStart() < line.matchGetStart()) { |
|
453 | 453 |
value = "… " + value; //$NON-NLS-1$ |
454 |
} else if (a.getStart() > line.matchGetStart()) { |
|
455 |
//value = "> " + value; //$NON-NLS-1$ |
|
454 | 456 |
} |
455 | 457 |
|
456 |
if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
|
|
458 |
if (a.getEnd() > line.matchGetEnd()) { |
|
457 | 459 |
value = value + " …"; //$NON-NLS-1$ |
460 |
} else if (a.getEnd() < line.matchGetEnd()) { |
|
461 |
//value = value + " <"; //$NON-NLS-1$ |
|
458 | 462 |
} |
459 | 463 |
return value; |
460 | 464 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/ConcordanceAnnotations.java (revision 3925) | ||
---|---|---|
5 | 5 |
import java.util.HashMap; |
6 | 6 |
import java.util.LinkedHashMap; |
7 | 7 |
import java.util.List; |
8 |
import java.util.TreeMap; |
|
9 | 8 |
|
10 | 9 |
import org.eclipse.osgi.util.NLS; |
11 | 10 |
import org.txm.annotation.kr.core.Annotation; |
... | ... | |
148 | 147 |
int nAnnotations = annotations.size(); |
149 | 148 |
|
150 | 149 |
while (iMatch < nMatch && iAnnotation < nAnnotations) { |
150 |
|
|
151 | 151 |
if (overlap) { |
152 | 152 |
if (matches.get(iMatch).getEnd() < annotations.get(iAnnotation).getStart()) { |
153 | 153 |
iMatch++; |
... | ... | |
195 | 195 |
hasAnnotations = true; |
196 | 196 |
} |
197 | 197 |
} else { |
198 |
if (annot.getStart()==m.getStart() && annot.getEnd()==m.getEnd()) {
|
|
198 |
if (annot.getStart() == m.getStart() && annot.getEnd()==m.getEnd()) {
|
|
199 | 199 |
annotsList.put(m, annot); |
200 | 200 |
hasAnnotations = true; |
201 | 201 |
} |
TXM/trunk/bundles/org.txm.groovy.core/src/java/org/txm/groovy/core/InstallGroovyFiles.java (revision 3925) | ||
---|---|---|
91 | 91 |
// copy modified files in the backup directory |
92 | 92 |
backupFiles(userDirectory, systemDirectory , userDirectory.getParentFile()); |
93 | 93 |
|
94 |
BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", systemDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
95 | 94 |
BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", userDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
96 | 95 |
|
96 |
try { |
|
97 |
Thread.sleep(1000); |
|
98 |
} |
|
99 |
catch (InterruptedException e) { |
|
100 |
// TODO Auto-generated catch block |
|
101 |
e.printStackTrace(); |
|
102 |
} |
|
103 |
|
|
104 |
BundleUtils.copyFiles(bundle_id, "", "src/groovy", "", systemDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
105 |
|
|
97 | 106 |
bundle_id = "org.txm.core"; //$NON-NLS-1$ |
98 | 107 |
|
99 | 108 |
// copy additional Groovy files from the src/java directory of |
100 |
File scriptsPackageDirectory = new File(userDirectory, "org/txm/scripts/importer"); //$NON-NLS-1$
|
|
109 |
File scriptsPackageDirectory = new File(systemDirectory, "org/txm/scripts/importer"); //$NON-NLS-1$
|
|
101 | 110 |
scriptsPackageDirectory.mkdirs(); |
102 | 111 |
BundleUtils.copyFiles(bundle_id, "src/java/", "org/txm/scripts/importer", "", scriptsPackageDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
103 | 112 |
|
104 |
scriptsPackageDirectory = new File(systemDirectory, "org/txm/scripts/importer"); //$NON-NLS-1$ |
|
113 |
try { |
|
114 |
Thread.sleep(1000); |
|
115 |
} |
|
116 |
catch (InterruptedException e) { |
|
117 |
// TODO Auto-generated catch block |
|
118 |
e.printStackTrace(); |
|
119 |
} |
|
120 |
|
|
121 |
scriptsPackageDirectory = new File(userDirectory, "org/txm/scripts/importer"); //$NON-NLS-1$ |
|
105 | 122 |
scriptsPackageDirectory.mkdirs(); |
106 | 123 |
BundleUtils.copyFiles(bundle_id, "src/java/", "org/txm/scripts/importer", "", scriptsPackageDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
107 |
|
|
124 |
|
|
108 | 125 |
return scriptsDirectory.exists(); |
109 | 126 |
} |
110 | 127 |
|
TXM/trunk/bundles/org.txm.core/META-INF/MANIFEST.MF (revision 3925) | ||
---|---|---|
472 | 472 |
org.txm.libs.msoffice;bundle-version="0.0.0";visibility:=reexport, |
473 | 473 |
org.txm.libs.hsqldb;bundle-version="1.0.0";visibility:=reexport, |
474 | 474 |
org.txm.tokenizer.core;bundle-version="1.0.0";visibility:=reexport, |
475 |
org.txm.libs.jodconverter;bundle-version="1.0.0"
|
|
475 |
org.txm.libs.jodconverter;bundle-version="4.4.6"
|
|
476 | 476 |
Bundle-ActivationPolicy: lazy |
477 | 477 |
Bundle-ManifestVersion: 2 |
478 | 478 |
Bundle-Activator: org.txm.core.Activator |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationWriter.java (revision 3925) | ||
---|---|---|
20 | 20 |
import org.txm.annotation.kr.core.repository.AnnotationEffect; |
21 | 21 |
import org.txm.annotation.kr.core.repository.AnnotationType; |
22 | 22 |
import org.txm.annotation.kr.core.repository.KnowledgeRepository; |
23 |
import org.txm.core.preferences.TBXPreferences; |
|
24 |
import org.txm.core.preferences.TXMPreferences; |
|
25 | 23 |
import org.txm.importer.ValidateXml; |
26 | 24 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
27 | 25 |
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException; |
... | ... | |
35 | 33 |
|
36 | 34 |
public class AnnotationWriter { |
37 | 35 |
|
36 |
boolean debug = false; |
|
37 |
|
|
38 | 38 |
MainCorpus corpus; |
39 | 39 |
|
40 | 40 |
private List<AnnotationType> types; |
... | ... | |
281 | 281 |
ArrayList<Annotation> segmentAnnotations, ArrayList<Annotation> tokenAnnotations, File tmpXMLTXMDirectory, File previousXMLTXMDirectory) throws CqiClientException, IOException, |
282 | 282 |
CqiServerError, InvalidCqpIdException, XMLStreamException { |
283 | 283 |
Log.fine("Writing annotations for text " + xmlFile + " segment annotations=" + segmentAnnotations.size() + " token annotations=" + tokenAnnotations.size()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
284 |
// System.out.println(segmentAnnotations);
|
|
285 |
// System.out.println(tokenAnnotations);
|
|
284 |
if (debug) System.out.println(segmentAnnotations);
|
|
285 |
if (debug) System.out.println(tokenAnnotations);
|
|
286 | 286 |
|
287 | 287 |
boolean show_debug = Log.getLevel().intValue() < Level.INFO.intValue(); |
288 | 288 |
AnnotationInjector annotationInjector = new AnnotationInjector(xmlFile, segmentAnnotations, tokenAnnotations, text_start_position, show_debug); |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationInjector.java (revision 3925) | ||
---|---|---|
32 | 32 |
|
33 | 33 |
File xmlFile; |
34 | 34 |
|
35 |
HashMap<Integer, List<Annotation>> annotationsToAddByStartPos; // contains |
|
36 |
// annotation |
|
37 |
// to write |
|
35 |
HashMap<Integer, List<Annotation>> annotationsToAddByStartPos; // contains annotation to write |
|
38 | 36 |
|
39 | 37 |
HashMap<Integer, List<Annotation>> annotationsToAddByEndPos; |
40 | 38 |
|
... | ... | |
171 | 169 |
currentStartAnnotations = annotationsToAddByStartPos.get(position_counter); |
172 | 170 |
currentEndAnnotations = annotationsToAddByEndPos.get(position_counter); |
173 | 171 |
// System.out.println("A Starts: "+currentStartAnnotations+" "+currentEndAnnotations); |
174 |
// if (debug) |
|
175 |
// System.out.println("----- "+localname+"@"+position_counter+" START ANNOT = "+currentStartAnnotations); |
|
172 |
if (debug) System.out.println("----- "+localname+"@"+position_counter+" START ANNOT = "+currentStartAnnotations); |
|
176 | 173 |
if ("teiHeader".equals(localname)) { //$NON-NLS-1$ |
177 | 174 |
super.processStartElement(); |
178 |
goToEnd("teiHeader"); // skip teiHeader // will be closed in //$NON-NLS-1$ |
|
179 |
// processEndElement() |
|
175 |
goToEnd("teiHeader"); //$NON-NLS-1$ // skip teiHeader // will be closed in processEndElement() |
|
180 | 176 |
} |
181 | 177 |
else if ("w".equals(localname)) { //$NON-NLS-1$ |
182 |
// System.out.println("W START pos="+position_counter+" annots="+currentStartAnnotations); |
|
178 |
//if (debug) System.out.println("W START pos="+position_counter+" annots="+currentStartAnnotations);
|
|
183 | 179 |
if (currentStartAnnotations != null) {// there are still annotations |
184 |
// to write, possible |
|
185 |
// several for a position |
|
186 |
// if (debug) |
|
187 |
// System.out.println("WRITING START at "+position_counter+": "+currentStartAnnotations); |
|
180 |
// to write, possible several for a position |
|
181 |
//if (debug) System.out.println("WRITING START at "+position_counter+": "+currentStartAnnotations); |
|
188 | 182 |
for (Annotation a : currentStartAnnotations) { |
189 | 183 |
if (!"#del".equals(a.getValue())) { //$NON-NLS-1$ |
190 | 184 |
if (debug) { |
... | ... | |
293 | 287 |
super.processStartElement(); |
294 | 288 |
} |
295 | 289 |
} |
296 |
else if (currentStartAnnotations != null) { // is it an annotations ?
|
|
290 |
else if (currentStartAnnotations != null) { // is their any annotations to write ?
|
|
297 | 291 |
// System.out.println("A START="+localname); |
298 | 292 |
|
299 | 293 |
String s_end = parser.getAttributeValue(null, "end"); //$NON-NLS-1$ |
... | ... | |
317 | 311 |
// this is not an annotation |
318 | 312 |
} |
319 | 313 |
else { |
314 |
|
|
320 | 315 |
for (int i = 0; i < currentStartAnnotations.size(); i++) { |
321 | 316 |
Annotation a = currentStartAnnotations.get(i); |
322 |
// if (debug) |
|
323 |
// System.out.println("=============== Start annot : "+a); |
|
324 |
if (a.getType().equals(localname)) { // force delete, will be |
|
325 |
// written in the "w" |
|
326 |
// case |
|
317 |
if (debug) System.out.println("=============== Start annot : "+a); |
|
318 |
if (a.getType().equals(localname)) { // force delete, will be written in the "w" case |
|
327 | 319 |
|
328 |
if (a.getStart() == start && a.getEnd() == end) {
|
|
320 |
if (a.getStart() == start && a.getEnd() == end && a.getAnnotator().equals(s_author)) { // this is the right annotation to process
|
|
329 | 321 |
// updated = true; |
330 | 322 |
// if (debug) |
331 | 323 |
// System.out.println(" found existing annotation "+a); |
... | ... | |
334 | 326 |
// currentEndAnnotations.remove(a); // MAYBE NOT TO |
335 | 327 |
// DO THIS HERE ? |
336 | 328 |
if (debug) { |
337 |
Log.finer(" force delete start annotation " + a); //$NON-NLS-1$
|
|
329 |
System.out.println(" force delete start annotation " + a); //$NON-NLS-1$
|
|
338 | 330 |
} |
339 | 331 |
} |
340 |
else { // update existing annotation, no need to store |
|
341 |
// the end of annotation |
|
332 |
else { // update existing annotation, no need to store the end of annotation |
|
342 | 333 |
writeStartAnnotation(a); |
343 |
toDelete = true; |
|
334 |
toDelete = true; // set true to avoid re-writing the annotation XML start element
|
|
344 | 335 |
if (debug) { |
345 | 336 |
Log.finer(" update annotation " + a); //$NON-NLS-1$ |
346 | 337 |
} |
... | ... | |
361 | 352 |
|
362 | 353 |
currentStartAnnotations.remove(i); |
363 | 354 |
i--; |
355 |
|
|
356 |
break; // no need to continue |
|
364 | 357 |
} |
365 |
|
|
366 |
break; // no need to continue |
|
367 | 358 |
} |
368 | 359 |
else { |
369 |
// System.out.println("------- with same start pos");
|
|
370 |
|
|
371 |
if (s_start != null && s_end != null && s_author != null && s_ref != null) { |
|
372 |
if (a.getEnd() >= end) { // must write a |
|
373 |
if (!"#del".equals(a.getValue())) { //$NON-NLS-1$ |
|
374 |
if (debug) { |
|
375 |
Log.finer(NLS.bind(" writing of start annotation {0}.", a)); //$NON-NLS-1$
|
|
376 |
} |
|
377 |
writeStartAnnotation(a); |
|
378 |
|
|
379 |
} |
|
380 |
else { |
|
381 |
toDelete = true; |
|
382 |
if (debug) { |
|
383 |
Log.finer(NLS.bind(" no writing of start annotation {0}.", a)); //$NON-NLS-1$
|
|
384 |
} |
|
385 |
currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd()); |
|
386 |
// System.out.println(" shall we need to change annotation attribute : "+a.getValue()+ |
|
387 |
// " | currentEndAnnotations : "+currentEndAnnotations); |
|
388 |
if (currentEndAnnotations == null) { |
|
389 |
Log.warning(NLS.bind(Messages.ErrorNPEForEndPositionOfAnnotationP0, a)); |
|
390 |
} |
|
391 |
else { |
|
392 |
currentEndAnnotations.remove(a); |
|
393 |
} |
|
394 |
} |
|
395 |
currentStartAnnotations.remove(i); |
|
396 |
i--; |
|
397 |
// break; |
|
398 |
} |
|
399 |
} |
|
360 |
// if (debug) System.out.println("------- with same start pos");
|
|
361 |
// |
|
362 |
// if (s_start != null && s_end != null && s_author != null && s_ref != null) {
|
|
363 |
// if (a.getEnd() >= end) { // must write a
|
|
364 |
// if (!"#del".equals(a.getValue())) { //$NON-NLS-1$
|
|
365 |
// if (debug) {
|
|
366 |
// System.out.println(NLS.bind(" writing of start annotation {0}.", a)); //$NON-NLS-1$
|
|
367 |
// }
|
|
368 |
// writeStartAnnotation(a);
|
|
369 |
// |
|
370 |
// }
|
|
371 |
// else {
|
|
372 |
// toDelete = true;
|
|
373 |
// if (debug) {
|
|
374 |
// System.out.println(NLS.bind(" no writing of start annotation {0}.", a)); //$NON-NLS-1$
|
|
375 |
// }
|
|
376 |
// currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd());
|
|
377 |
// // System.out.println(" shall we need to change annotation attribute : "+a.getValue()+
|
|
378 |
// // " | currentEndAnnotations : "+currentEndAnnotations);
|
|
379 |
// if (currentEndAnnotations == null) {
|
|
380 |
// Log.warning(NLS.bind(Messages.ErrorNPEForEndPositionOfAnnotationP0, a));
|
|
381 |
// }
|
|
382 |
// else {
|
|
383 |
// currentEndAnnotations.remove(a);
|
|
384 |
// }
|
|
385 |
// }
|
|
386 |
// currentStartAnnotations.remove(i);
|
|
387 |
// i--;
|
|
388 |
// // break;
|
|
389 |
// }
|
|
390 |
// }
|
|
400 | 391 |
} |
401 | 392 |
} |
402 | 393 |
} |
394 |
|
|
403 | 395 |
if (!toDelete) { // the structure or annotation was not modified |
404 | 396 |
super.processStartElement(); |
405 | 397 |
} |
... | ... | |
523 | 515 |
break; // no need to continue |
524 | 516 |
} |
525 | 517 |
} |
518 |
|
|
526 | 519 |
if (!toDelete) { // the structure or annotation was not modified |
527 | 520 |
super.processEndElement(); |
528 | 521 |
} |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/utils/LanguageSwitchHandler.java (revision 3925) | ||
---|---|---|
123 | 123 |
*/ |
124 | 124 |
public static void changeLocaleTXMIni(String locale) { |
125 | 125 |
|
126 |
// Location configArea = Platform.getInstallLocation(); |
|
127 |
// //MessageBox.warning(Platform.getInstanceLocation().getURL().toString()); |
|
128 |
// // String product = Platform.getProduct().getName(); |
|
129 |
// if (configArea == null) { |
|
130 |
// return; |
|
131 |
// } |
|
132 |
|
|
133 | 126 |
URL location = null; |
134 | 127 |
try { |
135 | 128 |
String path = System.getProperty("osgi.instance.area"); //$NON-NLS-1$ |
TXM/trunk/bundles/org.txm.rcp/SUBVERSION (revision 3925) | ||
---|---|---|
1 |
beta |
Formats disponibles : Unified diff