Révision 1941

tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1941)
1133 1133
	public EditionDefinition getEditionDefinition(String name) {
1134 1134
		return new EditionDefinition(this, name);
1135 1135
	}
1136
	
1137
	public CorpusCommandPreferences getCommandPreferences(String name) {
1138
		return new CorpusCommandPreferences(this, name);
1139
	}
1136 1140

  
1137 1141
	public ProjectScope getPreferencesScope() {
1138 1142
		return this.preferenceScope;
tmp/org.txm.core/src/java/org/txm/objects/CorpusCommandPreferences.java (revision 1941)
1
package org.txm.objects;
2

  
3
import org.osgi.service.prefs.BackingStoreException;
4
import org.osgi.service.prefs.Preferences;
5
import org.txm.core.preferences.TBXPreferences;
6

  
7
/**
8
 * Wrapper for getting&setting corpus command default parameters
9
 * 
10
 * @author mdecorde
11
 *
12
 */
13
public class CorpusCommandPreferences {
14

  
15
	Preferences node;
16
	
17
	public CorpusCommandPreferences(Project project, String name) {
18
		this.node = project.getPreferencesScope().getNode(CorpusCommandPreferences.class.getSimpleName()).node(name);
19
		setName(name);
20
	}
21

  
22
	public String getName() {
23
		return node.get(TBXPreferences.NAME, null);
24
	}
25

  
26
	public void set(String key, String value) {
27
		node.put(key, value);
28
	}
29
	
30
	public String get(String key) {
31
		return node.get(key, null);
32
	}
33

  
34
	public void setName(String name) {
35
		node.put(TBXPreferences.NAME, name);
36
	}
37

  
38
	public String toString() {
39
		StringBuffer buffer = new StringBuffer();
40
		try {
41
			for (String k : node.keys()) {
42
				buffer.append(k+"="+node.get(k, "")+"\t");
43
			}
44
		} catch (BackingStoreException e) {
45
			// TODO Auto-generated catch block
46
			e.printStackTrace();
47
		}
48
		return buffer.toString();
49
	}
50
}
0 51

  
tmp/org.txm.core/src/java/org/txm/objects/BaseOldParameters.java (revision 1941)
188 188
	 */
189 189
	public Element addEdition(Element textElem, String name, String index, String type)
190 190
	{
191
		NodeList editionsList = textElem.getElementsByTagName("editions");
191
		NodeList editionsList = textElem.getElementsByTagName("editions");//$NON-NLS-1$
192 192
		Element editions = null;
193 193
		if (editionsList.getLength() == 0) {
194
			editions = textElem.getOwnerDocument().createElement("editions");
194
			editions = textElem.getOwnerDocument().createElement("editions");//$NON-NLS-1$
195 195
			textElem.appendChild(editions);
196 196
		} else {
197 197
			editions = (Element) editionsList.item(0);
198 198
		}
199 199

  
200
		Element editionElement = editions.getOwnerDocument().createElement("edition");
200
		Element editionElement = editions.getOwnerDocument().createElement("edition");//$NON-NLS-1$
201 201
		editionElement.setAttribute(NAME, name);
202
		editionElement.setAttribute("index", index);
203
		editionElement.setAttribute("type", type);
202
		editionElement.setAttribute("index", index);//$NON-NLS-1$
203
		editionElement.setAttribute("type", type);//$NON-NLS-1$
204 204
		editions.appendChild(editionElement);
205 205

  
206 206
		return editionElement;
......
216 216
	 */
217 217
	public Element addEditionDefinition(Element corpusElem, String name, String mode, String script) {
218 218
		Element editionsElement = getEditionsElement(corpusElem);
219
		Element editionElement = editionsElement.getOwnerDocument().createElement("edition");
219
		Element editionElement = editionsElement.getOwnerDocument().createElement("edition");//$NON-NLS-1$
220 220
		editionElement.setAttribute(NAME, name);
221
		editionElement.setAttribute("build_edition", ""+DEFAULT_DOEDITION);
222
		editionElement.setAttribute("page_break_tag", ""+DEFAULT_PAGEELEMENT);
223
		editionElement.setAttribute("words_per_page", ""+DEFAULT_WORDSPERPAGE);
224
		editionElement.setAttribute("mode", mode);
225
		editionElement.setAttribute("script", script);
226
		editionElement.setAttribute("type", "html");
227
		editionElement.setAttribute("index", ".");
221
		editionElement.setAttribute("build_edition", ""+DEFAULT_DOEDITION);//$NON-NLS-1$
222
		editionElement.setAttribute("page_break_tag", ""+DEFAULT_PAGEELEMENT);//$NON-NLS-1$
223
		editionElement.setAttribute("words_per_page", ""+DEFAULT_WORDSPERPAGE);//$NON-NLS-1$
224
		editionElement.setAttribute("mode", mode);//$NON-NLS-1$
225
		editionElement.setAttribute("script", script);//$NON-NLS-1$
226
		editionElement.setAttribute("type", "html");//$NON-NLS-1$
227
		editionElement.setAttribute("index", ".");//$NON-NLS-1$
228 228
		editionsElement.appendChild(editionElement);
229 229

  
230 230
		return editionElement;
......
232 232

  
233 233
	public Element addPage(Element edition, String idx, String wordid)
234 234
	{
235
		Element page = edition.getOwnerDocument().createElement("page");
236
		page.setAttribute("id", idx);
237
		page.setAttribute("wordid", wordid);
235
		Element page = edition.getOwnerDocument().createElement("page");//$NON-NLS-1$
236
		page.setAttribute("id", idx);//$NON-NLS-1$
237
		page.setAttribute("wordid", wordid);//$NON-NLS-1$
238 238
		edition.appendChild(page);
239 239
		return page;
240 240
	}
......
242 242
	public void addPartition(Element corpusElem, String name, String[] queries,
243 243
			String[] names) {
244 244
		Element preBuildElement = this.getPreBuildElement(corpusElem);
245
		Element partitionElem = preBuildElement.getOwnerDocument().createElement("partition");
245
		Element partitionElem = preBuildElement.getOwnerDocument().createElement("partition");//$NON-NLS-1$
246 246
		partitionElem.setAttribute(NAME, name);
247 247
		for (int i = 0 ; i < queries.length ; i++) {
248
			Element partElem = preBuildElement.getOwnerDocument().createElement("part");
248
			Element partElem = preBuildElement.getOwnerDocument().createElement("part");//$NON-NLS-1$
249 249
			partElem.setAttribute(NAME, names[i]);
250 250
			partElem.setAttribute(QUERY, queries[i]);
251 251
			partitionElem.appendChild(partElem);
......
255 255

  
256 256
	public Element addPAttribute(Element corpusElem, String name, String shortname, String longname, String type, String renderer, String tooltip, String pattern, String importB, String mandatory, String inputFormat, String outputFormat)
257 257
	{
258
		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");
258
		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");//$NON-NLS-1$
259 259
		if(pattributesList.getLength() == 0)
260 260
			return null;
261 261

  
262 262
		Element pattributes = (Element) pattributesList.item(0);
263
		Element pattribute = pattributes.getOwnerDocument().createElement("pattribute");
264
		pattribute.setAttribute("id", name);
265
		pattribute.setAttribute("shortname", shortname);
266
		pattribute.setAttribute("longname", longname);
267
		pattribute.setAttribute("type", type);
268
		pattribute.setAttribute("renderer", renderer);
269
		pattribute.setAttribute("tooltip", tooltip);
270
		pattribute.setAttribute("pattern", pattern);
271
		pattribute.setAttribute("import", importB);
272
		pattribute.setAttribute("mandatory", mandatory);
273
		pattribute.setAttribute("inputFormat", inputFormat);
274
		pattribute.setAttribute("outputFormat", outputFormat);
263
		Element pattribute = pattributes.getOwnerDocument().createElement("pattribute");//$NON-NLS-1$
264
		pattribute.setAttribute("id", name);//$NON-NLS-1$
265
		pattribute.setAttribute("shortname", shortname);//$NON-NLS-1$
266
		pattribute.setAttribute("longname", longname);//$NON-NLS-1$
267
		pattribute.setAttribute("type", type);//$NON-NLS-1$
268
		pattribute.setAttribute("renderer", renderer);//$NON-NLS-1$
269
		pattribute.setAttribute("tooltip", tooltip);//$NON-NLS-1$
270
		pattribute.setAttribute("pattern", pattern);//$NON-NLS-1$
271
		pattribute.setAttribute("import", importB);//$NON-NLS-1$
272
		pattribute.setAttribute("mandatory", mandatory);//$NON-NLS-1$
273
		pattribute.setAttribute("inputFormat", inputFormat);//$NON-NLS-1$
274
		pattribute.setAttribute("outputFormat", outputFormat);//$NON-NLS-1$
275 275
		pattributes.appendChild(pattribute);
276 276

  
277 277
		return pattribute;
......
279 279

  
280 280
	public Element addPreBuildCorpus(Element corpusElem, String name, String query, String exemple)
281 281
	{
282
		NodeList prebuildsList = corpusElem.getElementsByTagName("preBuild");
282
		NodeList prebuildsList = corpusElem.getElementsByTagName("preBuild");//$NON-NLS-1$
283 283
		if(prebuildsList.getLength() == 0)
284 284
			return null;
285 285

  
286 286
		Element preBuild = (Element) prebuildsList.item(0);
287
		Element subcorpus = preBuild.getOwnerDocument().createElement("subcorpus");
287
		Element subcorpus = preBuild.getOwnerDocument().createElement("subcorpus");//$NON-NLS-1$
288 288
		subcorpus.setAttribute(NAME, name);
289 289
		subcorpus.setAttribute(QUERY, query);
290 290

  
......
294 294

  
295 295
	public Element addQuery(Element corpusElem, String name, String query, String desc)
296 296
	{
297
		NodeList queriesList = corpusElem.getElementsByTagName("queries");
297
		NodeList queriesList = corpusElem.getElementsByTagName("queries");//$NON-NLS-1$
298 298
		if(queriesList.getLength() == 0)
299 299
			return null;
300 300

  
......
310 310

  
311 311
	public Element addSAttribute(Element corpusElem, String name, String shortname, String longname, String type, String renderer, String tooltip, String pattern, String importB, String mandatory, String inputFormat, String outputFormat)
312 312
	{
313
		NodeList sattributesList = corpusElem.getElementsByTagName("sattributes");
313
		NodeList sattributesList = corpusElem.getElementsByTagName("sattributes");//$NON-NLS-1$
314 314
		if(sattributesList.getLength() == 0)
315 315
			return null;
316 316

  
317 317
		Element sattributes = (Element) sattributesList.item(0);
318
		Element sattribute = sattributes.getOwnerDocument().createElement("sattribute");
319
		sattribute.setAttribute("id", name);
320
		sattribute.setAttribute("shortname", shortname);
321
		sattribute.setAttribute("longname", longname);
322
		sattribute.setAttribute("type", type);
323
		sattribute.setAttribute("renderer", renderer);
324
		sattribute.setAttribute("tooltip", tooltip);
325
		sattribute.setAttribute("pattern", pattern);
326
		sattribute.setAttribute("import", importB);
327
		sattribute.setAttribute("mandatory", mandatory);
328
		sattribute.setAttribute("inputFormat", inputFormat);
329
		sattribute.setAttribute("outputFormat", outputFormat);
318
		Element sattribute = sattributes.getOwnerDocument().createElement("sattribute");//$NON-NLS-1$
319
		sattribute.setAttribute("id", name);//$NON-NLS-1$
320
		sattribute.setAttribute("shortname", shortname);//$NON-NLS-1$
321
		sattribute.setAttribute("longname", longname);//$NON-NLS-1$
322
		sattribute.setAttribute("type", type);//$NON-NLS-1$
323
		sattribute.setAttribute("renderer", renderer);//$NON-NLS-1$
324
		sattribute.setAttribute("tooltip", tooltip);//$NON-NLS-1$
325
		sattribute.setAttribute("pattern", pattern);//$NON-NLS-1$
326
		sattribute.setAttribute("import", importB);//$NON-NLS-1$
327
		sattribute.setAttribute("mandatory", mandatory);//$NON-NLS-1$
328
		sattribute.setAttribute("inputFormat", inputFormat);//$NON-NLS-1$
329
		sattribute.setAttribute("outputFormat", outputFormat);//$NON-NLS-1$
330 330
		sattributes.appendChild(sattribute);
331 331

  
332 332
		return sattribute;
......
335 335
	public void addSubcorpus(Element corpusElem, String name, String query,
336 336
			String desc) {
337 337
		Element preBuildElement = this.getPreBuildElement(corpusElem);
338
		Element subcorpusElem = preBuildElement.getOwnerDocument().createElement("subcorpus");
338
		Element subcorpusElem = preBuildElement.getOwnerDocument().createElement("subcorpus");//$NON-NLS-1$
339 339
		subcorpusElem.setAttribute(NAME, name);
340 340
		subcorpusElem.setAttribute(QUERY, query);
341 341
		subcorpusElem.setAttribute(DESC, desc);
......
351 351
	 */
352 352
	public Element addText(Element corpusElem, String name, File sourceFile)
353 353
	{
354
		NodeList textsList = corpusElem.getElementsByTagName("texts");
354
		NodeList textsList = corpusElem.getElementsByTagName("texts");//$NON-NLS-1$
355 355
		Element texts = null;
356 356
		if (textsList.getLength() == 0) {
357
			texts = corpusElem.getOwnerDocument().createElement("texts");
357
			texts = corpusElem.getOwnerDocument().createElement("texts");//$NON-NLS-1$
358 358
			corpusElem.appendChild(texts);
359 359
		} else {
360 360
			texts = (Element) textsList.item(0);
361 361
		}
362 362

  
363
		Element text = texts.getOwnerDocument().createElement("text");
363
		Element text = texts.getOwnerDocument().createElement("text");//$NON-NLS-1$
364 364
		text.setAttribute(NAME, name);
365 365
		texts.appendChild(text);
366 366

  
367
		Element source = texts.getOwnerDocument().createElement("source");
368
		source.setAttribute("file", sourceFile.getAbsolutePath());
369
		source.setAttribute("type", ".xml");
367
		Element source = texts.getOwnerDocument().createElement("source");//$NON-NLS-1$
368
		source.setAttribute("file", sourceFile.getAbsolutePath());//$NON-NLS-1$
369
		source.setAttribute("type", ".xml");//$NON-NLS-1$
370 370
		text.appendChild(source);
371
		text.appendChild(texts.getOwnerDocument().createElement("editions"));
371
		text.appendChild(texts.getOwnerDocument().createElement("editions"));//$NON-NLS-1$
372 372

  
373 373
		return text;
374 374
	}
375 375

  
376 376

  
377 377
	public Element getTextsElement(Element corpusElement) {
378
		NodeList textsList = corpusElement.getElementsByTagName("texts");
378
		NodeList textsList = corpusElement.getElementsByTagName("texts");//$NON-NLS-1$
379 379
		if(textsList.getLength() == 0) {
380
			Element texts = corpusElement.getOwnerDocument().createElement("texts");
380
			Element texts = corpusElement.getOwnerDocument().createElement("texts");//$NON-NLS-1$
381 381
			corpusElement.appendChild(texts);
382 382
			return texts;
383 383
		} else {
......
399 399
	}
400 400

  
401 401
	public Element getTextElement(Element textsElement, String name) {
402
		NodeList textsList = textsElement.getElementsByTagName("text");
402
		NodeList textsList = textsElement.getElementsByTagName("text");//$NON-NLS-1$
403 403

  
404 404
		for (int i = 0 ; i < textsList.getLength() ;i++) {
405 405
			Element text = (Element) textsList.item(i);
406
			if (name.equals(text.getAttribute("name"))) return text;
406
			if (name.equals(text.getAttribute("name"))) return text;//$NON-NLS-1$
407 407
		}
408 408
		return null;
409 409

  
410 410
	}
411 411

  
412 412
	public Element getEditionElement(Element textElement, String name) {
413
		NodeList editionsList = textElement.getElementsByTagName("edition");
413
		NodeList editionsList = textElement.getElementsByTagName("edition");//$NON-NLS-1$
414 414

  
415 415
		for (int i = 0 ; i < editionsList.getLength() ;i++) {
416 416
			Element editionElement = (Element) editionsList.item(i);
417
			if (name.equals(editionElement.getAttribute("name"))) {
417
			if (name.equals(editionElement.getAttribute("name"))) {//$NON-NLS-1$
418 418
				return editionElement;
419 419
			}
420 420
		}
......
443 443
	public void addTokenizerTest(Element corpusElem, String regex,
444 444
			String type, String before, String hit, String after) {
445 445
		Element tokenizer = getTokenizerElement(corpusElem);
446
		Element test = tokenizer.getOwnerDocument().createElement("test");
446
		Element test = tokenizer.getOwnerDocument().createElement("test");//$NON-NLS-1$
447 447
		test.setAttribute(TYPE, type);
448 448
		test.setAttribute(VALUE, regex);
449
		test.setAttribute("before", before);
450
		test.setAttribute("hit", hit);
451
		test.setAttribute("after", after);
449
		test.setAttribute("before", before);//$NON-NLS-1$
450
		test.setAttribute("hit", hit);//$NON-NLS-1$
451
		test.setAttribute("after", after);//$NON-NLS-1$
452 452
		tokenizer.appendChild(test);
453 453
	}
454 454

  
......
467 467
	}
468 468

  
469 469
	public Element getBibliosElement(Element corpusElem) {
470
		return getElement(corpusElem, "biblios");
470
		return getElement(corpusElem, "biblios");//$NON-NLS-1$
471 471
	}
472 472

  
473 473
	public boolean getCleanTEMPDirectories(Element corpusElem) {
......
497 497
	}
498 498

  
499 499
	public Element getCQLLimitElement(Element uiElement) {
500
		NodeList uiList = uiElement.getElementsByTagName("context_limits");
500
		NodeList uiList = uiElement.getElementsByTagName("context_limits");//$NON-NLS-1$
501 501
		if (uiList.getLength() > 0) {
502 502
			return (Element)(uiList.item(0));
503 503
		} else {
504
			Element context_limitsElement = uiElement.getOwnerDocument().createElement("context_limits");
505
			context_limitsElement.setAttribute("type", "list");
504
			Element context_limitsElement = uiElement.getOwnerDocument().createElement("context_limits");//$NON-NLS-1$
505
			context_limitsElement.setAttribute("type", "list");//$NON-NLS-1$ $NON-NLS-2$
506 506
			context_limitsElement.setTextContent(DEFAULT_CQPLIMITS);
507 507
			uiElement.appendChild(context_limitsElement);
508 508
			return context_limitsElement;
......
511 511

  
512 512
	public Element getWordElement() {
513 513
		Element textualPlanEelement = getTextualPlans();
514
		NodeList uiList = textualPlanEelement.getElementsByTagName("word");
514
		NodeList uiList = textualPlanEelement.getElementsByTagName("word");//$NON-NLS-1$
515 515
		if (uiList.getLength() > 0) {
516 516
			return (Element)(uiList.item(0));
517 517
		} else {
518
			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("word");
519
			wordElement.setTextContent("w");
518
			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("word");//$NON-NLS-1$
519
			wordElement.setTextContent("w");//$NON-NLS-1$
520 520
			textualPlanEelement.appendChild(wordElement);
521 521
			return wordElement;
522 522
		}
523 523
	}
524 524

  
525

  
526 525
	public Element getMilestonesElement() {
527 526
		Element textualPlanEelement = getTextualPlans();
528
		NodeList uiList = textualPlanEelement.getElementsByTagName("milestones");
527
		NodeList uiList = textualPlanEelement.getElementsByTagName("milestones");//$NON-NLS-1$
529 528
		if (uiList.getLength() > 0) {
530 529
			return (Element)(uiList.item(0));
531 530
		} else {
532
			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("milestones");
531
			Element wordElement = textualPlanEelement.getOwnerDocument().createElement("milestones");//$NON-NLS-1$
533 532
			wordElement.setTextContent("");
534 533
			textualPlanEelement.appendChild(wordElement);
535 534
			return wordElement;
......
547 546

  
548 547
	public Element getOutSideTextTagsElement() {
549 548
		Element textualPlanEelement = getTextualPlans();
550
		NodeList uiList = textualPlanEelement.getElementsByTagName("outsidetexttags");
549
		NodeList uiList = textualPlanEelement.getElementsByTagName("outsidetexttags");//$NON-NLS-1$
551 550
		if (uiList.getLength() > 0) {
552 551
			return (Element)(uiList.item(0));
553 552
		} else {
554
			Element context_limitsElement = textualPlanEelement.getOwnerDocument().createElement("outsidetexttags");
555
			context_limitsElement.setAttribute("type", "list");
556
			context_limitsElement.setTextContent("");
553
			Element context_limitsElement = textualPlanEelement.getOwnerDocument().createElement("outsidetexttags");//$NON-NLS-1$
554
			context_limitsElement.setAttribute("type", "list");//$NON-NLS-1$ $NON-NLS-2$
555
			context_limitsElement.setTextContent("");//$NON-NLS-1$
557 556
			textualPlanEelement.appendChild(context_limitsElement);
558 557
			return context_limitsElement;
559 558
		}
......
561 560
	
562 561
	public Element getOutSideTextTagsAndKeepContentElement() {
563 562
		Element textualPlanEelement = getTextualPlans();
564
		NodeList uiList = textualPlanEelement.getElementsByTagName("outside_text_tags_and_keep_content");
563
		NodeList uiList = textualPlanEelement.getElementsByTagName("outside_text_tags_and_keep_content");//$NON-NLS-1$
565 564
		if (uiList.getLength() > 0) {
566 565
			return (Element)(uiList.item(0));
567 566
		} else {
568
			Element element = textualPlanEelement.getOwnerDocument().createElement("outside_text_tags_and_keep_content");
569
			element.setAttribute("type", "list");
570
			element.setTextContent("");
567
			Element element = textualPlanEelement.getOwnerDocument().createElement("outside_text_tags_and_keep_content");//$NON-NLS-1$
568
			element.setAttribute("type", "list");//$NON-NLS-1$ $NON-NLS-2$
569
			element.setTextContent("");//$NON-NLS-1$
571 570
			textualPlanEelement.appendChild(element);
572 571
			return element;
573 572
		}
......
575 574
	
576 575
	public Element getNoteElement() {
577 576
		Element textualPlanElement = getTextualPlans();
578
		NodeList noteList = textualPlanElement.getElementsByTagName("note");
577
		NodeList noteList = textualPlanElement.getElementsByTagName("note");//$NON-NLS-1$
579 578
		if (noteList.getLength() > 0) {
580 579
			return (Element)(noteList.item(0));
581 580
		} else {
582
			Element element = textualPlanElement.getOwnerDocument().createElement("note");
583
			element.setAttribute("type", "list");
584
			element.setTextContent("");
581
			Element element = textualPlanElement.getOwnerDocument().createElement("note");//$NON-NLS-1$
582
			element.setAttribute("type", "list");//$NON-NLS-1$
583
			element.setTextContent("");//$NON-NLS-1$
585 584
			textualPlanElement.appendChild(element);
586 585
			return element;
587 586
		}
......
595 594
		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
596 595
		if (editionElement == null) return DEFAULT_DOEDITION;
597 596

  
598
		String value = editionElement.getAttribute("build_edition");
597
		String value = editionElement.getAttribute("build_edition");//$NON-NLS-1$
599 598
		if (value == null | value.length() == 0) return DEFAULT_DOEDITION;
600 599

  
601 600
		return TRUE.equals(value);
......
608 607
	 * @return the edition Element corresponding to the asked edition name
609 608
	 */
610 609
	public Element getEditionDefinitionElement(Element editionsElem, String name) {
611
		NodeList editionList = editionsElem.getElementsByTagName("edition");
610
		NodeList editionList = editionsElem.getElementsByTagName("edition");//$NON-NLS-1$
612 611
		for (int i = 0 ; i < editionList.getLength() ; i++) {
613 612
			Element elem = (Element)editionList.item(i);
614
			if (name.equals(elem.getAttribute("name")))
613
			if (name.equals(elem.getAttribute("name")))//$NON-NLS-1$
615 614
				return elem;
616 615
		}
617 616
		//
......
634 633
	 * @return the element that list the declared editions in a corpus
635 634
	 */
636 635
	public Element getEditionsElement(Element corpusElem) {
637
		Element elem = getElement(corpusElem, "editions");
636
		Element elem = getElement(corpusElem, "editions");//$NON-NLS-1$
638 637
		if (elem == null) {
639
			elem = corpusElem.getOwnerDocument().createElement("editions");
638
			elem = corpusElem.getOwnerDocument().createElement("editions");//$NON-NLS-1$
640 639
		}
641 640
		if (!elem.hasAttribute(DEFAULT))
642 641
			elem.setAttribute(DEFAULT, DEFAULT);
......
663 662
	public ArrayList<String> getExcludeXpaths() {
664 663
		Element filter = getFilterElement();
665 664
		ArrayList<String> xpaths = new ArrayList<String>();
666
		NodeList excludeList = filter.getElementsByTagName("exclude");
665
		NodeList excludeList = filter.getElementsByTagName("exclude");//$NON-NLS-1$
667 666
		for (int i = 0 ; i < excludeList.getLength() ; i++) {
668 667
			Element exclude = (Element) excludeList.item(i);
669
			if ("xpath".equals(exclude.getAttribute("type")))
668
			if ("xpath".equals(exclude.getAttribute("type")))//$NON-NLS-1$ $NON-NLS-2$
670 669
				xpaths.add(exclude.getTextContent().trim());
671 670
		}
672 671
		return xpaths;
......
674 673

  
675 674
	public Element getFilterElement() {
676 675
		Element corpusElem = corpora.get(getCorpusName());
677
		return getElement(corpusElem, "xmlfilter");
676
		return getElement(corpusElem, "xmlfilter");//$NON-NLS-1$
678 677
	}
679 678

  
680 679
	public String getLang(Element corpusElem) {
681 680
		String str = corpusElem.getAttribute(LANG);
682
		if (str == null) str = System.getProperty("user.locale");
681
		if (str == null) str = System.getProperty("user.locale");//$NON-NLS-1$
683 682
		return str;
684 683
	}
685 684

  
......
691 690
		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
692 691
		if (editionElement == null) return DEFAULT_PAGEELEMENT;
693 692

  
694
		String value = editionElement.getAttribute("page_break_tag");
693
		String value = editionElement.getAttribute("page_break_tag");//$NON-NLS-1$
695 694
		if (value == null || value.length() == 0) return DEFAULT_PAGEELEMENT;
696 695

  
697 696
		return value;
698 697
	}
699 698

  
700 699
	public NodeList getPAttributes(Element corpusElem) {
701
		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");
700
		NodeList pattributesList = corpusElem.getElementsByTagName("pattributes");//$NON-NLS-1$
702 701
		if(pattributesList.getLength() == 0)
703 702
			return null;
704
		return ((Element)pattributesList.item(0)).getElementsByTagName("pattribute");
703
		return ((Element)pattributesList.item(0)).getElementsByTagName("pattribute");//$NON-NLS-1$
705 704
	}
706 705

  
707 706
	public Element getPAttributesElement(Element corpusElem) {
708
		return getElement(corpusElem, "pattributes");
707
		return getElement(corpusElem, "pattributes");//$NON-NLS-1$
709 708
	}
710 709

  
711 710
	public Element getPreBuildElement() {
712 711
		Element corpusElem = corpora.get(getCorpusName());
713
		return getElement(corpusElem, "preBuild");
712
		return getElement(corpusElem, "preBuild");//$NON-NLS-1$
714 713
	}
715 714

  
716 715
	public Element getPreBuildElement(Element corpusElem) {
717
		return getElement(corpusElem, "preBuild");
716
		return getElement(corpusElem, "preBuild");//$NON-NLS-1$
718 717
	}
719 718

  
720 719
	public Element getQueriesElement(Element corpusElem) {
721
		return getElement(corpusElem, "queries");
720
		return getElement(corpusElem, "queries");//$NON-NLS-1$
722 721
	}
723 722

  
724 723
	public Element getSAttributesElement(Element corpusElem) {
725
		return getElement(corpusElem, "sattributes");
724
		return getElement(corpusElem, "sattributes");//$NON-NLS-1$
726 725
	}
727 726

  
728 727
	public Element getTokenizerElement(Element corpusElem) {
729
		return getElement(corpusElem, "tokenizer");
728
		return getElement(corpusElem, "tokenizer");//$NON-NLS-1$
730 729
	}
731 730

  
732 731
	public Element getUIElement(Element corpusElem, String command) {
733 732
		Element uisElement = getUIsElement(corpusElem);
734 733
		Element uiElement = null;
735
		NodeList uiList = uisElement.getElementsByTagName("ui");
734
		NodeList uiList = uisElement.getElementsByTagName("ui");//$NON-NLS-1$
736 735
		if (uiList.getLength() > 0) {
737 736
			for (int i = 0 ; i < uiList.getLength() ; i++ ) {
738 737
				Element ui = (Element)(uiList.item(i));
739
				if (command.equals(ui.getAttribute("command"))) {
738
				if (command.equals(ui.getAttribute("command"))) {//$NON-NLS-1$
740 739
					return ui;
741 740
				}
742 741
			}
743 742
		} 
744 743
		if (uiElement == null){
745
			uiElement = uisElement.getOwnerDocument().createElement("ui");
746
			uiElement.setAttribute("command", command);
744
			uiElement = uisElement.getOwnerDocument().createElement("ui");//$NON-NLS-1$
745
			uiElement.setAttribute("command", command);//$NON-NLS-1$
747 746
			uisElement.appendChild(uiElement);
748 747
		}
749 748
		return uiElement;
......
761 760
		Element editionElement = getEditionDefinitionElement(editionsElement, edition);
762 761
		if (editionElement == null) return DEFAULT_WORDSPERPAGE;
763 762

  
764
		String value = editionElement.getAttribute("words_per_page");
763
		String value = editionElement.getAttribute("words_per_page");//$NON-NLS-1$
765 764
		if (value == null) return DEFAULT_WORDSPERPAGE;
766 765

  
767 766
		try {
768 767
			return Integer.parseInt(value);
769 768
		} catch (NumberFormatException e) {
770
			Log.fine("words_per_page value is not an Integer value: "+value);
769
			Log.fine("words_per_page value is not an Integer value: "+value);//$NON-NLS-1$
771 770
			return DEFAULT_WORDSPERPAGE;
772 771
		}
773 772
	}
774 773

  
775 774
	public Element getXsltElement(Element corpusElem) {
776
		Element elem = getElement(corpusElem, "xslt");
777
		if (!elem.hasAttribute("xsl"))
778
			elem.setAttribute("xsl", "");
775
		Element elem = getElement(corpusElem, "xslt");//$NON-NLS-1$
776
		if (!elem.hasAttribute("xsl"))//$NON-NLS-1$
777
			elem.setAttribute("xsl", "");//$NON-NLS-1$
779 778
		return elem;
780 779
	}
781 780

  
782 781
	public HashMap<String, String> getXsltParams(Element corpusElem) {
783
		Element elem = getElement(corpusElem, "xslt");
784
		if (!elem.hasAttribute("xsl"))
785
			elem.setAttribute("xsl", "");
782
		Element elem = getElement(corpusElem, "xslt");//$NON-NLS-1$
783
		if (!elem.hasAttribute("xsl"))//$NON-NLS-1$
784
			elem.setAttribute("xsl", "");//$NON-NLS-1$
786 785
		HashMap<String, String> hash = new HashMap<String, String>();
787
		NodeList params = elem.getElementsByTagName("param");
786
		NodeList params = elem.getElementsByTagName("param");//$NON-NLS-1$
788 787
		for(int i = 0 ; i < params.getLength() ; i++) {
789 788
			Element paramElem = (Element) params.item(i);
790
			String name = paramElem.getAttribute("name");
791
			String value = paramElem.getAttribute("value");
789
			String name = paramElem.getAttribute("name");//$NON-NLS-1$
790
			String value = paramElem.getAttribute("value");//$NON-NLS-1$
792 791
			if (name != null && value != null && name.length() > 0) {
793 792
				hash.put(name, value);
794 793
			}
......
798 797

  
799 798
	public void loadKeyValueParameters(Element parametersElem) {
800 799
		//HashMap<String, String> hash = new HashMap<String, String>();
801
		NodeList params = parametersElem.getElementsByTagName("param");
800
		NodeList params = parametersElem.getElementsByTagName("param");//$NON-NLS-1$
802 801
		for (int i = 0 ; i < params.getLength() ; i++) {
803 802
			Element paramElem = (Element) params.item(i);
804 803
			String name = paramElem.getAttribute(PARAMETERKEY);
......
812 811
	public void saveKeyValueParameters(Element parametersElem) {
813 812
		//HashMap<String, String> hash = new HashMap<String, String>();
814 813
		
815
		NodeList params = parametersElem.getElementsByTagName("param");
814
		NodeList params = parametersElem.getElementsByTagName("param");//$NON-NLS-1$
816 815
		HashSet<String> existingNames = new HashSet<String>();
817 816
		for (int i = 0 ; i < params.getLength() ; i++) {
818 817
			Element paramElem = (Element) params.item(i);
......
828 827
		
829 828
		for (String name : keyValueParameters.keySet()) {
830 829
			if (!existingNames.contains(name)) { // create the element
831
				Element paramElem = parametersElem.getOwnerDocument().createElement("param");
830
				Element paramElem = parametersElem.getOwnerDocument().createElement("param");//$NON-NLS-1$
832 831
				paramElem.setAttribute(PARAMETERKEY, name);
833 832
				paramElem.setAttribute(PARAMETERVALUE, keyValueParameters.get(name).toString());
834 833
				parametersElem.appendChild(paramElem);
......
851 850
		if (root == null) return false;
852 851
		// import general infos
853 852
		try {
854
			if (root.getAttribute(DATE).matches("....-..-..")) {
853
			if (root.getAttribute(DATE).matches("....-..-..")) {//$NON-NLS-1$
855 854
				this.date = dateformat.parse(root.getAttribute(DATE));
856 855
			} else { // try with DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK)
857 856
				this.date = shortUKDateformat.parse(root.getAttribute(DATE));
......
859 858
			}
860 859
		} catch (ParseException e) {
861 860
			this.date = new Date(0);
862
			System.out.println("Warning: can't parse date '"+root.getAttribute(DATE)+"' in file "+paramFile+": "+e);
861
			System.out.println("Warning: can't parse date '"+root.getAttribute(DATE)+"' in file "+paramFile+": "+e);//$NON-NLS-1$
863 862
		}
864
		this.version = root.getAttribute("version");
863
		this.version = root.getAttribute("version");//$NON-NLS-1$
865 864
		this.name = root.getAttribute(NAME).toUpperCase();
866 865
		root.setAttribute(NAME, name);// force UPPERCASED NAME
867
		this.author = root.getAttribute("author");
866
		this.author = root.getAttribute("author");//$NON-NLS-1$
868 867
		this.description = root.getAttribute(DESC);
869
		this.rootDir = root.getAttribute("rootDir");
870
		this.scriptFile = root.getAttribute("script");
868
		this.rootDir = root.getAttribute("rootDir");//$NON-NLS-1$
869
		this.scriptFile = root.getAttribute("script");//$NON-NLS-1$
871 870

  
872 871
		// get Alignements
873 872
		NodeList alignNodes = root.getElementsByTagName("linkGrp");
......
877 876
			for (int i = 0 ; i < linkNodes.getLength() ; i++) {
878 877
				Element link = (Element)linkNodes.item(i);
879 878
				String target = link.getAttribute(TARGET);
880
				String[] split = target.split("#");
879
				String[] split = target.split("#");//$NON-NLS-1$
881 880
				if (split.length != 3) {
882
					System.out.println("Error: linkGrp/link/@target malformed: "+target);
881
					System.out.println("Error: linkGrp/link/@target malformed: "+target);//$NON-NLS-1$
883 882
					continue;
884 883
				}
885 884
				String from = split[1].trim();
886 885
				String to = split[2].trim();
887 886

  
888
				links.put("#"+to+" #"+from, link);
887
				links.put("#"+to+" #"+from, link);//$NON-NLS-1$
889 888
			}
890 889
		}
891 890

  
892 891
		// corpora
893
		NodeList corporaNodes = root.getElementsByTagName("corpora");
892
		NodeList corporaNodes = root.getElementsByTagName("corpora");//$NON-NLS-1$
894 893
		if (corporaNodes.getLength() > 0) {
895 894
			corporaElement = (Element) corporaNodes.item(0);
896 895
			NodeList corpusNodes = corporaElement.getElementsByTagName(CORPUS);
......
919 918
			this.saveKeyValueParameters(getParametersElement(getCorpusElement())); // save additional parameters
920 919
			return DomUtils.save(root.getOwnerDocument(), paramFile);
921 920
		} catch (Exception e) {
922
			System.out.println("Fail to save parameters in "+paramFile+". Reason: "+e);
921
			System.out.println("Fail to save parameters in "+paramFile+". Reason: "+e);//$NON-NLS-1$
923 922
			org.txm.utils.logger.Log.printStackTrace(e);
924 923
		}
925 924
		return false;
......
928 927
	public void saveToElement() {
929 928
		root.setAttribute(NAME, name);
930 929
		root.setAttribute(DESC, description);
931
		root.setAttribute("script", scriptFile);
932
		root.setAttribute("rootDir", rootDir);
930
		root.setAttribute("script", scriptFile);//$NON-NLS-1$
931
		root.setAttribute("rootDir", rootDir);//$NON-NLS-1$
933 932
	}
934 933

  
935 934
	/* (non-Javadoc)
......
944 943
	}
945 944

  
946 945
	public String getCQPLimits() {
947
		Element concordanceElement = this.getUIElement(getCorpusElement(), "concordance");
946
		Element concordanceElement = this.getUIElement(getCorpusElement(), "concordance");//$NON-NLS-1$
948 947
		if (concordanceElement != null) {
949 948
			Element context_limitsElement = this.getCQLLimitElement(concordanceElement);
950 949
			if (context_limitsElement != null) {
......
956 955
		return DEFAULT_CQPLIMITS;
957 956
	}
958 957
	public Element getTextualPlans() {
959
		Element uiElement = this.getUIElement(this.getCorpusElement(), "textualplans");
958
		Element uiElement = this.getUIElement(this.getCorpusElement(), "textualplans");//$NON-NLS-1$
960 959
		if (uiElement == null) {
961 960
			Element uisElement = getUIsElement(this.getCorpusElement());
962
			uiElement = uisElement.getOwnerDocument().createElement("ui");
963
			uiElement.setAttribute("command", "textualplans");
961
			uiElement = uisElement.getOwnerDocument().createElement("ui");//$NON-NLS-1$
962
			uiElement.setAttribute("command", "textualplans");//$NON-NLS-1$
964 963
			uisElement.appendChild(uiElement);
965 964
		}
966 965
		return uiElement;
......
972 971
	 */
973 972
	public String getFacsEditionImageDirectory() {
974 973
		Element corpusElement = getCorpusElement();
975
		if (corpusElement == null) return "";
974
		if (corpusElement == null) return "";//$NON-NLS-1$
976 975
		Element editionsElement = getEditionsElement(corpusElement);
977 976
		if (editionsElement == null) return "";
978 977
		Element editionElement = getEditionDefinitionElement(editionsElement, "facs"); //$NON-NLS-1$
979 978
		if (editionElement == null) return "";
980 979

  
981
		String value = editionElement.getAttribute("images_directory");
980
		String value = editionElement.getAttribute("images_directory");//$NON-NLS-1$
982 981
		if (value == null || value.length() == 0) return "";
983 982

  
984 983
		return value;
......
992 991
		Element editionElement = getEditionDefinitionElement(editionsElement, "facs"); //$NON-NLS-1$
993 992
		if (editionElement == null) return false;
994 993

  
995
		String value = editionElement.getAttribute("build_edition");
994
		String value = editionElement.getAttribute("build_edition"); //$NON-NLS-1$
996 995
		if (value == null | value.length() == 0) return DEFAULT_DOEDITION;
997 996

  
998 997
		return TRUE.equals(value);
999 998
	}
1000 999
	
1001 1000
	public boolean getSkipTokenization() {
1002
		return "true".equals(getTokenizerElement(getCorpusElement()).getAttribute("skip"));
1001
		return "true".equals(getTokenizerElement(getCorpusElement()).getAttribute("skip")); // $NON-NLS-1$ $NON-NLS-2$
1003 1002
	}
1004 1003
	
1005 1004
	public void setSkipTokenization(boolean skip) {
1006
		getTokenizerElement(getCorpusElement()).setAttribute("skip", Boolean.toString(skip));
1005
		getTokenizerElement(getCorpusElement()).setAttribute("skip", Boolean.toString(skip));//$NON-NLS-1$
1007 1006
	}
1008 1007
	
1009 1008
	public void setDoAnnotation(boolean annotate) {
......
1032 1031
			Element milestonesElement = getMilestonesElement();
1033 1032
			milestonesElement.setTextContent(milestoneElements.trim());
1034 1033
		} else {
1035
			System.out.println("Error: Textual plan parameters not saved.");
1034
			System.out.println("Error: Textual plan parameters not saved."); //$NON-NLS-1$
1036 1035
		}
1037 1036
	}
1038 1037
	
......
1057 1056
			} 
1058 1057
		}
1059 1058
	}
1059

  
1060
	public void initializeProject(Project project) {
1061
		EditionDefinition defaultEditionDef = project.getEditionDefinition("default"); //$NON-NLS-1$
1062
		defaultEditionDef.setBuildEdition(this.getDoEdition("default")); //$NON-NLS-1$
1063
		defaultEditionDef.setWordsPerPage(this.getWordsPerPage("default")); //$NON-NLS-1$
1064
		defaultEditionDef.setPageBreakTag(this.getPageElement("default")); //$NON-NLS-1$
1065
		
1066
		project.setTextualPlan("MileStones", this.getMilestonesElement().getTextContent()); //$NON-NLS-1$
1067
		project.setTextualPlan("OutSideTextTags", this.getOutSideTextTagsElement().getTextContent()); //$NON-NLS-1$
1068
		project.setTextualPlan("OutSideTextTagsAndKeepContent", this.getOutSideTextTagsAndKeepContentElement().getTextContent()); //$NON-NLS-1$
1069
		project.setTextualPlan("Note", this.getNoteElement().getTextContent()); //$NON-NLS-1$
1070
		
1071
		EditionDefinition facsEditionDef = project.getEditionDefinition("facs"); //$NON-NLS-1$
1072
		facsEditionDef.setBuildEdition(this.getDoEdition("facs")); //$NON-NLS-1$
1073
		facsEditionDef.setWordsPerPage(this.getWordsPerPage("facs")); //$NON-NLS-1$
1074
		facsEditionDef.setPageBreakTag(this.getPageElement("facs")); //$NON-NLS-1$
1075
		facsEditionDef.setImagesDirectory(this.getFacsEditionImageDirectory()); //$NON-NLS-1$
1076
		
1077
		if (this.getCorpusElement().getAttribute("font") != null) { //$NON-NLS-1$
1078
			project.setFont(this.getCorpusElement().getAttribute("font")); //$NON-NLS-1$
1079
		}
1080
		if (this.getCorpusElement().getAttribute("lang") != null) { //$NON-NLS-1$
1081
			project.setLang(this.getCorpusElement().getAttribute("lang")); //$NON-NLS-1$
1082
		}
1083
		if (this.getCorpusElement().getAttribute("encoding") != null) { //$NON-NLS-1$
1084
			project.setEncoding(this.getCorpusElement().getAttribute("encoding")); //$NON-NLS-1$
1085
		}
1086
		
1087
		if (this.getCQPLimits() != null) {
1088
			project.getCommandPreferences("concordance").set("context_limits_type", "list"); //$NON-NLS-1$ $NON-NLS-2$
1089
			project.getCommandPreferences("concordance").set("context_limits", this.getCQPLimits()); //$NON-NLS-1$ $NON-NLS-2$
1090
		}
1091
		
1092
		NodeList nodes = this.getTokenizerElement(this.getCorpusElement()).getElementsByTagName("param"); //$NON-NLS-1$
1093
		for (int i = 0 ; i < nodes.getLength() ; i++) {
1094
			Element paramElement = (Element) nodes.item(i);
1095
			project.addTokenizerParameter(paramElement.getAttribute("name"), paramElement.getTextContent()); //$NON-NLS-1$
1096
		}
1097
		project.addTokenizerParameter("word_tags", this.getWordElement().getTextContent()); //$NON-NLS-1$
1098
		project.addTokenizerParameter("onlyThoseTests", "false"); //$NON-NLS-1$ $NON-NLS-2$
1099
		project.addTokenizerParameter("doTokenizeStep", Boolean.toString(!this.getSkipTokenization())); //$NON-NLS-1$
1100
		
1101
		project.setXslt(this.getXsltElement(this.getCorpusElement()).getAttribute("xsl")); //$NON-NLS-1$
1102
		project.setAnnotate("true".equals(this.getCorpusElement().getAttribute("annotate"))); //$NON-NLS-1$ $NON-NLS-2$
1103
		project.setCleanAfterBuild(this.getCleanTEMPDirectories(this.getCorpusElement()));
1104
	}
1060 1105
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java (revision 1941)
5 5
import java.util.Date;
6 6
import java.util.Locale;
7 7

  
8
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
8 9
import org.eclipse.jface.viewers.IStructuredSelection;
9 10
import org.eclipse.jface.wizard.Wizard;
10 11
import org.eclipse.osgi.util.NLS;
......
15 16
import org.txm.core.engines.EngineType;
16 17
import org.txm.core.preferences.TBXPreferences;
17 18
import org.txm.core.results.TXMResult;
19
import org.txm.objects.BaseOldParameters;
18 20
import org.txm.objects.EditionDefinition;
19 21
import org.txm.objects.Project;
20 22
import org.txm.rcp.messages.TXMUIMessages;
21 23
import org.txm.utils.logger.Log;
24
import org.w3c.dom.Element;
25
import org.w3c.dom.NodeList;
22 26

  
23 27
public class ImportWizard extends Wizard implements INewWizard {
24 28

  
......
61 65
						project = p;
62 66
					}
63 67
				}
64
				
65
				if (project == null) { // it's a new project configuration
68
				boolean newProject = project == null;
69
				if (newProject) { // it's a new project configuration
66 70
					project = Toolbox.workspace.getProject(name);
67 71
					if (project == null) {
68 72
						project = new Project(Toolbox.workspace, name);
......
84 88
						Log.info("The 'annotate' import parameter was not activated since TreeTagger is not installed.");
85 89
					}
86 90
					
91
					File importxml = new File(page1.getSourcePath(), "import.xml");
92
					if (importxml.exists()) {
93
						System.out.println("An import.xml import configuration file was found. Restoring import parameters using this file.");
94
						BaseOldParameters params = new BaseOldParameters(importxml);
95
						params.load();
96
						params.initializeProject(project);
97
					}
87 98
				} else {
88 99
					Date date = project.getLastComputingDate();
89 100
					if (date == null) {
......
92 103
					Log.info(NLS.bind(TXMUIMessages.theP1P0CorpusWillBeReplaced, project, date));
93 104
				}
94 105
				
95
				//project.compute(); // create/update files
96
				
97 106
				if (!project.hasEditionDefinition("default")) {
98 107
					EditionDefinition def = project.getEditionDefinition("default");
99 108
					def.setBuildEdition(true);
......
101 110
					def.setPageBreakTag("pb");
102 111
				}
103 112
				
104
				File importxml = new File(page1.getSourcePath(), "import.xml");
105
				if (importxml.exists()) {
106
					//System.out.println("Warning: old TXM source directory containing an import.xml file found. Settings import parameters using this file.");
107
					//BaseOldParameters params = new BaseOldParameters(importxml);
108
					//project._load(params);
109
				}
110
				
111 113
				project.setDoUpdate(false);
112 114
				project.saveParameters();
113 115
				return true;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/TokenizerSection.java (revision 1941)
298 298
		if (project == null) return;
299 299

  
300 300

  
301
		textWhiteSpaces.setText(project.getTokenizerParameter("whitepaces", TokenizerClasses.whitespaces));
301
		textWhiteSpaces.setText(project.getTokenizerParameter("whitespaces", TokenizerClasses.whitespaces));
302 302
		textPuncts.setText(project.getTokenizerParameter("regPunct", TokenizerClasses.regPunct));
303 303
		textPunctsStrong.setText(project.getTokenizerParameter("punct_strong", TokenizerClasses.punct_strong));
304 304
		textElisions.setText(project.getTokenizerParameter("regElision", TokenizerClasses.regElision));
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/UISection.java (revision 1941)
10 10
import org.eclipse.ui.forms.widgets.ScrolledForm;
11 11
import org.eclipse.ui.forms.widgets.TableWrapData;
12 12
import org.eclipse.ui.forms.widgets.TableWrapLayout;
13
import org.txm.objects.CorpusCommandPreferences;
13 14
import org.txm.objects.Project;
14 15
import org.txm.rcp.messages.TXMUIMessages;
15 16
import org.w3c.dom.Element;
......
51 52

  
52 53
	@Override
53 54
	public void update(Project project) {
54
//		//Element concordanceElement = params.getUIElement(params.getCorpusElement(), "concordance"); //$NON-NLS-1$
55
//		if (concordanceElement != null) {
56
//			Element context_limitsElement = params.getCQLLimitElement(concordanceElement);
57
//			if (context_limitsElement != null)
58
//				structLimitsText.setText(project.getCorpusBuild().getCQLLimitQuery()context_limitsElement.getTextContent());
59
//		}
55
		CorpusCommandPreferences concPrefs = project.getCommandPreferences("concordance");
56
		if (concPrefs.get("context_limits") != null) {
57
			structLimitsText.setText(concPrefs.get("context_limits"));
58
		}
60 59
	}
61 60

  
62 61
	@Override
63 62
	public boolean save(Project project) {
64
//		if (this.section != null && !section.isDisposed()) {
65
//			Element concordanceElement = params.getUIElement(params.getCorpusElement(), "concordance");//.setAttribute("xsl", xsltfileValue.getText()); //$NON-NLS-1$
66
//			if (concordanceElement != null) {
67
//				Element context_limitsElement = params.getCQLLimitElement(concordanceElement);
68
//				context_limitsElement.setAttribute("type", "list"); //$NON-NLS-1$ //$NON-NLS-2$
69
//				context_limitsElement.setTextContent(structLimitsText.getText());
70
//				//System.out.println(Messages.CorpusPage_80+structLimitsText.getText());
71
//			}
72
//			return true;
73
//		}
63
		if (this.section != null && !section.isDisposed()) {
64
			CorpusCommandPreferences concPrefs = project.getCommandPreferences("concordance");
65
			concPrefs.set("context_limits_type", "list");
66
			concPrefs.set("context_limits", structLimitsText.getText());
67
		}
74 68

  
75 69
		return true;
76 70
	}
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionEventCallBack.java (revision 1941)
314 314
				Display.getDefault().syncExec(new Runnable() {
315 315
					@Override
316 316
					public void run() {
317
						linkedEditor.fillDisplayArea();						
317
						linkedEditor.fillDisplayArea(true);
318 318
					}
319 319
				});
320

  
321 320
			}
322 321

  
323 322
			// update range change tracking variables
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1941)
789 789
	 * @param from the from
790 790
	 * @param to the to
791 791
	 */
792
	public void fillDisplayArea() {
792
	public void fillDisplayArea(boolean update) {
793 793
		if (viewerRight == null) {
794 794
			return;
795 795
		}
......
819 819
		viewerRight.setInput(lines);
820 820
		viewerLeft.setInput(lines);
821 821

  
822
		navigationWidget.setInfoLineText("" + (from+1), //$NON-NLS-1$
823
				" - " + (to+1) + " / " + concordance.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$
822
		navigationWidget.setInfoLineText("" + (from+1), " - " + (to+1) + " / " + concordance.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-3$
824 823

  
825 824
		navigationWidget.setPreviousEnabled(concordance.getTopIndex() > 0);
826 825
		navigationWidget.setFirstEnabled(concordance.getTopIndex() > 0);
......
1155 1154
			public void widgetSelected(SelectionEvent arg0) {
1156 1155
				concordance.setTopIndex(0);
1157 1156
				try {
1158
					refresh(true);
1157
					refresh(false);
1159 1158
					viewerRight.getTable().setTopIndex(0);
1160 1159
				} catch (Exception e1) {
1161 1160
					// TODO Auto-generated catch block
......
1177 1176
					top = 0;
1178 1177
				concordance.setTopIndex(top);
1179 1178
				try {
1180
					refresh(true);
1179
					refresh(false);
1181 1180
					viewerRight.getTable().setTopIndex(0);
1182 1181
				} catch (Exception e1) {
1183 1182
					// TODO Auto-generated catch block
......
1196 1195
			public void widgetSelected(SelectionEvent e) {
1197 1196
				concordance.setTopIndex(concordance.getTopIndex() + concordance.getNLinePerPage());
1198 1197
				try {
1199
					refresh(true);
1198
					refresh(false);
1200 1199
					viewerRight.getTable().setTopIndex(0);
1201 1200
				} catch (Exception e1) {
1202 1201
					// TODO Auto-generated catch block
......
1218 1217
				//int bottom = top + concordance.getNLinePerPage() -1;
1219 1218
				concordance.setTopIndex(top);
1220 1219
				try {
1221
					refresh(true);
1220
					refresh(false);
1222 1221
					viewerRight.getTable().setTopIndex(0);
1223 1222
				} catch (Exception e1) {
1224 1223
					// TODO Auto-generated catch block
......
1242 1241

  
1243 1242
			QueriesView.refresh();
1244 1243

  
1245
			this.fillDisplayArea();
1244
			this.fillDisplayArea(update);
1245
			
1246 1246
			this.queryWidget.memorize();
1247 1247

  
1248
			resetColumnWidths();
1248
			if (update) {
1249
				resetColumnWidths();
1250
			}
1249 1251

  
1250 1252
			JobsTimer.stopAndPrint();
1251 1253

  
......
1377 1379
	public void setContextSize(int leftContextSize, int rightContextSize) {
1378 1380
		concordance.setLeftContextSize(leftContextSize);
1379 1381
		concordance.setRightContextSize(rightContextSize);
1380
		fillDisplayArea(); // we return to the previously
1382
		fillDisplayArea(false); // we return to the previously
1381 1383
		resetRightTableColumnWidths();
1382 1384
	}
1383 1385

  
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/DeleteLines.java (revision 1941)
81 81
		try {
82 82
		//	System.out.println("Delete line "+lines);
83 83
			if (concordance.removeLines(lines)) {
84
				editor.fillDisplayArea();
84
				editor.fillDisplayArea(false);
85 85
			}
86 86
		} catch (Exception e1) {
87 87
			// TODO Auto-generated catch block
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 1941)
397 397
							if (concordance != null) {
398 398
								annotations.setViewAnnotation(type);
399 399
								annotations.setAnnotationOverlap(true);
400
								editor.fillDisplayArea();
400
								editor.fillDisplayArea(false);
401 401
							}
402 402
							annotationArea.layout(true);
403 403
						} else {
......
721 721
			job.syncExec(new Runnable() {
722 722
				@Override
723 723
				public void run() {
724
					editor.fillDisplayArea();
724
					editor.fillDisplayArea(false);
725 725
					CorporaView.refreshObject(corpus);
726 726
				}
727 727
			});
......
844 844
		job.syncExec(new Runnable() {
845 845
			@Override
846 846
			public void run() {
847
				editor.fillDisplayArea();
847
				editor.fillDisplayArea(false);
848 848
				CorporaView.refreshObject(corpus);
849 849
			}
850 850
		});
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 1941)
662 662
			@Override
663 663
			public void widgetDefaultSelected(SelectionEvent e) {}
664 664
		});
665
		
666
		
667 665

  
668 666
		updateAnnotationWidgetStates();
669 667
		editor.layout(true);
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompilerStep.groovy (revision 1941)
179 179
								break;
180 180

  
181 181
							default:
182
								if (foundtei && !foundtext) break;
182
								if (!foundtei || !foundtext) break;
183 183

  
184 184
								output.write("<"+localname);
185 185

  
......
221 221
								break;
222 222

  
223 223
							case "tei":
224
								foundtei = false;
224 225
								break;
226
							case "text":
227
								foundtext = false;
228
								break;
225 229
							case FORM:
226 230
								flagForm = false;
227 231
								break;
......
230 234
								flagAna = false;
231 235
								break;
232 236
							default:
233
								if (foundtei && !foundtext) break;
237
								if (!foundtei || !foundtext) break;
234 238

  
235 239
								output.write("</"+localname+">\n");
236 240
						}
237 241
						break;
238 242

  
239 243
					case XMLStreamConstants.CHARACTERS:
244
						if (!foundtei || !foundtext) break;
240 245
						if (flagWord) {
241 246
							if (flagForm) {
242 247
								if (normalizeFormValues) {
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/compiler.groovy (revision 1941)
310 310
//									localname = type
311 311
//								}
312 312

  
313
								if (foundtei && !foundtext) break;
313
								if (!foundtei || !foundtext) break;
314 314

  
315 315
								sattrsListener.startElement(localname);
316 316
								output.write("<"+localname);
......
348 348
								vAna = "";
349 349
								vForm = "";
350 350
								break;
351

  
351
							case "text":
352
								foundtext = false;
353
								break;
352 354
							case "tei":
355
								foundtei = false;
353 356
								break;
354 357
							case "form":
355 358
								flagForm = false;
......
359 362
								flagAna = false;
360 363
								break;
361 364
							default:
362
								if (foundtei && !foundtext) break;
365
								if (!foundtei || !foundtext) break;
363 366

  
364 367
//								if ("div" == localname && divs.size() > 0) {
365 368
//									localname = divs.pop()
......
371 374
						break;
372 375

  
373 376
					case XMLStreamConstants.CHARACTERS:
377
						if (!foundtei || !foundtext) break;
378
					
374 379
						if (flagForm)
375 380
							vForm += parser.getText().trim();
376 381
						if (flagAna) {

Formats disponibles : Unified diff