Révision 3402

TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/KRAnnotationEngine.java (revision 3402)
8 8

  
9 9
import org.eclipse.core.runtime.IProgressMonitor;
10 10
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
11
import org.eclipse.osgi.util.NLS;
11 12
import org.osgi.service.prefs.BackingStoreException;
12 13
import org.osgi.service.prefs.Preferences;
13 14
import org.txm.annotation.core.AnnotationEngine;
......
388 389
					kr.getJPAManager().close();
389 390
			}
390 391
			catch (Exception e) {
391
				System.out.println("Error: cannot close KR " + kr + ": " + e.getLocalizedMessage());
392
				Log.warning(NLS.bind("Error: cannot close the {0} KR : {1}.", kr, e.getLocalizedMessage()));
392 393
				Log.printStackTrace(e);
393 394
				success = false;
394 395
			}
......
399 400
					am.closeAll();
400 401
			}
401 402
			catch (Exception e) {
402
				System.out.println("Error: cannot close AM " + am + ": " + e.getLocalizedMessage());
403
				Log.warning(NLS.bind("Error: cannot close the {0} AM : {1}.", am, e.getLocalizedMessage()));
403 404
				Log.printStackTrace(e);
404 405
				success = false;
405 406
			}
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepository.java (revision 3402)
13 13
import javax.persistence.TypedQuery;
14 14
import javax.persistence.spi.PersistenceUnitInfo;
15 15

  
16
import org.eclipse.osgi.util.NLS;
16 17
import org.eclipse.persistence.config.PersistenceUnitProperties;
17 18
import org.eclipse.persistence.internal.jpa.deployment.JPAInitializer;
18 19
import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
......
125 126
		
126 127
		emf = pp.createEntityManagerFactory(DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, properties);
127 128
		if (emf == null) {
128
			System.out.println("Error: could not create the EntityManagerFactory with name: " + DatabasePersistenceManager.PERSISTENCE_UNIT_NAME + " and PersistenceProvider=" + pp);
129
			Log.warning(NLS.bind("Error: could not create the ''{0}'' EntityManagerFactory and PersistenceProvider={1}.", DatabasePersistenceManager.PERSISTENCE_UNIT_NAME, pp));
129 130
			return null;
130 131
		}
131 132
		EntityManager entityManager = (EntityManager) emf.createEntityManager();
......
138 139
		this.accessProperties = accessProperties;
139 140
		
140 141
		String sVersion = accessProperties.get("version");
141
		if (sVersion.length() > 0)
142
		if (sVersion.length() > 0) {
142 143
			this.version = Integer.parseInt(sVersion);
144
		}
143 145
		this.url = accessProperties.get(TYPE_URL);
144 146
		this.values_base_url = accessProperties.get(TYPE_RESURL);
145 147
		this.types_base_url = accessProperties.get(TYPE_TYPEURL);
......
309 311
				buildTypes();
310 312
			}
311 313
			else {
312
				System.out.println("KR Annotation Types already exist:");
314
				Log.warning("KR Annotation Types already exist:");
313 315
				for (AnnotationType annotType : annotTypes) {
314
					System.out.println(" - Type :" + annotType.getName());
316
					Log.warning(NLS.bind(" - Type : {0}", annotType.getName()));
315 317
				}
316 318
			}
317
		}
318
		else {
319
		} else {
319 320
			buildTypes();
320 321
		}
321 322
		
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/SQLKnowledgeRepository.java (revision 3402)
8 8

  
9 9
import javax.persistence.EntityManager;
10 10

  
11
import org.eclipse.osgi.util.NLS;
11 12
import org.txm.annotation.kr.core.DatabasePersistenceManager;
12 13
import org.txm.sql.SQLConnection;
13 14
import org.txm.utils.logger.Log;
......
66 67
					password);
67 68
		}
68 69
		catch (Exception e) {
69
			System.out.println("Fail to get SQL connection with " + accessProperties + " error=" + e); //$NON-NLS-1$ //$NON-NLS-2$
70
			Log.warning(NLS.bind("Fails to get SQL connection with {0} with error: {1}.", accessProperties, e)); //$NON-NLS-1$ //$NON-NLS-2$
70 71
			return null;
71 72
		}
72 73
		
......
99 100
				em.persist(value);
100 101
				// System.out.println("Value : "+annotationValue+" ("+publicid+"/"+name+") is going to be persisted !"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
101 102
				if (i > 1) {
102
					System.out.println("KR should not return more than one value !"); //$NON-NLS-1$
103
					Log.warning("KR should not return more than one value !"); //$NON-NLS-1$
103 104
				}
104 105
				i++;
105 106
			}
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/KnowledgeRepositoryManager.java (revision 3402)
7 7
import javax.persistence.EntityManager;
8 8

  
9 9
import org.apache.commons.io.FileUtils;
10
import org.eclipse.osgi.util.NLS;
10 11
import org.osgi.service.prefs.BackingStoreException;
11 12
import org.osgi.service.prefs.Preferences;
12 13
import org.txm.Toolbox;
......
108 109
			kr.buildTypesAndValues();
109 110
		}
110 111
		else {
111
			System.out.println("Error. KR not created.");
112
			Log.warning("Error. KR not created.");
112 113
		}
113 114
		
114 115
		return kr;
......
164 165
					repositories.put(name, kr);
165 166
				}
166 167
				catch (Exception e) {
167
					System.out.println("Fail to load KR from configuration file: " + krconf);
168
					Log.warning(NLS.bind("Fail to load the {0} KR from configuration file: {1}.", krconf, e));
168 169
					Log.printStackTrace(e);
169 170
				}
170 171
			}
......
195 196
						repositories.put(name, kr);
196 197
					}
197 198
					else {
198
						System.out.println("KR not created: " + name);
199
						Log.warning(NLS.bind("KR not created: {0}.", name));
199 200
						return null;
200 201
					}
201 202
				}
202 203
				catch (Exception e) {
203
					System.out.println("Fail to load KR from configuration file: " + krconf);
204
					Log.warning(NLS.bind("Fail to load the KR from the {0} configuration file with error {1}.", krconf, e));
204 205
					Log.printStackTrace(e);
205 206
				}
206 207
			}
......
223 224
			}
224 225
			else {
225 226
				// replace the KR
226
				System.out.println("REPLACE OLD KR=" + kr + " (version=" + version + ") WITH corpus KR configuration (version=" + krCorpusVersion + ")");
227
				Log.fine("REPLACE OLD KR=" + kr + " (version=" + version + ") WITH corpus KR configuration (version=" + krCorpusVersion + ")");
227 228
				KnowledgeRepository krNew = createKnowledgeRepository(name, corpusprefkrconf);
228 229
				
229 230
				try { // write the new configuration file in krconf File
230 231
					krNew.saveConfiguration(krconf);
231 232
				}
232 233
				catch (Exception e) {
233
					System.out.println("Fail to create KR from corpus configuration: " + corpus);
234
					Log.warning(NLS.bind("Fail to create KR from the {0} corpus configuration.", corpus));
234 235
					Log.printStackTrace(e);
235 236
					return kr;
236 237
				}
......
238 239
					repositories.put(name, krNew);
239 240
					kr = krNew;
240 241
				}
241
				else {
242
					System.out.println("Internal error: the new KR is null: " + name);
243
				}
244 242
			}
245 243
		}
246 244
		else {
......
253 251
				kr = krNew;
254 252
			}
255 253
			else {
256
				System.out.println("Internal error: the new KR is null: " + name);
254
				Log.warning(NLS.bind("Internal error: the new {0} KR is null.", name));
257 255
				return null;
258 256
			}
259 257
			
......
261 259
				krNew.saveConfiguration(krconf);
262 260
			}
263 261
			catch (Exception e) {
264
				System.out.println("Fail to create KR from corpus configuration: " + corpus);
262
				Log.warning(NLS.bind("Fail to create KR from the {0} corpus configuration with error", corpus, e));
265 263
				Log.printStackTrace(e);
266 264
				return kr;
267 265
			}
268
			
269
			
270 266
		}
271 267
		
272 268
		return kr;
......
328 324
				FileUtils.writeStringToFile(newHtmlFile, htmlString);
