Révision 3821

TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/messages.properties (revision 3821)
5 5

  
6 6
AnalecPreferencePage_9 = Unit highlight color palette
7 7

  
8
Annotation=Annotation
8 9
AnnotationToolbar_0 = No selection found. Aborting.
9 10

  
10 11
AnnotationToolbar_6 = ** QueryResult matches size is {0}
......
26 27
DoInstallStep_9 = URS previous macro backup directory already exists: {0}. Aborting
27 28

  
28 29
EditStructure_0 = Selection is not a corpus: {0}
30
ErrorCannotFindWordsPositionsforUnitOfTypeP0AndP1P2=Error: cannot find words positions for unit of type={0}  and unit carret positions=[{1},{2}] ]. Aborting
31
ErrorTheCQPCorpusIsEmptyKa=Error: The CQP corpus is empty ?
29 32

  
30 33
ExportGlozzCorpus_0 = Selection is not a main corpus: {0}
31 34

  
......
196 199
NavigationField_4 = Search units by properties
197 200

  
198 201
NavigationField_5 = <identifier>
202
RelationsHTML=<p>Relations</p>\n
199 203

  
200 204
SaveCorpus_0 = Selection is not a main corpus ({0})
201 205

  
......
222 226
SaveVue_3 = Saving the {0} corpus vue at {1} 
223 227

  
224 228
SaveVue_5 = Error while saving the vue.
229
SchemasHTML=<p>Schemas</p>\n
225 230

  
226 231
StartButton_0 = Units
227 232

  
......
234 239
StartButton_4 = Error: corpus not saved.
235 240

  
236 241
StartButton_5 = Done.
242
StructureHTML=<h4>Structure</h4>\n
237 243

  
238 244
URSCorpora_3 = Fail to open corpus file: {0}
245
URSCorpora_3=
239 246

  
240 247
URSCorpora_4 = Fail to create corpus file: {0} 
248
URSCorpora_4=
249
URSInformationsHTML=<h3>URS informations</h3>\n
241 250

  
251
UnitsHTML=<p>Units</p>\n
242 252
UnitToolbar_10 = Delete
243 253

  
244 254
UnitToolbar_12 = Click to fix the left limit
......
274 284
UnitToolbar_7 = Unit type
275 285

  
276 286
UnitToolbar_8 = Create
287
WarningFailToCreateCorpusVueFileP0=Warning: Fail to create corpus Vue file: 
288
WarningFailToOpenCorpusVueFileP0=Warning: Fail to open corpus Vue file: 
TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/InstallURSFiles.java (revision 3821)
46 46
		for (String folder : createfolders) {
47 47
			new File(txmhomedir, folder).mkdirs();
48 48
		}
49
		File scriptsDirectory = new File(txmhomedir, "scripts/groovy");
50
		File userDirectory = new File(scriptsDirectory, "user");
51
		File systemDirectory = new File(scriptsDirectory, "system");
52
		File macroDirectory = new File(userDirectory, "org/txm/macro");
53
		File macroDirectory2 = new File(systemDirectory, "org/txm/macro");
54
		File URSMacroDirectory = new File(macroDirectory, "urs");
55
		File URSMacroDirectory2 = new File(systemDirectory, "org/txm/macro/urs");
49
		File scriptsDirectory = new File(txmhomedir, "scripts/groovy"); //$NON-NLS-1$
50
		File userDirectory = new File(scriptsDirectory, "user"); //$NON-NLS-1$
51
		File systemDirectory = new File(scriptsDirectory, "system"); //$NON-NLS-1$
52
		File macroDirectory = new File(userDirectory, "org/txm/macro"); //$NON-NLS-1$
53
		File macroDirectory2 = new File(systemDirectory, "org/txm/macro"); //$NON-NLS-1$
54
		File URSMacroDirectory = new File(macroDirectory, "urs"); //$NON-NLS-1$
55
		File URSMacroDirectory2 = new File(systemDirectory, "org/txm/macro/urs"); //$NON-NLS-1$
56 56
		
57
		String bundle_id = "org.txm.annotation.urs.rcp";
57
		String bundle_id = "org.txm.annotation.urs.rcp"; //$NON-NLS-1$
58 58
		
59 59
		if (URSMacroDirectory.exists()) {
60 60
//			long time = URSMacroDirectory.lastModified();
......
69 69
		}
70 70

  
71 71
		
72
		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory, true);
73
		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory2, true);
