Revision 2926

tmp/TXMBetaPlugins.site/site.xml (revision 2926)
3 3
   <description name="TXM Extensions - RELEASE" url="https://gitlab.huma-num.fr/txm/txm-software/-/raw/master/dist/0.8.1/ext/beta">
4 4
      This update site contains the BETA extensions for TXM
5 5
   </description>
6
   <feature url="features/org.txm.annotation.feature_1.0.0.202004141145.jar" id="org.txm.annotation.feature" version="1.0.0.202004141145">
6
   <feature url="features/org.txm.annotation.feature_1.0.0.202006261406.jar" id="org.txm.annotation.feature" version="1.0.0.202006261406">
7 7
      <category name="ALL"/>
8 8
   </feature>
9
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202004141145.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202004141145">
9
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202006261406.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202006261406">
10 10
      <category name="ALL"/>
11 11
   </feature>
12
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202004141145.jar" id="org.txm.backtomedia.feature" version="1.0.0.202004141145" os="">
12
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202006261406.jar" id="org.txm.backtomedia.feature" version="1.0.0.202006261406" os="">
13 13
      <category name="ALL"/>
14 14
   </feature>
15
   <feature url="features/org.txm.conllu.feature_1.0.0.202004141145.jar" id="org.txm.conllu.feature" version="1.0.0.202004141145">
15
   <feature url="features/org.txm.conllu.feature_1.0.0.202006261406.jar" id="org.txm.conllu.feature" version="1.0.0.202006261406">
16 16
      <category name="ALL"/>
17 17
   </feature>
18
   <feature url="features/org.txm.cql2lsa.feature_1.0.0.202004141145.jar" id="org.txm.cql2lsa.feature" version="1.0.0.202004141145">
18
   <feature url="features/org.txm.cql2lsa.feature_1.0.0.202006261406.jar" id="org.txm.cql2lsa.feature" version="1.0.0.202006261406">
19 19
      <category name="ALL"/>
20 20
   </feature>
21
   <feature url="features/org.txm.dictionary.feature_1.0.0.202004141145.jar" id="org.txm.dictionary.feature" version="1.0.0.202004141145">
21
   <feature url="features/org.txm.dictionary.feature_1.0.0.202006261406.jar" id="org.txm.dictionary.feature" version="1.0.0.202006261406">
22 22
      <category name="ALL"/>
23 23
   </feature>
24
   <feature url="features/org.txm.internalview.feature_1.0.0.202004141145.jar" id="org.txm.internalview.feature" version="1.0.0.202004141145">
24
   <feature url="features/org.txm.internalview.feature_1.0.0.202006261406.jar" id="org.txm.internalview.feature" version="1.0.0.202006261406">
25 25
      <category name="ALL"/>
26 26
   </feature>
27
   <feature url="features/org.txm.textsbalance.feature_1.0.0.202004141145.jar" id="org.txm.textsbalance.feature" version="1.0.0.202004141145">
27
   <feature url="features/org.txm.textsbalance.feature_1.0.0.202006261406.jar" id="org.txm.textsbalance.feature" version="1.0.0.202006261406">
28 28
      <category name="ALL"/>
29 29
   </feature>
30
   <feature url="features/org.txm.tigersearch.feature_1.0.0.202004141145.jar" id="org.txm.tigersearch.feature" version="1.0.0.202004141145">
30
   <feature url="features/org.txm.tigersearch.feature_1.0.0.202006261406.jar" id="org.txm.tigersearch.feature" version="1.0.0.202006261406">
31 31
      <category name="ALL"/>
32 32
   </feature>
33 33
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.201912161444.jar" id="org.txm.treetagger.models.feature" version="1.0.0.201912161444">
34 34
      <category name="ALL"/>
35 35
   </feature>
36
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202004141145.jar" id="org.txm.wordcloud.feature" version="1.0.0.202004141145">
36
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202006261406.jar" id="org.txm.wordcloud.feature" version="1.0.0.202006261406">
37 37
      <category name="ALL"/>
38 38
   </feature>
39
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.202004141145.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.202004141145" os="">
39
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.202006261406.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.202006261406" os="">
40 40
      <category name="ALL"/>