329 325
			}
330 326
			catch (Exception e) {
331
				System.out.println("Generating HTML Page failed for " + id + " : " + e);
327
				Log.warning(NLS.bind("Error while generating the HTML Page failed for the {0} id with error: {1}.", id, e));
332 328
				Log.printStackTrace(e);
333 329
			}
334 330
			
335 331
		}
336 332
		else {
337
			System.out.println("KR " + krname + " is null !");
333
			Log.warning(NLS.bind("Error: the {0} KR is null !", krname));
338 334
		}
339 335
		
340 336
		return newHtmlFile.getAbsolutePath();
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/LocalKnowledgeRepository.java (revision 3402)
39 39
		}
40 40
		try {
41 41
			for (String type : fieldsTypesProperties.keySet()) {
42
				// System.out.println(" TYPE="+type);
43 42
				File f = new File(currentDirectory, type);
44 43
				BufferedReader reader = new BufferedReader(new FileReader(f));
45 44
				String line = reader.readLine();
......
48 47
				HashSet<String> values = new HashSet<String>();
49 48
				while (line != null) {
50 49
					if (line.length() > 0) {
51
						System.out.println("  LINE=" + line);
52 50
						String split[] = line.split("\t", 2);
53 51
						TypedValue val = null;
54 52
						if (split.length == 2) {
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java (revision 3402)
51 51
		
52 52
		List<Annotation> annots = tempManager.getAnnotations();
53 53
		if (annots.isEmpty()) {
54
			System.out.println("No annotation to save. Aborting.");
54
			Log.info("No annotation to save. Aborting.");
55 55
			dirty = false;
56 56
			return true;
57 57
		}
......
98 98
			tempManager.getEntityManager().getTransaction().begin();
99 99
			for (Annotation a : temporaryAnnotations) {
100 100
				if (job != null && job.isCanceled()) {
101
					System.out.println("Delete annotation canceled.");
101
					Log.info("Delete annotation canceled.");
102 102
					return false;
103 103
				}
104 104
				tempManager.deleteAnnotation(type, a.getStart(), a.getEnd());
......
109 109
			tempManager.getEntityManager().getTransaction().begin();
110 110
			for (Annotation a : cqpAnnotations) {
111 111
				if (job != null && job.isCanceled()) {
112
					System.out.println("Delete annotation canceled.");
112
					Log.info("Delete annotation canceled.");
113 113
					return false;
114 114
				}
115 115
				String value = cqpManager.getCQPAnnotationValue(a.getStart(), a.getEnd(), type);
......
148 148
				}
149 149
				
150 150
				if (job != null && job.isCanceled()) {
151
					System.out.println("Delete annotation canceled.");
151
					Log.info("Delete annotation canceled.");
152 152
					return false;
153 153
				}
154 154
				
......
165 165
			tempManager.getEntityManager().getTransaction().commit();
166 166
		}
167 167
		catch (Exception e) {
168
			e.printStackTrace();
168
			Log.printStackTrace(e);
169 169
			return false;
170 170
		}
171 171
		return true;
......
188 188
			// System.out.println("Temporary annotations: "+temporaryAnnotations);
189 189
			// System.out.println("CQP annotations: "+cqpAnnotations);
190 190
			if (cqpAnnotations.size() != matches.size() || temporaryAnnotations.size() != matches.size()) {
191
				System.out.println("ERROR in getAnnotationsForMatches methods! ");
191
				Log.info("ERROR in getAnnotationsForMatches methods! ");
192 192
				return new ArrayList<>(matches.size());
193 193
			}
194 194
			// merge the 2 results
......
219 219
			tempManager.close();
220 220
		}
221 221
		catch (Exception e) {
222
			System.out.println("Fail to clear AnnotationManager instance: " + e);
223
			org.txm.utils.logger.Log.printStackTrace(e);
222
			Log.warning(NLS.bind("Fail to clear AnnotationManager instance with error: {0}", e));
223
			Log.printStackTrace(e);
224 224
		}
225 225
	}
226 226
	
......
268 268
			}
269 269
			
270 270
			if (job != null && job.isCanceled()) { // check if user canceled the job
271
				System.out.println("Affect annotation canceled.");
271
				Log.info("Affect annotation canceled.");
272 272
				return null;
273 273
			}
274 274
			
......
327 327
				
328 328
			}
329 329
			catch (Throwable e) {
330
				Log.info(NLS.bind("Error during annotation creation: {0}.", e));
330 331
				Log.printStackTrace(e);
331
				System.out.println("Error during annotation creation: " + e);
332
				
332 333
				if (tempManager.getEntityManager().getTransaction().isActive()) {
333 334
					tempManager.getEntityManager().getTransaction().rollback(); // reset state
334 335
				}
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/conversion/CorpusRuledConvertion.java (revision 3402)
10 10
import javax.xml.stream.XMLStreamException;
11 11

  
12 12
import org.apache.commons.lang.StringUtils;
13
import org.eclipse.osgi.util.NLS;
13 14
import org.txm.Toolbox;
14 15
import org.txm.searchengine.cqp.corpus.MainCorpus;
15 16
import org.txm.utils.ConsoleProgressBar;
16 17
import org.txm.utils.io.IOUtils;
18
import org.txm.utils.logger.Log;
17 19

  
18 20
public class CorpusRuledConvertion {
19 21
	
......
39 41
			line = reader.readLine();
40 42
		}
41 43
		
42
		System.out.println("Conversion rules: " + rules);
44
		Log.info(NLS.bind("Conversion rules: {0}.", rules));
43 45
	}
44 46
	
45 47
	public CorpusRuledConvertion(LinkedHashMap<Pattern, String> rules,
......
54 56
		File binaryCorpusDirectory = corpus.getProjectDirectory();
55 57
		File txmDirectory = new File(binaryCorpusDirectory, "txm");
56 58
		if (!txmDirectory.exists()) {
57
			System.out.println("'txm' directory not found in " + binaryCorpusDirectory.getAbsolutePath());
59
			Log.warning(NLS.bind("The 'txm' directory was not found in {0}.", binaryCorpusDirectory.getAbsolutePath()));
58 60
			return false;
59 61
		}
60 62
		File txmCorpusDirectory = new File(txmDirectory, corpus.getID());
61 63
		if (!txmCorpusDirectory.exists()) {
62
			System.out.println("'" + corpus.getName() + "' corpus directory not found in " + txmDirectory.getAbsolutePath());
64
			Log.warning(NLS.bind("The ''{0}'' corpus directory was not found in {1}.", corpus.getName(), txmDirectory.getAbsolutePath()));
63 65
			return false;
64 66
		}
65 67
		File[] files = txmCorpusDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
66 68
		if (files == null || files.length == 0) {
67
			System.out.println("No file in " + txmCorpusDirectory);
69
			Log.warning(NLS.bind("No file found in the {0} directory.", txmCorpusDirectory));
68 70
			return false;
69 71
		}
70 72
		ConsoleProgressBar cpb = new ConsoleProgressBar(files.length);
......
87 89
				
88 90
				HashSet<String> errors = converter.getNoMatchValues();
89 91
				if (errors.size() > 0) {
90
					System.out.println("Some values did not match rule:");
92
					Log.warning("Some values did not match rule: ");
91 93
					int i = 0;
92 94
					for (String error : errors) {
93
						System.out.println("\t" + error);
95
						Log.warning("\t" + error);
94 96
						if (i >= 10) break;
95 97
					}
96 98
					if (errors.size() > 10) {
97 99
						try {
98 100
							File errorFile = new File(Toolbox.getTxmHomePath(), "errors.txt");
99 101
							IOUtils.write(errorFile, StringUtils.join(errors, "\t"));
100
							System.out.println("More errors, see " + errorFile.getAbsolutePath());
102
							Log.warning(NLS.bind("More errors, see the {0} errors file.", errorFile.getAbsolutePath()));
101 103
						}
102 104
						catch (Exception e) {
103 105
							e.printStackTrace();
......
108 110
				
109 111
				tmpFile.renameTo(xmlFile);
110 112
				if (tmpFile.exists()) {
111
					System.out.println("Could not replace original file with the result file. " + xmlFile + " with " + tmpFile);
113
					Log.warning(NLS.bind("Could not replace original file with the {0} result file with {1}.", xmlFile, tmpFile));
112 114
					return false;
113 115
				}
114 116
			}
115 117
			else {
116
				System.out.println("Fail to process " + xmlFile);
118
				Log.warning(NLS.bind("Fail to process the {0} XML file.", xmlFile));
117 119
				return false;
118 120
			}
119 121
		}
120
		System.out.println(); // end of ConsoleProgressBar
122
		cpb.done();
121 123
		return true;
122 124
	}
123 125
}
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/conversion/XMLTXMFileRuledConversion.java (revision 3402)
10 10
import javax.xml.stream.XMLStreamReader;
11 11

  
12 12
import org.txm.importer.StaxIdentityParser;
13
import org.txm.utils.logger.Log;
13 14

  
14 15
public class XMLTXMFileRuledConversion extends StaxIdentityParser {
15 16
	
......
98 99
				String value = parser.getAttributeValue(i);
99 100
				if (oldType != null && oldType.equals(att)) {
100 101
					if (converter != null) {
101
						if (debug) System.out.println("CALL CONVERTER with attribute $att");
102
						if (debug) Log.finer("CALL CONVERTER with attribute "+att);
102 103
						newValue = converter.getValue(parser, localname, att, value);
103 104
					}
104 105
					else {
......
111 112
			}
112 113
			
113 114
			if (oldType == null && converter != null) {
114
				if (debug) System.out.println("CALL CONVERTER with no attribute set");
115
				if (debug) Log.finer("CALL CONVERTER with no attribute set");
115 116
				newValue = converter.getValue(parser, localname, null, null);
116 117
			}
117 118
			
118 119
			if (newValue != null) {
119
				if (debug) System.out.println("WRITE NEWTYPE: " + newType + "=" + newValue);
120
				if (debug) Log.finer("WRITE NEWTYPE: " + newType + "=" + newValue);
120 121
				writeAttribute(null, newType, newValue);
121 122
			}
122 123
		}
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationSyMoGIHWriter.java (revision 3402)
14 14
import javax.xml.stream.XMLStreamException;
15 15
import javax.xml.stream.XMLStreamWriter;
16 16

  
17
import org.eclipse.osgi.util.NLS;
17 18
import org.txm.annotation.kr.core.repository.AnnotationType;
18 19
import org.txm.importer.StaxIdentityParser;
20
import org.txm.utils.logger.Log;
19 21

  
20 22
/**
21 23
 * The Class AnnotationStandoffInjector.
......
325 327
			if (localname.equals("TEI")) {
326 328
				try {
327 329
					for (String author : allannotations.keySet()) {
328
						System.out.println("    author=" + author);
330
						Log.info("    author=" + author);
329 331
						File currentXmlFile = new File(xmlStandOffDirectory, filename.substring(0, filename.length() - 4) + "_" + currentAuthor + "_annotations.xml");
330 332
						
331 333
						// write start of the stand-off file
......
361 363
					}
362 364
				}
363 365
				catch (Exception e) {
364
					System.out.println("Current writer " + currentWriter);
366
					Log.warning(NLS.bind("Error with current writer: {0}.", currentWriter));
367
					Log.printStackTrace(e);
365 368
				}
366 369
			}
367 370
			super.processEndElement();
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationWriter.java (revision 3402)
77 77
	 * @throws InvalidCqpIdException
78 78
	 * @throws XMLStreamException
79 79
	 */
80
	protected boolean writeTextAnnotationToSyMoGIH(String textid, File currentXMLFile, File currentXMLStandoffFile, File xmlStandOffDirectory) throws IOException, CqiServerError, CqiClientException,
81
			InvalidCqpIdException, XMLStreamException {
82
		System.out.println("  text=" + textid);
80
	protected boolean writeTextAnnotationToSyMoGIH(String textid, File currentXMLFile, File currentXMLStandoffFile, File xmlStandOffDirectory) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException, XMLStreamException {
81
		Log.info("  text=" + textid);
83 82
		boolean show_debug = Log.getLevel().intValue() < Level.INFO.intValue();
84 83
		
85 84
		AnnotationSyMoGIHWriter annotationstdoff = new AnnotationSyMoGIHWriter(textid, currentXMLFile, xmlStandOffDirectory, types, show_debug);
......
90 89
				return true;
91 90
			}
92 91
			else {
93
				System.out.println("Error: result file " + currentXMLStandoffFile + " is malformed.");
92
				Log.warning(NLS.bind("Error: the {0} result file is malformed.", currentXMLStandoffFile));
94 93
			}
95 94
		}
96 95
		else {
97
			System.out.println("Error: while processing " + currentXMLStandoffFile + " in standoff dir");
96
			Log.warning(NLS.bind("Error: while processing the {0} file in standoff dir", currentXMLStandoffFile));
98 97
		}
99 98
		return false;
100 99
		
......
114 113
	public boolean writeAnnotationsInStandoff(File resultZipFile) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException, XMLStreamException {
115 114
		
116 115
		List<String> textsIds = Arrays.asList(corpus.getCorpusTextIdsList());
117
		System.out.println("Exporting annotations of " + StringUtils.join(textsIds, ", ") + ".");
116
		Log.info(NLS.bind("Exporting annotations of the {0} text(s).", StringUtils.join(textsIds, ", ")));
118 117
		
119 118
		File resultDirectory = new File(Toolbox.getTxmHomePath(), "results/" + corpus.getID() + "_annotations");
120 119
		DeleteDir.deleteDirectory(resultDirectory);
121 120
		resultDirectory.mkdirs();
122 121
		if (!(resultDirectory.exists() && resultDirectory.canWrite())) {
123
			System.out.println("ERROR: could not create/write temporary directory: " + resultDirectory);
122
			Log.warning(NLS.bind("ERROR: could not create/write temporary directory: {0}.", resultDirectory));
124 123
			return false;
125 124
		}
126 125
		
127 126
		File inputDirectory = corpus.getProjectDirectory();
128 127
		File corpusTxmDirectory = new File(inputDirectory, "txm/" + corpus.getID());
129 128
		
130
		System.out.println("Writing annotations XML files in " + resultDirectory);
129
		Log.info(NLS.bind("Writing annotations XML files in {0}.", resultDirectory));
131 130
		for (String textid : textsIds) {
132 131
			File currentXMLFile = new File(corpusTxmDirectory, textid + ".xml");
133 132
			if (!currentXMLFile.exists()) {
134
				System.out.println("Error: cannot found XML file for text with id=" + textid);
133
				Log.warning(NLS.bind("Error: cannot found ab XML-TXM file for text with the ''{0}'' id.", textid));
135 134
				return false;
136 135
			}
137 136
			File currentXMLStandoffFile = new File(resultDirectory, textid + ".xml"); // To Be Changed ?
138 137
			if (!writeTextAnnotationToSyMoGIH(textid, currentXMLFile, currentXMLStandoffFile, resultDirectory)) {
139
				System.out.println("Error while writing annotations of text " + currentXMLStandoffFile);
138
				Log.warning(NLS.bind("Error while writing annotations of text in {0}.", currentXMLStandoffFile));
140 139
				return false;
141 140
			}
142 141
		}
......
144 143
		Zip.compress(resultDirectory, resultZipFile, new ConsoleProgressBar(1));
145 144
		DeleteDir.deleteDirectory(resultDirectory);
146 145
		
147
		System.out.println("Annotations saved in " + resultZipFile.getAbsolutePath());
146
		Log.info(NLS.bind("Annotations saved in ''{0}''.", resultZipFile.getAbsolutePath()));
148 147
		return resultZipFile.exists();
149 148
	}
150 149
	
......
211 210
		DeleteDir.deleteDirectory(tmpXMLTXMDirectory);
212 211
		tmpXMLTXMDirectory.mkdirs();
213 212
		if (!(tmpXMLTXMDirectory.exists() && tmpXMLTXMDirectory.canWrite())) {
214
			System.out.println("ERROR: could not create directory: " + tmpXMLTXMDirectory);
213
			Log.warning(NLS.bind("ERROR: could not create directory: {0}.", tmpXMLTXMDirectory));
215 214
			return false;
216 215
		}
217 216
		
......
219 218
		// DeleteDir.deleteDirectory(tmpXMLTXMDirectory);
220 219
		previousXMLTXMDirectory.mkdirs();
221 220
		if (!(previousXMLTXMDirectory.exists() && previousXMLTXMDirectory.canWrite())) {
222
			System.out.println("ERROR: could not create directory: " + previousXMLTXMDirectory);
221
			Log.warning(NLS.bind("ERROR: could not create directory: {0}.", previousXMLTXMDirectory));
223 222
			return false;
224 223
		}
225 224
		
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationInjector.java (revision 3402)
16 16
import org.txm.Toolbox;
17 17
import org.txm.importer.StaxIdentityParser;
18 18
import org.txm.importer.ValidateXml;
19
import org.txm.utils.logger.Log;
19 20

  
20 21
/**
21 22
 * The Class AnnotationInjection.
......
147 148
		});
148 149
		
149 150
		if (debug) {
150
			System.out.println("annotations for " + xmlFile);
151
			System.out.println(" segment grouped and ordered by start position: " + annotationsToAddByStartPos);
152
			System.out.println(" segment grouped and ordered by end position: " + annotationsToAddByEndPos);
153
			System.out.println(" token ordered by start position: " + tokenAnnotations);
151
			Log.finer("annotations for " + xmlFile);
152
			Log.finer(" segment grouped and ordered by start position: " + annotationsToAddByStartPos);
153
			Log.finer(" segment grouped and ordered by end position: " + annotationsToAddByEndPos);
154
			Log.finer(" token ordered by start position: " + tokenAnnotations);
154 155
		}
155 156
	}
156 157
	
......
185 186
				for (Annotation a : currentStartAnnotations) {
186 187
					if (!"#del".equals(a.getValue())) {
187 188
						if (debug) {
188
							System.out.println(" force write start annotation " + a);
189
							Log.finer(" force write start annotation " + a);
189 190
						}
190 191
						writeStartAnnotation(a);
191 192
					}
192 193
					else {
193 194
						if (debug)
194
							System.out.println(" no need to write start annotation " + a);
195
							Log.finer(" no need to write start annotation " + a);
195 196
						currentEndAnnotations = annotationsToAddByEndPos.get(a.getEnd());
196 197
						// System.out.println(" shall we need to change annotation attribute : "+a.getValue()+
197 198
						// " | currentEndAnnotations : "+currentEndAnnotations);
198 199
						if (currentEndAnnotations == null) {
199
							System.out.println("WARNING ERROR null pointer for end position of annotation " + a);
200
							Log.finer("WARNING ERROR null pointer for end position of annotation " + a);
200 201
						}
201 202
						else {
202 203
							currentEndAnnotations.remove(a);
TXM/trunk/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/CQPAnnotationManager.java (revision 3402)
19 19
import org.txm.searchengine.cqp.corpus.StructuralUnit;
20 20
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
21 21
import org.txm.searchengine.cqp.serverException.CqiServerError;
22
import org.txm.utils.logger.Log;
22 23

  
23 24
public class CQPAnnotationManager {
24 25
	
......
400 401
				return struc_str[0];
401 402
			}
402 403
			else { // should not happens
403
				System.out.println("WARNING: FOUND EXISTING ANNOTATION FOR TYPE=" + type + " START=" + start + " END=" + end);
404
				Log.warning("WARNING: FOUND EXISTING ANNOTATION FOR TYPE=" + type + " START=" + start + " END=" + end);
404 405
				return null;
405 406
			}
406 407
		}
TXM/trunk/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java (revision 3402)
328 328
						}
329 329
						else {
330 330
							monitor.worked(50);
331
							System.out.println("Fail to update corpus. Aborting");
332
							System.out.println("Fix XML-TXM files and call command 'UpdateCorpus'");
331
							Log.warning("Fail to update corpus. Aborting");
332
							Log.warning("Fix XML-TXM files and call command 'UpdateCorpus'");
333 333
							return Status.CANCEL_STATUS;
334 334
						}
335 335
					} else {
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportGlozzCorpus.java (revision 3402)
41 41
			
42 42
			Object first = CorporaView.getFirstSelectedObject();
43 43
			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
44
				System.out.println(NLS.bind(Messages.ExportGlozzCorpus_0, first));
44
				Log.warning(NLS.bind(Messages.ExportGlozzCorpus_0, first));
45 45
				return null;
46 46
			}
47 47
			
......
62 62
						export(exportDirectory, mainCorpus, unit_type);
63 63
					}
64 64
					catch (ThreadDeath e) {
65
						System.out.println(Messages.ExportGlozzCorpus_2);
65
						Log.warning(Messages.ExportGlozzCorpus_2);
66 66
					}
67 67
					catch (Throwable e) {
68
						System.out.println(NLS.bind(Messages.ExportGlozzCorpus_3, e.getLocalizedMessage()));
68
						Log.warning(NLS.bind(Messages.ExportGlozzCorpus_3, e.getLocalizedMessage()));
69 69
						Log.printStackTrace(e);
70 70
						return Status.CANCEL_STATUS;
71 71
					}
......
77 77
			return null;
78 78
		}
79 79
		catch (Throwable e) {
80
			System.out.println(NLS.bind(Messages.ExportGlozzCorpus_3, e.getLocalizedMessage()));
80
			Log.warning(NLS.bind(Messages.ExportGlozzCorpus_3, e.getLocalizedMessage()));
81 81
			Log.printStackTrace(e);
82 82
		}
83 83
		return null;
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditVue.java (revision 3402)
9 9
import org.txm.annotation.urs.URSCorpora;
10 10
import org.txm.rcp.views.corpora.CorporaView;
11 11
import org.txm.searchengine.cqp.corpus.MainCorpus;
12
import org.txm.utils.logger.Log;
12 13

  
13 14
import visuAnalec.VisuMain;
14 15
import visuAnalec.donnees.Corpus;
......
31 32

  
32 33
		Object first = CorporaView.getFirstSelectedObject();
33 34
		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
34
			System.out.println("Selection is not a corpus: "+first);
35
			Log.warning("Selection is not a corpus: "+first);
35 36
			return null;
36 37
		}
37 38
		
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/EditStructure.java (revision 3402)
12 12
import org.txm.annotation.urs.view.ElementPropertiesView;
13 13
import org.txm.rcp.views.corpora.CorporaView;
14 14
import org.txm.searchengine.cqp.corpus.MainCorpus;
15
import org.txm.utils.logger.Log;
15 16

  
16 17
import visuAnalec.VisuMain;
17 18
import visuAnalec.donnees.Corpus;
......
33 34

  
34 35
		Object first = CorporaView.getFirstSelectedObject();
35 36
		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
36
			System.out.println(NLS.bind(Messages.EditStructure_0, first));
37
			Log.warning(NLS.bind(Messages.EditStructure_0, first));
37 38
			return null;
38 39
		}
39 40
		
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEICorpus.java (revision 3402)
29 29
import visuAnalec.fichiers.FichiersTEI;
30 30

  
31 31
public class ImportTEICorpus  extends AbstractHandler {
32

  
32
	
33 33
	@Option(name="xmlFile",usage="an example file", widget="File", required=true, def="text.xml")
34 34
	File xmlFile;
35

  
35
	
36 36
	private String name;
37

  
37
	
38 38
	/* (non-Javadoc)
39 39
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
40 40
	 */
......
43 43
		try {
44 44
			// Open the parameters input dialog box
45 45
			if (!ParametersDialog.open(this)) return null;
46

  
46
			
47 47
			// END OF PARAMETERS
48 48
			if (!(xmlFile.exists())) {
49
				System.out.println(NLS.bind(Messages.ImportTEICorpus_0, xmlFile));
49
				Log.warning(NLS.bind(Messages.ImportTEICorpus_0, xmlFile));
50 50
				return null;
51 51
			}
52

  
52
			
53 53
			name = xmlFile.getName();
54 54
			int idx = name.indexOf("."); //$NON-NLS-1$
55 55
			name = name.substring(0, idx);
56 56
			name = AsciiUtils.buildId(name);
57

  
57
			
58 58
			File srcDir = new File(xmlFile.getParentFile(), name);
59
			System.out.println(Messages.ImportTEICorpus_2);
59
			Log.info(Messages.ImportTEICorpus_2);
60 60
			DeleteDir.deleteDirectory(srcDir);
61 61
			srcDir.mkdir();
62

  
62
			
63 63
			if (!srcDir.exists()) {
64
				System.out.println(Messages.ImportTEICorpus_3);
64
				Log.warning(Messages.ImportTEICorpus_3);
65 65
				return null;
66 66
			}
67

  
67
			
68 68
			// write the TXT file WITH paragraphs
69 69
			File txtFile = new File(srcDir, name+".txt"); //$NON-NLS-1$
70 70
			Corpus tmpAnalecCorpus = new Corpus(); // need a temporary corpus
71
			System.out.println(NLS.bind(Messages.ImportTEICorpus_5, xmlFile));
71
			Log.info(NLS.bind(Messages.ImportTEICorpus_5, xmlFile));
72 72
			if (!FichiersTEI.convertir(xmlFile, new File("/tmp"), tmpAnalecCorpus)) { //$NON-NLS-1$
73
				System.out.println(Messages.ImportTEICorpus_7);
73
				Log.warning(Messages.ImportTEICorpus_7);
74 74
				return null;
75 75
			}
76 76
			
77 77
			final String texte = tmpAnalecCorpus.getTexte();
78
		    int debParag = 0;
79
		    Integer[] finPars = tmpAnalecCorpus.getFinParagraphes();
80
		    StringBuffer newTexte = new StringBuffer(texte.length() + finPars.length);
81
		    for (int i = 0 ; i < finPars.length ; i++) {
82
		    	newTexte.append(texte.substring(debParag, finPars[i])).append("\n"); //$NON-NLS-1$
83
		    	debParag = finPars[i];
84
		    }
78
			int debParag = 0;
79
			Integer[] finPars = tmpAnalecCorpus.getFinParagraphes();
80
			StringBuffer newTexte = new StringBuffer(texte.length() + finPars.length);
81
			for (int i = 0 ; i < finPars.length ; i++) {
82
				newTexte.append(texte.substring(debParag, finPars[i])).append("\n"); //$NON-NLS-1$
83
				debParag = finPars[i];
84
			}
85 85
			
86 86
			IOUtils.write(txtFile, newTexte.toString());
87 87
			
88 88
			if (!txtFile.exists()) {
89
				System.out.println(Messages.ImportTEICorpus_9);
89
				Log.warning(Messages.ImportTEICorpus_9);
90 90
				return null;
91 91
			}
92

  
92
			
93 93
			Project project = new Project(Toolbox.workspace, name.toUpperCase());
94 94
			project.setSourceDirectory(srcDir.getAbsolutePath());
95 95
			project.setImportModuleName("txt");
......
97 97
			
98 98
			JobHandler job = ExecuteImportScript.executeScript(project);
99 99
			if (job == null) { // job is scheduled in ExecuteImportScript.executeScript
100
				System.out.println(Messages.ImportTEICorpus_15);
100
				Log.warning(Messages.ImportTEICorpus_15);
101 101
				return null;
102 102
			}
103

  
103
			
104 104
			JobHandler job2 = new JobHandler(Messages.ImportTEICorpus_16) {
105 105
				
106 106
				@Override
107 107
				protected IStatus run(IProgressMonitor monitor) {
108 108
					try {
109
					MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
110
					File analecDirectory = new File(corpus.getProjectDirectory(), "analec"); //$NON-NLS-1$
111
					analecDirectory.mkdirs();
112
					Corpus analecCorpus = URSCorpora.getCorpus(corpus);
113
					analecCorpus.clearAll(); // remove all : annotations, structure
114
					
115
					System.out.println(NLS.bind(Messages.ImportTEICorpus_18, xmlFile));
116
					if (!FichiersTEI.convertir(xmlFile, analecDirectory, analecCorpus)) {
117
						System.out.println(Messages.ImportTEICorpus_19);
118
						return null;
119
					}
120
				
121
					System.out.println(Messages.ImportTEICorpus_20);
122
					
123
					URSCorpora.removeCorpus(corpus); // remove old corpus if any
124
					
125
					URSAnnotationReIndexer aari = new URSAnnotationReIndexer(corpus, analecCorpus);
126
					if (!aari.process()) {
127
						System.out.println(Messages.ImportTEICorpus_21);
128
						return null;
129
					}
130
					
131
					System.out.println(Messages.ImportTEICorpus_22);
132
					URSCorpora.saveCorpus(analecCorpus);
133
					URSCorpora.getVue(analecCorpus).retablirVueParDefaut();
134
					System.out.println(Messages.ImportTEICorpus_23);
135
					
136
					return Status.OK_STATUS;
109
						MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
110
						File analecDirectory = new File(corpus.getProjectDirectory(), "analec"); //$NON-NLS-1$
111
						analecDirectory.mkdirs();
112
						Corpus analecCorpus = URSCorpora.getCorpus(corpus);
113
						analecCorpus.clearAll(); // remove all : annotations, structure
114
						
115
						Log.info(NLS.bind(Messages.ImportTEICorpus_18, xmlFile));
116
						if (!FichiersTEI.convertir(xmlFile, analecDirectory, analecCorpus)) {
117
							Log.warning(Messages.ImportTEICorpus_19);
118
							return null;
119
						}
120
						
121
						Log.info(Messages.ImportTEICorpus_20);
122
						
123
						URSCorpora.removeCorpus(corpus); // remove old corpus if any
124
						
125
						URSAnnotationReIndexer aari = new URSAnnotationReIndexer(corpus, analecCorpus);
126
						if (!aari.process()) {
127
							Log.warning(Messages.ImportTEICorpus_21);
128
							return null;
129
						}
130
						
131
						Log.info(Messages.ImportTEICorpus_22);
132
						URSCorpora.saveCorpus(analecCorpus);
133
						URSCorpora.getVue(analecCorpus).retablirVueParDefaut();
134
						Log.info(Messages.ImportTEICorpus_23);
135
						
136
						return Status.OK_STATUS;
137 137
					} catch (Exception e) {
138
						System.out.println(NLS.bind(Messages.ImportTEICorpus_24, e));
138
						Log.warning(NLS.bind(Messages.ImportTEICorpus_24, e));
139 139
						Log.printStackTrace(e);
140 140
						return Status.CANCEL_STATUS;
141 141
					}
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/LoadCorpus.java (revision 3402)
16 16
import org.txm.rcp.swt.widget.parameters.ParametersDialog;
17 17
import org.txm.rcp.views.corpora.CorporaView;
18 18
import org.txm.searchengine.cqp.corpus.MainCorpus;
19
import org.txm.utils.logger.Log;
19 20

  
20 21
import visuAnalec.donnees.Corpus;
21 22
import visuAnalec.fichiers.FichiersJava;
......
39 40
		
40 41
		Object first = CorporaView.getFirstSelectedObject();
41 42
		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
42
			System.out.println(NLS.bind(Messages.LoadCorpus_0, first));
43
			Log.warning(NLS.bind(Messages.LoadCorpus_0, first));
43 44
			return null;
44 45
		}
45 46
		
46 47
		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.CQPCorpus)first).getMainCorpus();
47 48
		Corpus corpus = URSCorpora.getCorpus(mainCorpus);
48 49
		
49
		System.out.println(Messages.LoadCorpus_1);
50
		Log.info(Messages.LoadCorpus_1);
50 51
		
51 52
		if (!ParametersDialog.open(this)) return null;
52 53

  
......
57 58
	
58 59
	public static boolean load(File ecfile, Corpus corpus) {
59 60
		if (!(ecfile.exists())) {
60
			System.out.println(Messages.LoadCorpus_2);
61
			Log.warning(Messages.LoadCorpus_2);
61 62
			return false;
62 63
		}
63 64
		File fichierCorpus = ecfile;
64
		System.out.println(NLS.bind(Messages.LoadCorpus_3, fichierCorpus));
65
		Log.info(NLS.bind(Messages.LoadCorpus_3, fichierCorpus));
65 66
		if (!FichiersJava.ouvrirCorpus(corpus, fichierCorpus, false)) {
66
			System.out.println(Messages.LoadCorpus_4);
67
			Log.warning(Messages.LoadCorpus_4);
67 68
			return false;
68 69
		}
69 70
		
70
		System.out.println(Messages.LoadCorpus_5);
71
		Log.info(Messages.LoadCorpus_5);
71 72
		return true;
72 73
	}
73 74
}
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzAnnotations.java (revision 3402)
20 20
import org.txm.searchengine.cqp.corpus.CorpusManager;
21 21
import org.txm.searchengine.cqp.corpus.MainCorpus;
22 22
import org.txm.searchengine.cqp.serverException.CqiServerError;
23
import org.txm.utils.logger.Log;
23 24

  
24 25
import visuAnalec.donnees.Corpus;
25 26
import visuAnalec.fichiers.FichiersGlozz;
......
58 59
	
59 60
	public static boolean doImport(File aafile, File aamfile, File acfile) throws CqiClientException, IOException, CqiServerError {
60 61
		if (!(aafile.exists() && aafile.exists() && aafile.exists())) {
61
			System.out.println(Messages.ImportGlozzAnnotations_0);
62
			Log.warning(Messages.ImportGlozzAnnotations_0);
62 63
			return false;
63 64
		}
64 65

  
65 66
		Object first = CorporaView.getFirstSelectedObject();
66 67
		if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
67
			System.out.println(NLS.bind(Messages.ImportGlozzAnnotations_1, first));
68
			Log.warning(NLS.bind(Messages.ImportGlozzAnnotations_1, first));
68 69
			return false;
69 70
		}
70 71
		
......
72 73
		Corpus analecCorpus = URSCorpora.getCorpus(mainCorpus);
73 74
		analecCorpus.clearAll(); // remove all : annotations, structure
74 75
		
75
		System.out.println(NLS.bind(Messages.ImportGlozzAnnotations_2, aamfile));
76
		Log.info(NLS.bind(Messages.ImportGlozzAnnotations_2, aamfile));
76 77
		if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamfile)) {
77
			System.out.println(Messages.ImportGlozzAnnotations_3);
78
			Log.warning(Messages.ImportGlozzAnnotations_3);
78 79
			return false;
79 80
		}