72
		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
73
		BundleUtils.copyFiles(bundle_id, "src/", "org/txm/macro", "urs", macroDirectory2, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
74 74

  
75 75
		// saving current version
76 76
//		URSPreferences.getInstance().put(URSPreferences.VERSION, currentVersion.toString());
......
80 80

  
81 81
	@Override
82 82
	public String getName() {
83
		return "URS Annotation";
83
		return "URS Annotation"; //$NON-NLS-1$
84 84
	}
85 85
	
86 86
	@Override
TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/URSCorpora.java (revision 3821)
78 78
			// TODO: does not work :(
79 79
			if (fichierVue.exists()) {
80 80
				if (!FichiersJava.ouvrirVue(vue, fichierVue)) {
81
					Log.warning("Warning: Fail to open corpus Vue file: " + fichierVue);
81
					Log.warning(Messages.WarningFailToOpenCorpusVueFileP0 + fichierVue);
82 82
					// return null;
83 83
				}
84 84
				String[] types = vue.getTypesUnitesAVoir();
......
89 89
			else {
90 90
				vue.retablirVueParDefaut(); //
91 91
				if (!FichiersJava.enregistrerVue(vue, fichierVue)) {
92
					Log.warning("Warning: Fail to create corpus Vue file: " + fichierVue);
92
					Log.warning(Messages.WarningFailToCreateCorpusVueFileP0 + fichierVue);
93 93
					// return null;
94 94
				}
95 95
			}
......
227 227
	
228 228
	@Override
229 229
	public void notify(TXMResult r, String state) {
230
		if (r instanceof CorpusBuild && "clean".equals(state)) { // $NON-NLS
230
		if (r instanceof CorpusBuild && "clean".equals(state)) { // $NON-NLS //$NON-NLS-1$
231 231
			CorpusBuild mcorpus = (CorpusBuild) r;
232 232
			mcorpus = mcorpus.getRootCorpusBuild(); // ensure this is the root CorpusBuild
233 233
			
......
245 245
		}
246 246
		else if (r instanceof Project) {
247 247
			Project project = ((Project) r);
248
			if ("clean".equals(state)) {
249
				File analecDir = new File(project.getProjectDirectory(), "analec"); //$NON-NLS
248
			if ("clean".equals(state)) { //$NON-NLS-1$
249
				File analecDir = new File(project.getProjectDirectory(), "analec"); //$NON-NLS //$NON-NLS-1$
250 250
				if (analecDir.exists()) {
251 251
					DeleteDir.deleteDirectory(analecDir);
252 252
				}
253 253
			}
254
			else if ("save".equals(state)) {
254
			else if ("save".equals(state)) { //$NON-NLS-1$
255 255
				for (TXMResult c : project.getChildren(CorpusBuild.class)) {
256 256
					URSCorpora.saveCorpus((CorpusBuild) c);
257 257
				}
......
261 261
	
262 262
	@Override
263 263
	public String getName() {
264
		return "URS";
264
		return "URS"; //$NON-NLS-1$
265 265
	}
266 266
	
267 267
	@Override
......
319 319
	
320 320
	public String hasAdditionalDetailsForResult(TXMResult result) {
321 321
		if (result instanceof MainCorpus) {
322
			return hasCorpus((MainCorpus)result)?"Annotation":null;	
322
			return hasCorpus((MainCorpus)result)?Messages.Annotation:null;	
323 323
		}
324 324
		return null;
325 325
	}
......
330 330
			Corpus acorpus = getCorpus((MainCorpus)result);
331 331
			
332 332
			StringBuilder buffer = new StringBuilder();
333
			buffer.append("<h3>URS informations</h3>\n");
334
			buffer.append("<h4>Structure</h4>\n");
335
			buffer.append("<p>Units</p>\n");
333
			buffer.append(Messages.URSInformationsHTML);
334
			buffer.append(Messages.StructureHTML);
335
			buffer.append(Messages.UnitsHTML);
336 336
			Structure s = acorpus.getStructure();
337 337
			for (String u : s.getUnites()) {
338
				buffer.append("<p>"+u+": "+StringUtils.join(s.getUniteProperties(u), ", ")+"</p>\n");
338
				buffer.append("<p>"+u+": "+StringUtils.join(s.getUniteProperties(u), ", ")+"</p>\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
339 339
			}
340
			buffer.append("<p>Relations</p>\n");
340
			buffer.append(Messages.RelationsHTML);
341 341
			for (String u : s.getRelations()) {
342
				buffer.append("<p>"+u+": "+StringUtils.join(s.getRelationProperties(u), ", ")+"</p>\n");
342
				buffer.append("<p>"+u+": "+StringUtils.join(s.getRelationProperties(u), ", ")+"</p>\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
343 343
			}
344
			buffer.append("<p>Schemas</p>\n");
344
			buffer.append(Messages.SchemasHTML);
345 345
			for (String u : s.getSchemas()) {
346
				buffer.append("<p>"+u+": "+StringUtils.join(s.getSchemaProperties(u), ", ")+"</p>\n");
346
				buffer.append("<p>"+u+": "+StringUtils.join(s.getSchemaProperties(u), ", ")+"</p>\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
347 347
			}
348 348
			//buffer.append("<p>Name: "+acorpus.getStructure()+"</p>\n");
349 349
			
TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/Messages.java (revision 3821)
7 7

  
8 8
	public static String URSCorpora_3;
9 9
	public static String URSCorpora_4;
10
	public static String URSInformationsHTML;
10 11
	
11 12
	public static String DoInstallStep_11;
12 13
	public static String DoInstallStep_17;
......
16 17
	public static String DoInstallStep_6;
17 18
	public static String DoInstallStep_9;
18 19
	public static String EditStructure_0;
20
	public static String ErrorCannotFindWordsPositionsforUnitOfTypeP0AndP1P2;
21
	public static String ErrorTheCQPCorpusIsEmptyKa;
19 22
	public static String ExportGlozzCorpus_0;
20 23
	public static String ExportGlozzCorpus_1;
21 24
	public static String ExportGlozzCorpus_2;
......
110 113
	public static String SaveVue_0;
111 114
	public static String SaveVue_3;
112 115
	public static String SaveVue_5;
116
	public static String SchemasHTML;
113 117
	
114 118
	public static String AnalecPreferencePage_3;
115 119
	public static String AnalecPreferencePage_4;
116 120
	public static String AnalecPreferencePage_9;
117 121
	
122
	public static String Annotation;
118 123
	public static String AnnotationToolbar_0;
119 124
	public static String AnnotationToolbar_6;
120 125
	public static String AnnotationToolbar_7;
126
	public static String UnitsHTML;
121 127
	public static String UnitToolbar_10;
122 128
	public static String UnitToolbar_12;
123 129
	public static String UnitToolbar_14;
......
143 149
	public static String StartButton_12;
144 150
	public static String StartButton_4;
145 151
	public static String StartButton_5;
152
	public static String StructureHTML;
146 153
	
147 154
	public static String NavigationField_0;
148 155
	public static String NavigationField_2;
149 156
	public static String NavigationField_4;
150 157
	public static String NavigationField_5;
158
	public static String RelationsHTML;
151 159
	
160
	public static String WarningFailToCreateCorpusVueFileP0;
161
	public static String WarningFailToOpenCorpusVueFileP0;
162

  
152 163
	static {
153 164
		// initialize resource bundle
154 165
		Utf8NLS.initializeMessages(Messages.class);
TXM/trunk/bundles/org.txm.analec.rcp/src/org/txm/annotation/urs/URSAnnotationReIndexer.java (revision 3821)
46 46
		
47 47
		int corpusSize = corpus.getSize();
48 48
		if (corpusSize == 0) {
49
			Log.warning("Error: The CQP corpus is empty ?");
49
			Log.warning(Messages.ErrorTheCQPCorpusIsEmptyKa);
50 50
			return false;
51 51
		}
52 52
		String text = analecCorpus.getTexte();
53 53
		int isearch = 0; // the current search start position
54 54
		
55 55
		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
56
		Property word = corpus.getProperty("word");
56
		Property word = corpus.getProperty("word"); //$NON-NLS-1$
57 57
		
58 58
		int positions[] = new int[corpusSize];
59 59
		for (int i = 0; i < corpusSize; i++) {
......
66 66
		for (int i = 0; i < corpusSize; i++) {
67 67
			int idx = text.indexOf(strs[i], isearch);
68 68
			if (idx < 0) {
69
				Log.finer("Error: cannot find word='" + strs[i] + "' (word with position in CQP corpus=" + positions[i] + ") in text with current carret=" + isearch + ". Aborting.");
69
				Log.finer("Error: cannot find word='" + strs[i] + "' (word with position in CQP corpus=" + positions[i] + ") in text with current carret=" + isearch + ". Aborting."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
70 70
				
71
				Log.finer("Current text slice is (-20, +20 characters): ");
72
				Log.finer("* before: " + text.substring(Math.max(0, isearch - 20), Math.min(isearch + 20, isearch)));
73
				Log.finer("* after: " + text.substring(isearch, Math.min(isearch + 20, text.length() - 1)));
71
				Log.finer("Current text slice is (-20, +20 characters): "); //$NON-NLS-1$
72
				Log.finer("* before: " + text.substring(Math.max(0, isearch - 20), Math.min(isearch + 20, isearch))); //$NON-NLS-1$
73
				Log.finer("* after: " + text.substring(isearch, Math.min(isearch + 20, text.length() - 1))); //$NON-NLS-1$
74 74
				
75 75
				return false;
76 76
			}
......
83 83
		
84 84
		isearch = 0;
85 85
		ArrayList<Unite> unites = analecCorpus.getToutesUnites();
86
		if (debug) Log.finer("units not-sorted: ");
86
		if (debug) Log.finer("units not-sorted: "); //$NON-NLS-1$
87 87
		if (debug) printUnits(unites);
88 88
		Collections.sort(unites, new Comparator<Unite>() {
89 89
			
......
94 94
				else return d;
95 95
			}
96 96
		});
97
		if (debug) Log.finer("units sorted: ");
97
		if (debug) Log.finer("units sorted: "); //$NON-NLS-1$
98 98
		if (debug) printUnits(unites);
99 99
		
100 100
		int iunite = 0;
101 101
		for (Unite unite : unites) {
102
			if (debug) Log.finer("Updating ");
102
			if (debug) Log.finer("Updating "); //$NON-NLS-1$
103 103
			if (debug) printUnite(unite);
104 104
			int start = unite.getDeb();
105 105
			int end = unite.getFin();
......
109 109
			int i = 0; // or not : unites are sorted by start position, we don't need to browse all words \o/
110 110
			for (; i < positionsCorrespondances.length; i++) {
111 111
				if (startFound && endFound) break; // no need to go further
112
				if (debug) Log.finer("i=" + i + " positionsCorrespondances[i]=" + positionsCorrespondances[i]);
112
				if (debug) Log.finer("i=" + i + " positionsCorrespondances[i]=" + positionsCorrespondances[i]); //$NON-NLS-1$ //$NON-NLS-2$
113 113
				if (!startFound && start < positionsCorrespondances[i]) {
114 114
					unite.setDeb(i - 1);
115 115
					startFound = true;
......
130 130
			}
131 131
			
132 132
			if (!(startFound && endFound)) {
133
				String s = "Error: cannot find words positions for unite of type=" + unite.getType() + " and unit carret positions=[" + start + ", " + end + "]. Aborting";
133
				String s = Messages.ErrorCannotFindWordsPositionsforUnitOfTypeP0AndP1P2 + unite.getType() + " and unit carret positions=[" + start + ", " + end + "]. Aborting"; //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
134 134
				Log.finer(s);
135 135
				
136
				Log.finer("5 last found units are: ");
136
				Log.finer("5 last found units are: "); //$NON-NLS-1$
137 137
				for (int j = 4; j >= 0; j--) {
138 138
					if (iunite - j >= 0) {
139 139
						printUnite(unites.get(iunite - j));
......
144 144
			// if (i > 0) i--; // restart at previous word
145 145
			iunite++;
146 146
		}
147
		if (debug) Log.finer("units updated: ");
147
		if (debug) Log.finer("units updated: "); //$NON-NLS-1$
148 148
		if (debug) printUnits(unites);
149 149
		return true;
150 150
	}
151 151
	
152 152
	public static void printUnite(Unite unite) {
153
		System.out.print(unite.getType() + "[" + unite.getDeb() + ", " + unite.getFin() + "]");
153
		System.out.print(unite.getType() + "[" + unite.getDeb() + ", " + unite.getFin() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
154 154
	}
155 155
	
156 156
	public static void printUnits(List<Unite> units) {
157 157
		int i = 0;
158 158
		for (Unite u : units) {
159
			if (i > 0) System.out.print(", ");
159
			if (i > 0) System.out.print(", "); //$NON-NLS-1$
160 160
			printUnite(u);
161 161
			i++;
162 162
		}

Formats disponibles : Unified diff