41 41
   </feature>
42
   <feature url="features/org.txm.treetagger.feature_1.0.0.202004141145.jar" id="org.txm.treetagger.feature" version="1.0.0.202004141145">
42
   <feature url="features/org.txm.treetagger.feature_1.0.0.202006261406.jar" id="org.txm.treetagger.feature" version="1.0.0.202006261406">
43 43
      <category name="ALL"/>
44 44
   </feature>
45
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.202004141145.jar" id="org.txm.treetagger.models.feature" version="1.0.0.202004141145">
45
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.202006261406.jar" id="org.txm.treetagger.models.feature" version="1.0.0.202006261406">
46 46
      <category name="ALL"/>
47 47
   </feature>
48 48
   <category-def name="ALL" label="ALL">
tmp/TXMReleasePlugins.site/site.xml (revision 2926)
3 3
   <description name="TXM Extensions - RELEASE" url="https://gitlab.huma-num.fr/txm/txm-software/-/raw/master/dist/0.8.1/ext/stable">
4 4
      This update site contains the Release extensions for TXM
5 5
   </description>
6
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202006051820.jar" id="org.txm.backtomedia.feature" version="1.0.0.202006051820">
6
   <feature url="features/org.txm.backtomedia.feature_1.0.0.202006261407.jar" id="org.txm.backtomedia.feature" version="1.0.0.202006261407">
7 7
      <category name="Commands"/>
8 8
   </feature>
9
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202006051820.jar" id="org.txm.wordcloud.feature" version="1.0.0.202006051820">
9
   <feature url="features/org.txm.wordcloud.feature_1.0.0.202006261407.jar" id="org.txm.wordcloud.feature" version="1.0.0.202006261407">
10 10
      <category name="Commands"/>
11 11
   </feature>
12
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.202006051820.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.202006051820" os="" ws="">
12
   <feature url="features/org.txm.treetagger.binaries.feature_1.0.0.202006261407.jar" id="org.txm.treetagger.binaries.feature" version="1.0.0.202006261407" os="" ws="">
13 13
      <category name="Annotation"/>
14 14
   </feature>
15
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.202006051820.jar" id="org.txm.treetagger.models.feature" version="1.0.0.202006051820">
15
   <feature url="features/org.txm.treetagger.models.feature_1.0.0.202006261407.jar" id="org.txm.treetagger.models.feature" version="1.0.0.202006261407">
16 16
      <category name="Annotation"/>
17 17
   </feature>
18
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202006051820.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202006051820">
18
   <feature url="features/org.txm.annotation.urs.feature_1.0.0.202006261407.jar" id="org.txm.annotation.urs.feature" version="1.0.0.202006261407">
19 19
      <category name="Annotation"/>
20 20
   </feature>
21 21
   <category-def name="Commands" label="Commands">
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java (revision 2926)
45 45
import org.txm.utils.OSDetector;
46 46
import org.txm.utils.io.IOUtils;
47 47

  
48
// TODO: Auto-generated Javadoc
49 48
/**
50 49
 * This class aims at handling a CQi server process. It is not a CQi server per
51 50
 * se.
......
54 53
 */