80 81
		
81
		System.out.println(NLS.bind(Messages.ImportGlozzAnnotations_4, acfile, aafile));
82
		Log.info(NLS.bind(Messages.ImportGlozzAnnotations_4, acfile, aafile));
82 83
		if (!FichiersGlozz.importerGlozz(analecCorpus, acfile, aafile)) {
83
			System.out.println(Messages.ImportGlozzAnnotations_6);
84
			Log.warning(Messages.ImportGlozzAnnotations_6);
84 85
			return false;
85 86
		}
86 87
		
87
		System.out.println(Messages.ImportGlozzAnnotations_7);
88
		Log.info(Messages.ImportGlozzAnnotations_7);
88 89
		URSAnnotationReIndexer aari = new URSAnnotationReIndexer(mainCorpus, analecCorpus);
89 90
		if (!aari.process()) {
90
			System.out.println(Messages.ImportGlozzAnnotations_8);
91
			Log.warning(Messages.ImportGlozzAnnotations_8);
91 92
			return false;
92 93
		}
93 94
		
94
		System.out.println(Messages.ImportGlozzAnnotations_9);
95
		Log.info(Messages.ImportGlozzAnnotations_9);
95 96
		URSCorpora.saveCorpus(analecCorpus);
96 97
		
97
		System.out.println(Messages.ImportGlozzAnnotations_10);
98
		Log.info(Messages.ImportGlozzAnnotations_10);
98 99
		return true;
99 100
	}
100 101
}
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ExportTEICorpus.java (revision 3402)
50 50

  
51 51
			Object first = CorporaView.getFirstSelectedObject();
52 52
			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
53
				System.out.println(NLS.bind(Messages.ExportTEICorpus_0, first));
53
				Log.warning(NLS.bind(Messages.ExportTEICorpus_0, first));
54 54
				return null;
55 55
			}
56 56
			
......
65 65
					try {
66 66
						this.runInit(monitor);
67 67
						if (!export(true, outputDirectory, createArchive, monitor, mainCorpus, analecCorpus, vue, copyXMLTXMFiles)) {
68
							System.out.println(Messages.ExportTEICorpus_2);
68
							Log.warning(Messages.ExportTEICorpus_2);
69 69
							return Status.CANCEL_STATUS;
70 70
						} else {
71 71
							return Status.OK_STATUS;
72 72
						}
73 73
					} catch (Exception e) {
74
						System.out.println(NLS.bind(Messages.ExportTEICorpus_3, e.getLocalizedMessage()));
74
						Log.warning(NLS.bind(Messages.ExportTEICorpus_3, e.getLocalizedMessage()));
75 75
						Log.printStackTrace(e);
76 76
						return Status.CANCEL_STATUS;
77 77
					}