55 54

  
56 55
public class CwbEncode extends CwbProcess {
56
	
57 57
	/**
58 58
	 * Instantiates a new CQi server.
59 59
	 */
60 60
	public CwbEncode() {
61 61
		super("cwb-encode"); //$NON-NLS-1$
62 62
	}
63

  
63
	
64 64
	/**
65 65
	 * Instantiates a new cwb encode.
66 66
	 *
......
69 69
	public CwbEncode(String name) {
70 70
		super(name);
71 71
	}
72

  
72
	
73 73
	/**
74 74
	 * Instantiates a new CQi server using executable path set in CQPLibPreferences.
75 75
	 *
......
80 80
	 * @param sAttributes the structural attribute
81 81
	 * @return true if successful
82 82
	 * @throws ServerNotFoundException the server not found exception
83
	 * @throws IOException 
84
	 * @throws InterruptedException 
83
	 * @throws IOException
84
	 * @throws InterruptedException
85 85
	 */
86 86
	public boolean run(String pathToData,
87 87
			String inputFile, String pathToRegistry, String[] pAttributes,
......
100 100
	 * @param sAttributes the structural attribute
101 101
	 * @return true if successful
102 102
	 * @throws ServerNotFoundException the server not found exception
103
	 * @throws IOException 
104
	 * @throws InterruptedException 
103
	 * @throws IOException
104
	 * @throws InterruptedException
105 105
	 */
106 106
	public boolean run(String pathToData,
107 107
			String inputFile, String pathToRegistry, String[] pAttributes,
108 108
			String[] sAttributes, boolean monitorOutput) throws ServerNotFoundException, InterruptedException, IOException {
109 109
		
110 110
		File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB),
111
				"cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
112

  
111
				"cwb-encode" + (System.getProperty("os.name").toLowerCase().contains("windows") ? ".exe" : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
112
		
113 113
		return run(pathToExecutable.getAbsolutePath(), pathToData, inputFile,
114 114
				pathToRegistry, pAttributes, sAttributes, false);
115 115
	}
116 116
	
117 117
	/**
118 118
	 * 
119
	 * @return if the cwb-encode executable file set in preferences is available 
119
	 * @return if the cwb-encode executable file set in preferences is available
120 120
	 */
121 121
	public static boolean isExecutableAvailable() {
122
		return isExecutableAvailable("cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
122
		return isExecutableAvailable("cwb-encode" + (System.getProperty("os.name").toLowerCase().contains("windows") ? ".exe" : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
123 123
	}
124 124
	
125 125
	/**
......
133 133
	 * @param sAttributes the structural attribute
134 134
	 * @return true if successful
135 135
	 * @throws ServerNotFoundException the server not found exception
136
	 * @throws IOException 
137
	 * @throws InterruptedException 
136
	 * @throws IOException
137
	 * @throws InterruptedException
138 138
	 */
139 139
	public boolean run(String pathToExecutable, String pathToData,
140 140
			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
141 141
			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
142 142
		boolean ret = run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, false);
143

  
143
		
144 144
		return ret;
145 145
	}
146

  
146
	
147 147
	/**
148 148
	 * * Instantiates a new CQi server.
149 149
	 *
......
155 155
	 * @param sAttributes the structural atribute
156 156
	 * @return true, if successful
157 157
	 * @throws ServerNotFoundException the server not found exception
158
	 * @throws IOException 
159
	 * @throws InterruptedException 
158
	 * @throws IOException
159
	 * @throws InterruptedException
160 160
	 */
161 161
	public boolean run(String pathToExecutable, String pathToData,
162 162
			String inputFile, String pathToRegistry, String[] pAttributes,
163 163
			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
164 164
		boolean ret = run(pathToExecutable, pathToData, inputFile, pathToRegistry, pAttributes, sAttributes, false);
165

  
165
		
166 166
		return ret;
167 167
	}
168

  
168
	
169 169
	/*
170 170
	 * delete all files and directory of the given path
171 171
	 */
......
188 188
		// The directory is now empty so delete it
189 189
		return dir.delete();
190 190
	}
191

  
191
	
192 192
	public boolean run(String pathToExecutable, String pathToData,
193 193
			String inputFile, String pathToRegistry, String[] pAttributes,
194 194
			String[] sAttributes, boolean monitorOutput)
195
					throws ServerNotFoundException, InterruptedException, IOException {
196

  
195
			throws ServerNotFoundException, InterruptedException, IOException {
196
		
197 197
		List<File> inputFiles = Arrays.asList(new File(inputFile));
198

  
198
		
199 199
		return run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, monitorOutput);
200 200
	}
201
	
201 202
	/**
202 203
	 * execute cwb-encode.
203 204
	 *
......
210 211
	 * @param monitorOutput the monitor output
211 212
	 * @return true, if successful
212 213
	 * @throws ServerNotFoundException the server not found exception
213
	 * @throws IOException 
214
	 * @throws InterruptedException 
214
	 * @throws IOException
215
	 * @throws InterruptedException
215 216
	 */
216 217
	public boolean run(String pathToExecutable, String pathToData,
217 218
			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
218 219
			String[] sAttributes, boolean monitorOutput)
219
					throws ServerNotFoundException, InterruptedException, IOException {
220
			throws ServerNotFoundException, InterruptedException, IOException {
220 221
		File data = new File(pathToData);
221 222
		deleteDir(data);
222 223
		data.mkdirs();
223

  
224
		
224 225
		// fix UNC paths for mingw
225 226
		if (pathToRegistry.startsWith("\\\\")) {
226
			pathToRegistry = pathToRegistry.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
227
			pathToRegistry = pathToRegistry.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
227 228
		}
228
		// fix UNC paths for mingw 
229
		// fix UNC paths for mingw
229 230
		if (pathToData.startsWith("\\\\")) {
230
			pathToData = pathToData.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
231
			pathToData = pathToData.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
231 232
		}
232 233
		
233 234
		if (!new File(pathToExecutable).exists()) {
......
245 246
		 * inputFile = "\""+inputFile+"\""; pathToRegistry =
246 247
		 * "\""+pathToRegistry+"\""; }
247 248
		 */
248

  
249
		
249 250
		// Warning !! for WINDOWS ONLY the "" value does not work with the ProcessBuilder we must set the value to "\"\""
250 251
		String empty_value_code = Toolbox.getPreference(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE);
251 252
		if (OSDetector.isFamilyWindows()) {
......
253 254
			empty_value_code = empty_value_code.trim();
254 255
			if (empty_value_code.length() == 0) empty_value_code = "\"\"";//$NON-NLS-1$
255 256
		}
256

  
257
		ArrayList<String> cmd = new ArrayList<String>();
258
		if (inputFiles != null) { //read input from file
257
		
258
		ArrayList<String> cmd = new ArrayList<>();
259
		if (inputFiles != null) { // read input from file
259 260
			cmd.add(pathToExecutable);
260 261
			cmd.add("-d");//$NON-NLS-1$
261 262
			cmd.add(new File(pathToData).getAbsolutePath());
262 263
			cmd.add("-R"); //$NON-NLS-1$
263
			cmd.add(new File(pathToRegistry).getAbsolutePath()); 
264
			cmd.add(new File(pathToRegistry).getAbsolutePath());
264 265
			cmd.add("-U");//$NON-NLS-1$
265 266
			cmd.add(empty_value_code);
266 267
			cmd.add("-c"); //$NON-NLS-1$
267 268
			cmd.add("utf8"); //$NON-NLS-1$
268

  
269
			
269 270
			if (debug) {
270
				cmd.add("-D"); //$NON-NLS-1$ 
271
				cmd.add("-D"); //$NON-NLS-1$
271 272
			}
272

  
273
			
273 274
			for (File inputFile : inputFiles) { // append "-f path" parameters
274 275
				cmd.add("-f"); //$NON-NLS-1$
275 276
				cmd.add(inputFile.getAbsolutePath());
276 277
			}
277
		} else { //read input from stdin
278
		}
279
		else { // read input from stdin
278 280
			String[] c = { pathToExecutable,
279 281
					"-d", new File(pathToData).getAbsolutePath() //$NON-NLS-1$
280 282
					, "-R", new File(pathToRegistry).getAbsolutePath() //$NON-NLS-1$
281 283
					, "-U", empty_value_code //$NON-NLS-1$
282 284
					, "-c", "utf8" //$NON-NLS-1$ //$NON-NLS-2$
283
					//, "-x" //$NON-NLS-1$ 
284
			}; 
285
					// , "-x" //$NON-NLS-1$
286
			};
285 287
			cmd.addAll(Arrays.asList(c));
286 288
		}
287

  
289
		
288 290
		cmd.add("-xsB"); //$NON-NLS-1$
289 291
		for (int i = 0; i < pAttributes.length; i++) {
290 292
			cmd.add("-P"); //$NON-NLS-1$
291 293
			// lower case pattributes
292 294
			cmd.addAll(Arrays.asList(pAttributes[i].toLowerCase().split(" "))); //$NON-NLS-1$
293

  
295
			
294 296
		}
295 297
		for (int i = 0; i < sAttributes.length; i++) {
296 298
			cmd.add("-S"); //$NON-NLS-1$
......
301 303
		boolean waitForCWBEncodeToEnd = inputFiles != null;
302 304
		return run(cmd, monitorOutput, waitForCWBEncodeToEnd) && new File(pathToRegistry).exists();
303 305
	}
304

  
306
	
305 307
	/**
306 308
	 * Patch dir.
307 309
	 *
......
327 329
			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theCorporaDirectoryDoesNotExistsColon, corpora));
328 330
			return;
329 331
		}
330

  
332
		
331 333
		for (File corpus : corpora.listFiles(IOUtils.HIDDENFILE_FILTER)) {
332 334
			if (!corpus.isDirectory()) continue;
333 335
			
334 336
			System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.processingCorpus, corpus.getName()));
335 337
			File data = new File(corpus, "data"); //$NON-NLS-1$
336

  
338
			
337 339
			if (!data.exists()) {
338 340
				System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theDataDirectoryDoesNotExistsColon, data));
339 341
				return;
340 342
			}
341

  
343
			
342 344
			String datapath = data.getAbsolutePath();
343 345
			String regpath = registry.getAbsolutePath() + "/" + corpus.getName(); //$NON-NLS-1$
344
			 // fix UNC paths for mingw
346
			// fix UNC paths for mingw
345 347
			if (datapath.startsWith("\\\\")) { //$NON-NLS-1$
346 348
				datapath = datapath.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
347 349
			}
348 350
			System.out.println(NLS.bind(CQPSearchEngineCoreMessages.fixingRegistryFileP0WithP1, regpath, datapath));
349 351
			try {
350 352
				PatchCwbRegistry.patch(new File(regpath), new File(datapath));
351
			} catch (IOException e) {
353
			}
354
			catch (IOException e) {
352 355
				org.txm.utils.logger.Log.printStackTrace(e);
353 356
			}
354 357
		}
355 358
	}
356

  
359
	
357 360
	/**
358
	 * concatenates CQP files into one master CQP file and wraps with the 'txmcorpus' structure. 
361
	 * concatenates CQP files into one master CQP file and wraps with the 'txmcorpus' structure.
359 362
	 * 
360 363
	 * @param cqpFiles
361 364
	 * @param allcqpFile
......
365 368
	public static boolean concat(ArrayList<File> cqpFiles, File allcqpFile) throws IOException {
366 369
		PrintWriter output = IOUtils.getWriter(allcqpFile);
367 370
		ConsoleProgressBar cpb = new ConsoleProgressBar(cqpFiles.size());
368

  
371
		
369 372
		output.write("<txmcorpus lang=\"fr\">\n"); //$NON-NLS-1$
370 373
		for (File cqpFile : cqpFiles) {
371 374
			cpb.tick();
......
377 380
		output.close();
378 381
		return true;
379 382
	}
380

  
383
	
381 384
	/**
382 385
	 * The main method.
383 386
	 *
......
404 407
		 */
405 408
		CwbEncode.patchDir(new File("C:/Documents and Settings/H/Mes documents/TXM/cwb")); //$NON-NLS-1$
406 409
	}
407
}
410
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java (revision 2926)
44 44
import org.txm.Toolbox;
45 45
import org.txm.core.messages.TXMCoreMessages;
46 46
import org.txm.core.preferences.TXMPreferences;
47
import org.txm.objects.CorpusBuild;
47 48
import org.txm.objects.Project;
48 49
import org.txm.rcp.StatusLine;
49 50
import org.txm.rcp.commands.OpenImportForm;
......
161 162
						
162 163
						this.releaseSemaphore();
163 164
						
165
						for (CorpusBuild corpus : project.getChildren(CorpusBuild.class)) {
166
							corpus.compute(false); // pre-compute CorpusBuilds
167
						}
164 168
						
165
						
166 169
						monitor.done();
167 170
						if (doUpdate) {
168 171
							Log.info(TXMUIMessages.updateDone);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2926)
1091 1091
				}
1092 1092
			}
1093 1093
			
1094
			
1095 1094
			// opening the editor
1096 1095
			IEditorPart tmpEditor = page.openEditor(editorInput, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
1097 1096
			if (tmpEditor instanceof TXMEditor) {

Also available in: Unified diff