......
80 80
			job.schedule();
81 81
			
82 82
		} catch (Exception e) {
83
			System.out.println(NLS.bind(Messages.ExportTEICorpus_3, e.getLocalizedMessage()));
83
			Log.warning(NLS.bind(Messages.ExportTEICorpus_3, e.getLocalizedMessage()));
84 84
			Log.printStackTrace(e);
85 85
		}
86 86
		return null;
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/DoInstallStep.java (revision 3402)
45 45
				return; // nothing to do
46 46
			}
47 47
		}
48
		System.out.println(NLS.bind(Messages.DoInstallStep_6, currentVersion));
48
		Log.info(NLS.bind(Messages.DoInstallStep_6, currentVersion));
49 49
		
50 50
		File previousURSMacroDirectory = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/macro/analec"); //$NON-NLS-1$
51 51
		if (previousURSMacroDirectory.exists() && saved != null && saved.length() > 0) {
52 52
			File back = new File(previousURSMacroDirectory.getParentFile(), "urs_"+saved); //$NON-NLS-1$
53 53
			if (back.exists()) {
54
				System.out.println(NLS.bind(Messages.DoInstallStep_9, back.getAbsolutePath()));
54
				Log.info(NLS.bind(Messages.DoInstallStep_9, back.getAbsolutePath()));
55 55
				return;
56 56
			}
57 57
			previousURSMacroDirectory.renameTo(back);
58
			System.out.println(NLS.bind(Messages.DoInstallStep_11, back.getAbsolutePath()));
58
			Log.info(NLS.bind(Messages.DoInstallStep_11, back.getAbsolutePath()));
59 59
		}
60 60
		
61 61
		File macroDirectory = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/macro/analec"); //$NON-NLS-1$
62 62
		if (!BundleUtils.copyFiles("org.txm.annotation.urs.rcp", "src", "org/txm/macro/", "urs", macroDirectory, true)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
63
			System.out.println(NLS.bind(Messages.DoInstallStep_17, macroDirectory.getAbsolutePath()));
63
			Log.warning(NLS.bind(Messages.DoInstallStep_17, macroDirectory.getAbsolutePath()));
64 64
			return;
65 65
		}
66 66
		
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportTEIAnnotations.java (revision 3402)
49 49

  
50 50
			Object first = CorporaView.getFirstSelectedObject();
51 51
			if (!(first instanceof org.txm.searchengine.cqp.corpus.CQPCorpus)) {
52
				System.out.println(NLS.bind(Messages.ImportTEIAnnotations_0, first));
52
				Log.warning(NLS.bind(Messages.ImportTEIAnnotations_0, first));
53 53
				return null;
54 54
			}
55 55
			
......
67 67
						}
68 68
						
69 69
						if (!importer(monitor, directory, aamFile, true, mainCorpus, analecCorpus, vue)) {
70
							System.out.println(Messages.ImportTEIAnnotations_2);
70
							Log.warning(Messages.ImportTEIAnnotations_2);
71 71
							return Status.CANCEL_STATUS;
72 72
						} else {
73 73
							return Status.OK_STATUS;
74 74
						}
75 75
					} catch (Throwable e) {
76
						System.out.println(NLS.bind(Messages.ImportTEIAnnotations_3, e.getLocalizedMessage()));
76
						Log.warning(NLS.bind(Messages.ImportTEIAnnotations_3, e.getLocalizedMessage()));
77 77
						Log.printStackTrace(e);
78 78
						return Status.CANCEL_STATUS;
79 79
					}
......
82 82
			job.schedule();
83 83
			
84 84
		} catch (Exception e) {
85
			System.out.println(NLS.bind(Messages.ImportTEIAnnotations_3, e.getLocalizedMessage()));
85
			Log.warning(NLS.bind(Messages.ImportTEIAnnotations_3, e.getLocalizedMessage()));
86 86
			Log.printStackTrace(e);
87 87
		}
88 88
		return null;
......
128 128
		boolean ret = importer.process();
129 129
		
130 130
		if (ret) {
131
			System.out.println(TXMCoreMessages.bind(Messages.ImportTEIAnnotations_5, analecCorpus.getToutesUnites().size(), analecCorpus.getToutesRelations().size(), analecCorpus.getTousSchemas().size()));
131
			Log.info(TXMCoreMessages.bind(Messages.ImportTEIAnnotations_5, analecCorpus.getToutesUnites().size(), analecCorpus.getToutesRelations().size(), analecCorpus.getTousSchemas().size()));
132 132
			mainCorpus.setIsModified(true);
133 133
			CorporaView.refreshObject(mainCorpus);
134 134
		}
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/commands/ImportGlozzCorpus.java (revision 3402)
67 67
			
68 68
			// END OF PARAMETERS
69 69
			if (!glozzDirectory.exists()) {
70
				System.out.println(Messages.ImportGlozzCorpus_0);
70
				Log.warning(Messages.ImportGlozzCorpus_0);
71 71
				return null;
72 72
			}
73 73
			
......
84 84
			}
85 85
			
86 86
			final File srcDir = new File(glozzDirectory, name);
87
			System.out.println(NLS.bind(Messages.ImportGlozzCorpus_1, srcDir));
87
			Log.info(NLS.bind(Messages.ImportGlozzCorpus_1, srcDir));
88 88
			DeleteDir.deleteDirectory(srcDir);
89 89
			srcDir.mkdir();
90 90
			
91 91
			final File ecDir = new File(glozzDirectory, "ec"); //$NON-NLS-1$
92
			System.out.println(NLS.bind(Messages.ImportGlozzCorpus_3, ecDir));
92
			Log.info(NLS.bind(Messages.ImportGlozzCorpus_3, ecDir));
93 93
			DeleteDir.deleteDirectory(ecDir);
94 94
			ecDir.mkdir();
95 95
			
96 96
			
97 97
			if (!srcDir.exists()) {
98
				System.out.println(Messages.ImportGlozzCorpus_4);
98
				Log.warning(Messages.ImportGlozzCorpus_4);
99 99
				return null;
100 100
			}
101 101
			
102 102
			if (!ecDir.exists()) {
103
				System.out.println(Messages.ImportGlozzCorpus_5);
103
				Log.warning(Messages.ImportGlozzCorpus_5);
104 104
				return null;
105 105
			}
106 106
			
......
121 121
			});
122 122
			
123 123
			if (aaFiles == null || aaFiles.length == 0) {
124
				System.out.println(NLS.bind(Messages.ImportGlozzCorpus_8, glozzDirectory));
124
				Log.warning(NLS.bind(Messages.ImportGlozzCorpus_8, glozzDirectory));
125 125
				return false;
126 126
			}
127 127
			if (acFiles == null || acFiles.length == 0) {
128
				System.out.println(NLS.bind(Messages.ImportGlozzCorpus_9, glozzDirectory));
128
				Log.warning(NLS.bind(Messages.ImportGlozzCorpus_9, glozzDirectory));
129 129
				return false;
130 130
			}
131 131
			if (aaFiles.length != acFiles.length) {
132
				System.out.println(NLS.bind(Messages.ImportGlozzCorpus_10, glozzDirectory));
132
				Log.warning(NLS.bind(Messages.ImportGlozzCorpus_10, glozzDirectory));
133 133
				return false;
134 134
			}
135 135
			
136
			System.out.println(NLS.bind(Messages.ImportGlozzCorpus_11, glozzDirectory));
136
			Log.info(NLS.bind(Messages.ImportGlozzCorpus_11, glozzDirectory));
137 137
			Arrays.sort(acFiles);
138 138
			Arrays.sort(aaFiles);
139 139
			for (int i = 0; i < aaFiles.length; i++) {
......
148 148
				Corpus tmpAnalecCorpus = new Corpus(); // need a temporary corpus
149 149
				
150 150
				if (!FichiersGlozz.importerGlozz(tmpAnalecCorpus, acFile, aaFile)) {
151
					System.out.println(Messages.ImportGlozzCorpus_15);
151
					Log.warning(Messages.ImportGlozzCorpus_15);
152 152
					return null;
153 153
				}
154 154
				
......
165 165
				FichiersJava.enregistrerCorpus(tmpAnalecCorpus, ecFile); // write for later
166 166
				
167 167
				if (!txtFile.exists()) {
168
					System.out.println(Messages.ImportGlozzCorpus_17);
168
					Log.warning(Messages.ImportGlozzCorpus_17);
169 169
					return null;
170 170
				}
171 171
			}
......
183 183
			
184 184
			JobHandler job = ExecuteImportScript.executeScript(project);
185 185
			if (job == null) { // job is scheduled in ExecuteImportScript.executeScript
186
				System.out.println(Messages.ImportGlozzCorpus_23);
186
				Log.warning(Messages.ImportGlozzCorpus_23);
187 187
				return null;
188 188
			}
189 189
			
......
194 194
					try {
195 195
						MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
196 196
						if (corpus == null) {
197
							System.out.println("The CQP corpus was not created. Aborting.");
197
							Log.warning("The CQP corpus was not created. Aborting.");
198 198
							return Status.CANCEL_STATUS;
199 199
						}
200 200
						corpus.compute(false);
......
206 206
							FichiersJava.concatener(ecFile, analecCorpus);
207 207
						}
208 208
						
209
						System.out.println(NLS.bind(Messages.ImportGlozzCorpus_25, aamfile));
209
						Log.info(NLS.bind(Messages.ImportGlozzCorpus_25, aamfile));
210 210
						if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamfile)) {
211
							System.out.println(Messages.ImportGlozzCorpus_26);
211
							Log.warning(Messages.ImportGlozzCorpus_26);
212 212
							return Status.CANCEL_STATUS;
213 213
						}
214 214
						//
......
218 218
						// return null;
219 219
						// }
220 220
						
221
						System.out.println(Messages.ImportGlozzCorpus_27);
221
						Log.info(Messages.ImportGlozzCorpus_27);
222 222
						URSCorpora.removeCorpus(corpus); // remove old corpus if any
223 223
						
224 224
						URSAnnotationReIndexer aari = new URSAnnotationReIndexer(corpus, analecCorpus);
225 225
						if (!aari.process()) {
226
							System.out.println(Messages.ImportGlozzCorpus_28);
226
							Log.warning(Messages.ImportGlozzCorpus_28);
227 227
							return Status.CANCEL_STATUS;
228 228
						}
229 229
						
230
						System.out.println(Messages.ImportGlozzCorpus_29);
230
						Log.info(Messages.ImportGlozzCorpus_29);
231 231
						URSCorpora.saveCorpus(analecCorpus);
232 232
						URSCorpora.getVue(analecCorpus).retablirVueParDefaut();
233
						System.out.println(Messages.ImportGlozzCorpus_30);
233
						Log.info(Messages.ImportGlozzCorpus_30);
234 234
						analecCorpus.setTexte(""); // free memory //$NON-NLS-1$
235 235
						DeleteDir.deleteDirectory(ecDir); // cleaning
236 236
						DeleteDir.deleteDirectory(srcDir); // cleaning
......
238 238
						return Status.OK_STATUS;
239 239
					}
240 240
					catch (Exception e) {
241
						System.out.println(NLS.bind(Messages.ImportGlozzCorpus_32, e.getLocalizedMessage()));
241
						Log.warning(NLS.bind(Messages.ImportGlozzCorpus_32, e.getLocalizedMessage()));
242 242
						Log.printStackTrace(e);
243 243
						return Status.CANCEL_STATUS;
244 244
					}
TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/edition/EditionAnnotations.java (revision 3402)
6 6
import java.util.List;
7 7
import java.util.TreeMap;
8 8

  
9
import org.eclipse.osgi.util.NLS;
9 10
import org.txm.annotation.kr.core.Annotation;
10 11
import org.txm.annotation.kr.core.AnnotationManager;
11 12
import org.txm.annotation.kr.core.KRAnnotationEngine;
......
208 209
				annotationsPerMatch = am.getAnnotationsForMatches(viewAnnotation, subsetMatch, overlapAnnotation);
209 210
				//System.out.println("annotationsPerMatch: "+annotationsPerMatch);
210 211
			} catch (Exception e) {
211
				System.out.println("Error while reading annotation "+viewAnnotation+" and with "+subsetMatch.size()+" matches");
212
				Log.warning(NLS.bind("Error while reading annotation {0} and with {1} matches", viewAnnotation, subsetMatch.size()));
212 213
				Log.printStackTrace(e);
213 214
			}
214 215
		}
TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/edition/WordAnnotationToolbar.java (revision 3402)
178 178
	protected void affectAnnotationValues(final List<? extends Match> matches, final AnnotationType type, final String svalue, JobHandler job) {
179 179
		value_to_add = null; // reset
180 180
		if (matches == null || matches.size() == 0) {
181
			System.out.println("No line selected. Aborting."); //$NON-NLS-1$
181
			Log.warning("No line selected. Aborting.");
182 182
			return;
183 183
		}
184 184
		if (type == null) return; // no type, no annotation
......
194 194
							NLS.bind(KRAnnotationUIMessages.youAreAboutToAnnotateP0ElementsContinue, matches.size()));
195 195
					
196 196
					if (dialog.open() == ConfirmDialog.CANCEL) {
197
						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
197
						Log.info("Annotation aborted by user.");
198 198
						matches.clear();
199 199
					}
200 200
				}
......
217 217
				@Override
218 218
				public void run() {
219 219
					String mess = KRAnnotationUIMessages.bind(KRAnnotationUIMessages.noValueFoundWithTheP0Id, svalue);
220
					System.out.println(mess);
221
					MessageDialog.openError(Display.getCurrent().getActiveShell(), "Annotation canceled", mess); //$NON-NLS-1$
220
					Log.warning(mess);
221
					MessageDialog.openError(Display.getCurrent().getActiveShell(), "Annotation canceled", mess);
222 222
				}
223 223
			});
224 224
			return;
......
263 263
			// concordance.reloadCurrentLines();
264 264
		}
265 265
		catch (Exception e1) {
266
			System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileAffectionAnnotationColonP0, e1));
266
			Log.warning(NLS.bind(KRAnnotationUIMessages.errorWhileAffectionAnnotationColonP0, e1));
267 267
			Log.printStackTrace(e1);
268 268
			return;
269 269
		}
......
317 317
					return Status.CANCEL_STATUS;
318 318
				}
319 319
				catch (ThreadDeath td) {
320
					System.out.println(KRAnnotationUIMessages.annotationCanceledByUser);
320
					Log.info(KRAnnotationUIMessages.annotationCanceledByUser);
321 321
					return Status.CANCEL_STATUS;
322 322
				}
323 323
				
......
330 330
	protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {
331 331
		
332 332
		if (matches.size() == 0) {
333
			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
333
			Log.warning("No lines selected. Aborting.");
334 334
			return;
335 335
		}
336 336
		
......
348 348
			}
349 349
		}
350 350
		catch (Exception e1) {
351
			System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
351
			Log.warning(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
352 352
			Log.printStackTrace(e1);
353 353
			return;
354 354
		}
......
361 361
					editor.refresh(false);
362 362
				}
363 363
				catch (Exception e) {
364
					// TODO Auto-generated catch block
365
					e.printStackTrace();
364
					Log.printStackTrace(e);
366 365
				}
367 366
			}
368 367
		});
......
386 385
					return Status.CANCEL_STATUS;
387 386
				}
388 387
				catch (ThreadDeath td) {
389
					System.out.println(KRAnnotationUIMessages.annotationCanceledByUser);
388
					Log.info(KRAnnotationUIMessages.annotationCanceledByUser);
390 389
					return Status.CANCEL_STATUS;
391 390
				}
392 391
				
......
581 580
					updateAnnotationWidgetStates();
582 581
				}
583 582
				else {
584
					System.out.println("Creation aborted."); //$NON-NLS-1$
583
					Log.info("Creation aborted.");
585 584
				}
586 585
			}
587 586
			
......
799 798
			// onAnnotationTypeSelected(null);
800 799
		}
801 800
		else {
802
			System.out.println("Creation aborted."); //$NON-NLS-1$
801
			Log.info("Creation aborted.");
803 802
		}
804 803
	}
805 804
	
......
812 811
				// ?")
813 812
				JobHandler saveJob = SaveAnnotations.save(WordAnnotationToolbar.this.corpus.getMainCorpus());
814 813
				if (saveJob == null || saveJob.getResult() == Status.CANCEL_STATUS) {
815
					// update editor corpus
816
					System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
814
					Log.warning("Fail to save annotations of the corpus.");
817 815
					return false;
818 816
				}
819 817
				else {
TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/views/knowledgerepositories/KRView.java (revision 3402)
277 277
					try {
278 278
						return krl.getValues(t).toArray();
279 279
					} catch (Exception e) {
280
						System.out.println("Error while reading KR values: "+kr+ " for type="+t);
280
						Log.warning(NLS.bind("Error while reading the {0} KR values for the {1} type.", kr, t));
281 281
						Log.printStackTrace(e);
282 282
					}
283 283
				}
......
321 321
					try {
322 322
						return krl.hasValues(t);
323 323
					} catch (Exception e) {
324
						System.out.println("Error while reading KR values: "+krl+ " for type="+t);
324
						Log.warning(NLS.bind("Error while reading the {0} KR values for the {1} type.", kr, t));
325 325
						Log.printStackTrace(e);
326 326
					}
327 327
				}
TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/ConcordanceAnnotations.java (revision 3402)
6 6
import java.util.List;
7 7
import java.util.TreeMap;
8 8

  
9
import org.eclipse.osgi.util.NLS;
9 10
import org.txm.annotation.kr.core.Annotation;
10 11
import org.txm.annotation.kr.core.AnnotationManager;
11 12
import org.txm.annotation.kr.core.KRAnnotationEngine;
......
198 199
				annotationsPerMatch = am.getAnnotationsForMatches(viewAnnotation, subsetMatch, overlapAnnotation);
199 200
				//System.out.println("annotationsPerMatch: "+annotationsPerMatch);
200 201
			} catch (Exception e) {
201
				System.out.println("Error while reading annotation "+viewAnnotation+" and with "+subsetMatch.size()+" matches");
202
				Log.warning(NLS.bind("Error while reading annotation {0} and with {1} matches", viewAnnotation, subsetMatch.size()));
202 203
				Log.printStackTrace(e);
203 204
			}
204 205
		}
TXM/trunk/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 3402)
441 441
					return Status.CANCEL_STATUS;
442 442
				}
443 443
				catch (ThreadDeath td) {
444
					System.out.println(KRAnnotationUIMessages.annotationCanceledByUser);
444
					Log.info(KRAnnotationUIMessages.annotationCanceledByUser);
445 445
					return Status.CANCEL_STATUS;
446 446
				}
447 447
				
......
496 496
	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
497 497
		
498 498
		if (matches.size() == 0) {
499
			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
499
			Log.warning("No lines selected. Aborting.");
500 500
			return;
501 501
		}
502 502
		
......
514 514
			}
515 515
		}
516 516
		catch (Exception e1) {
517
			System.out.println(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
517
			Log.warning(NLS.bind(KRAnnotationUIMessages.errorWhileDeletingAnnotationColonP0, e1));
518 518
			Log.printStackTrace(e1);
519 519
			return;
520 520
		}
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff