Révision 1185
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java (revision 1185) | ||
---|---|---|
59 | 59 |
|
60 | 60 |
String basedirname = Zip.getRoot(zipFile); |
61 | 61 |
|
62 |
Project p = Toolbox.workspace.getProject(basedirname.toUpperCase()); |
|
63 |
if (p != null) { |
|
64 |
System.out.println("Aborting loading of "+zipFile+". A corpus with the same name already exists."); |
|
65 |
return null; |
|
66 |
} |
|
67 |
|
|
62 | 68 |
if (!Zip.hasEntries(zipFile, basedirname+"/.settings/", basedirname+"/.project", basedirname+"/data/", basedirname+"/txm/", basedirname+"/HTML/", basedirname+"/registry/")) { |
63 | 69 |
System.out.println(zipFile.getName()+" binary corpus is not a TXM 0.8.0 corpus (no .settings nor .project file)"); |
64 | 70 |
return null; |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java (revision 1185) | ||
---|---|---|
64 | 64 |
|
65 | 65 |
String basedirname = Zip.getRoot(zipFile); |
66 | 66 |
|
67 |
Project p = Toolbox.workspace.getProject(basedirname.toUpperCase()); |
|
68 |
if (p != null) { |
|
69 |
System.out.println("Aborting loading of "+zipFile+". A corpus with the same name already exists."); |
|
70 |
return null; |
|
71 |
} |
|
72 |
|
|
67 | 73 |
if (!Zip.hasEntries(zipFile, basedirname+"/import.xml", basedirname+"/data/", basedirname+"/txm/", basedirname+"/HTML/", basedirname+"/registry/")) { |
68 | 74 |
System.out.println("Binary corpus is not a TXM 0.7.9 corpus (no import.xml file)"); |
69 | 75 |
return null; |
... | ... | |
75 | 81 |
try { |
76 | 82 |
//System.out.println(NLS.bind(Messages.AddBase_29, zipFile, corporaDir)); |
77 | 83 |
Zip.decompress(zipFile, corporaDir, false, monitor); |
84 |
if (!basedirname.equals(basedirname.toUpperCase())) { // manage old corpus with lower cased names |
|
85 |
new File(corporaDir, basedirname).renameTo(new File(corporaDir, basedirname.toUpperCase())); |
|
86 |
basedirname = basedirname.toUpperCase(); |
|
87 |
} |
|
78 | 88 |
} catch (Exception e) { |
79 | 89 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
80 | 90 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1185) | ||
---|---|---|
316 | 316 |
// |
317 | 317 |
// Toolbox.workspace.save(); |
318 | 318 |
|
319 |
Project p = Toolbox.workspace.getProject(corpusDirectory.getName().toUpperCase().toUpperCase()); |
|
320 |
if (p != null) { |
|
321 |
System.out.println("Aborting loading of "+corpusDirectory+". A corpus with the same name already exists."); |
|
322 |
return null; |
|
323 |
} |
|
324 |
|
|
319 | 325 |
// seems like a binary corpus directory |
320 | 326 |
// copy files in the new current corpora directory |
321 | 327 |
File destDir = new File(Toolbox.workspace.getLocation(), corpusDirectory.getName().toUpperCase()); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/TxmPreferences.java (revision 1185) | ||
---|---|---|
39 | 39 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
40 | 40 |
import org.osgi.service.prefs.BackingStoreException; |
41 | 41 |
import org.osgi.service.prefs.Preferences; |
42 |
import org.txm.core.preferences.TBXPreferences; |
|
42 | 43 |
|
43 | 44 |
// TODO: Auto-generated Javadoc |
44 | 45 |
/** |
... | ... | |
112 | 113 |
prop.load(input); |
113 | 114 |
for (Object key : prop.keySet()) { |
114 | 115 |
//System.out.println("prop: "+key.toString()+"="+prop.get(key).toString()); |
115 |
TxmPreferences.set(key.toString(), prop.get(key).toString());
|
|
116 |
TBXPreferences.getInstance().put(key.toString(), prop.get(key).toString());
|
|
116 | 117 |
} |
117 | 118 |
} else { |
118 | 119 |
String line = input.readLine(); |
... | ... | |
120 | 121 |
String[] split = line.split("=", 2); //$NON-NLS-1$ |
121 | 122 |
if (split.length == 2) { |
122 | 123 |
//System.out.println("Set preference: "+line); |
123 |
TxmPreferences.set(split[0], split[1]);
|
|
124 |
TBXPreferences.getInstance().put(split[0], split[1]);
|
|
124 | 125 |
} |
125 | 126 |
line = input.readLine(); |
126 | 127 |
} |
... | ... | |
137 | 138 |
return ret; |
138 | 139 |
} |
139 | 140 |
|
140 |
/** |
|
141 |
* set a property which value is a String. |
|
142 |
* |
|
143 |
* @param key the key |
|
144 |
* @param value the value |
|
145 |
*/ |
|
146 |
protected static void set(String key, String value) { |
|
147 |
IPreferencesService service = Platform.getPreferencesService(); |
|
148 |
service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID).put(key, value); //$NON-NLS-1$ |
|
149 |
try { |
|
150 |
service.getRootNode().flush(); |
|
151 |
} catch (BackingStoreException e) { |
|
152 |
System.err.println(e); |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
/** |
|
157 |
* set a property which value is a boolean. |
|
158 |
* |
|
159 |
* @param key the key |
|
160 |
* @param value the value |
|
161 |
*/ |
|
162 |
protected static void set(String key, boolean value) { |
|
163 |
IPreferencesService service = Platform.getPreferencesService(); |
|
164 |
service.getRootNode() |
|
165 |
.node(SCOPE).node(Application.PLUGIN_ID).putBoolean(key, value); //$NON-NLS-1$ |
|
166 |
try { |
|
167 |
service.getRootNode().flush(); |
|
168 |
} catch (BackingStoreException e) { |
|
169 |
System.err.println(e); |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* set a property which value is a double. |
|
175 |
* |
|
176 |
* @param key the key |
|
177 |
* @param value the value |
|
178 |
*/ |
|
179 |
protected static void set(String key, double value) { |
|
180 |
IPreferencesService service = Platform.getPreferencesService(); |
|
181 |
service.getRootNode() |
|
182 |
.node(SCOPE).node(Application.PLUGIN_ID).putDouble(key, value); //$NON-NLS-1$ |
|
183 |
try { |
|
184 |
service.getRootNode().flush(); |
|
185 |
} catch (BackingStoreException e) { |
|
186 |
System.err.println(e); |
|
187 |
} |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* set a property which value is a float. |
|
192 |
* |
|
193 |
* @param key the key |
|
194 |
* @param value the value |
|
195 |
*/ |
|
196 |
protected static void set(String key, float value) { |
|
197 |
IPreferencesService service = Platform.getPreferencesService(); |
|
198 |
service.getRootNode() |
|
199 |
.node(SCOPE).node(Application.PLUGIN_ID).putFloat(key, value); //$NON-NLS-1$ |
|
200 |
try { |
|
201 |
service.getRootNode().flush(); |
|
202 |
} catch (BackingStoreException e) { |
|
203 |
System.err.println(e); |
|
204 |
} |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* set a property which value is a int. |
|
209 |
* |
|
210 |
* @param key the key |
|
211 |
* @param value the value |
|
212 |
*/ |
|
213 |
protected static void set(String key, int value) { |
|
214 |
IPreferencesService service = Platform.getPreferencesService(); |
|
215 |
service.getRootNode() |
|
216 |
.node(SCOPE).node(Application.PLUGIN_ID).putInt(key, value); //$NON-NLS-1$ |
|
217 |
try { |
|
218 |
service.getRootNode().flush(); |
|
219 |
} catch (BackingStoreException e) { |
|
220 |
System.err.println(e); |
|
221 |
} |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* set a property which value is a long. |
|
226 |
* |
|
227 |
* @param key the key |
|
228 |
* @param value the value |
|
229 |
*/ |
|
230 |
protected static void set(String key, long value) { |
|
231 |
IPreferencesService service = Platform.getPreferencesService(); |
|
232 |
service.getRootNode() |
|
233 |
.node(SCOPE).node(Application.PLUGIN_ID).putLong(key, value); //$NON-NLS-1$ |
|
234 |
try { |
|
235 |
service.getRootNode().flush(); |
|
236 |
} catch (BackingStoreException e) { |
|
237 |
System.err.println(e); |
|
238 |
} |
|
239 |
} |
|
240 |
|
|
241 |
/** |
|
242 |
* set a property which value is a byte array. |
|
243 |
* |
|
244 |
* @param key the key |
|
245 |
* @param value the value |
|
246 |
*/ |
|
247 |
protected static void set(String key, byte[] value) { |
|
248 |
IPreferencesService service = Platform.getPreferencesService(); |
|
249 |
service.getRootNode() |
|
250 |
.node(SCOPE).node(Application.PLUGIN_ID).putByteArray(key, value); //$NON-NLS-1$ |
|
251 |
try { |
|
252 |
service.getRootNode().flush(); |
|
253 |
} catch (BackingStoreException e) { |
|
254 |
System.err.println(e); |
|
255 |
} |
|
256 |
} |
|
257 |
|
|
258 |
/** |
|
259 |
* get a property as a String. |
|
260 |
* |
|
261 |
* @param key the key |
|
262 |
* @return the string |
|
263 |
*/ |
|
264 |
protected static String get(String key) { |
|
265 |
IPreferencesService service = Platform.getPreferencesService(); |
|
266 |
return service.getRootNode() |
|
267 |
.node(SCOPE).node(Application.PLUGIN_ID).get(key, null); //$NON-NLS-1$ |
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* get a property as a String. |
|
272 |
* |
|
273 |
* @param key the key |
|
274 |
* @return the string |
|
275 |
*/ |
|
276 |
protected static String get(String key, String def) { |
|
277 |
String rez = get(key); |
|
278 |
if (rez == null) rez = def; |
|
279 |
return rez; |
|
280 |
} |
|
281 |
|
|
282 |
/** |
|
283 |
* get a property as a Boolean. |
|
284 |
* |
|
285 |
* @param key the key |
|
286 |
* @return the boolean |
|
287 |
*/ |
|
288 |
protected static Boolean getBoolean(String key) { |
|
289 |
IPreferencesService service = Platform.getPreferencesService(); |
|
290 |
return service.getRootNode() |
|
291 |
.node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, false); //$NON-NLS-1$ |
|
292 |
} |
|
293 |
|
|
294 |
/** |
|
295 |
* get a property as a Boolean. |
|
296 |
* |
|
297 |
* @param key the key |
|
298 |
* @param defaultvalue the defaultvalue |
|
299 |
* @return the boolean |
|
300 |
*/ |
|
301 |
protected static Boolean getBoolean(String key, boolean defaultvalue) { |
|
302 |
IPreferencesService service = Platform.getPreferencesService(); |
|
303 |
return service.getRootNode() |
|
304 |
.node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, defaultvalue); //$NON-NLS-1$ |
|
305 |
} |
|
306 |
|
|
307 |
/** |
|
308 |
* get a property as a Double. |
|
309 |
* |
|
310 |
* @param key the key |
|
311 |
* @return the double |
|
312 |
*/ |
|
313 |
protected static Double getDouble(String key) { |
|
314 |
IPreferencesService service = Platform.getPreferencesService(); |
|
315 |
return service.getRootNode() |
|
316 |
.node(SCOPE).node(Application.PLUGIN_ID).getDouble(key, 0.0d); //$NON-NLS-1$ |
|
317 |
} |
|
318 |
|
|
319 |
/** |
|
320 |
* get a property as a Integer. |
|
321 |
* |
|
322 |
* @param key the key |
|
323 |
* @return the int |
|
324 |
*/ |
|
325 |
protected static Integer getInt(String key) { |
|
326 |
return getInt(key, 0); |
|
327 |
} |
|
328 |
|
|
329 |
/** |
|
330 |
* Gets the int. |
|
331 |
* |
|
332 |
* @param key the key |
|
333 |
* @param i the i |
|
334 |
* @return the int |
|
335 |
*/ |
|
336 |
protected static int getInt(String key, int i) { |
|
337 |
IPreferencesService service = Platform.getPreferencesService(); |
|
338 |
return service.getRootNode() |
|
339 |
.node(SCOPE).node(Application.PLUGIN_ID).getInt(key, i); //$NON-NLS-1$ |
|
340 |
} |
|
341 |
|
|
342 |
|
|
343 |
/** |
|
344 |
* Gets the float. |
|
345 |
* |
|
346 |
* @param key the key |
|
347 |
* @param def the def |
|
348 |
* @return the float |
|
349 |
*/ |
|
350 |
protected static float getFloat(String key, float def) { |
|
351 |
IPreferencesService service = Platform.getPreferencesService(); |
|
352 |
return service.getRootNode() |
|
353 |
.node(SCOPE).node(Application.PLUGIN_ID).getFloat(key, def); //$NON-NLS-1$ |
|
354 |
} |
|
355 |
|
|
356 |
/** |
|
357 |
* remove a property. |
|
358 |
* |
|
359 |
* @param key the key |
|
360 |
*/ |
|
361 |
protected static void remove(String key) { |
|
362 |
IPreferencesService service = Platform.getPreferencesService(); |
|
363 |
service.getRootNode() |
|
364 |
.node(SCOPE).node(Application.PLUGIN_ID).remove(key); //$NON-NLS-1$ |
|
365 |
try { |
|
366 |
service.getRootNode().flush(); |
|
367 |
} catch (BackingStoreException e) { |
|
368 |
System.err.println(e); |
|
369 |
} |
|
370 |
} |
|
371 |
|
|
372 | 141 |
// /** |
373 |
// * return all stored properties.
|
|
142 |
// * set a property which value is a String.
|
|
374 | 143 |
// * |
375 |
// * @return the properties |
|
144 |
// * @param key the key |
|
145 |
// * @param value the value |
|
376 | 146 |
// */ |
377 |
// protected static Properties getProperties() { |
|
378 |
// return ApplicationWorkbenchAdvisor.getProperties(); |
|
147 |
// protected static void set(String key, String value) { |
|
148 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
149 |
// service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID).put(key, value); //$NON-NLS-1$ |
|
150 |
// try { |
|
151 |
// service.getRootNode().flush(); |
|
152 |
// } catch (BackingStoreException e) { |
|
153 |
// System.err.println(e); |
|
154 |
// } |
|
379 | 155 |
// } |
156 |
// |
|
157 |
// /** |
|
158 |
// * set a property which value is a boolean. |
|
159 |
// * |
|
160 |
// * @param key the key |
|
161 |
// * @param value the value |
|
162 |
// */ |
|
163 |
// protected static void set(String key, boolean value) { |
|
164 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
165 |
// service.getRootNode() |
|
166 |
// .node(SCOPE).node(Application.PLUGIN_ID).putBoolean(key, value); //$NON-NLS-1$ |
|
167 |
// try { |
|
168 |
// service.getRootNode().flush(); |
|
169 |
// } catch (BackingStoreException e) { |
|
170 |
// System.err.println(e); |
|
171 |
// } |
|
172 |
// } |
|
173 |
// |
|
174 |
// /** |
|
175 |
// * set a property which value is a double. |
|
176 |
// * |
|
177 |
// * @param key the key |
|
178 |
// * @param value the value |
|
179 |
// */ |
|
180 |
// protected static void set(String key, double value) { |
|
181 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
182 |
// service.getRootNode() |
|
183 |
// .node(SCOPE).node(Application.PLUGIN_ID).putDouble(key, value); //$NON-NLS-1$ |
|
184 |
// try { |
|
185 |
// service.getRootNode().flush(); |
|
186 |
// } catch (BackingStoreException e) { |
|
187 |
// System.err.println(e); |
|
188 |
// } |
|
189 |
// } |
|
190 |
// |
|
191 |
// /** |
|
192 |
// * set a property which value is a float. |
|
193 |
// * |
|
194 |
// * @param key the key |
|
195 |
// * @param value the value |
|
196 |
// */ |
|
197 |
// protected static void set(String key, float value) { |
|
198 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
199 |
// service.getRootNode() |
|
200 |
// .node(SCOPE).node(Application.PLUGIN_ID).putFloat(key, value); //$NON-NLS-1$ |
|
201 |
// try { |
|
202 |
// service.getRootNode().flush(); |
|
203 |
// } catch (BackingStoreException e) { |
|
204 |
// System.err.println(e); |
|
205 |
// } |
|
206 |
// } |
|
207 |
// |
|
208 |
// /** |
|
209 |
// * set a property which value is a int. |
|
210 |
// * |
|
211 |
// * @param key the key |
|
212 |
// * @param value the value |
|
213 |
// */ |
|
214 |
// protected static void set(String key, int value) { |
|
215 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
216 |
// service.getRootNode() |
|
217 |
// .node(SCOPE).node(Application.PLUGIN_ID).putInt(key, value); //$NON-NLS-1$ |
|
218 |
// try { |
|
219 |
// service.getRootNode().flush(); |
|
220 |
// } catch (BackingStoreException e) { |
|
221 |
// System.err.println(e); |
|
222 |
// } |
|
223 |
// } |
|
224 |
// |
|
225 |
// /** |
|
226 |
// * set a property which value is a long. |
|
227 |
// * |
|
228 |
// * @param key the key |
|
229 |
// * @param value the value |
|
230 |
// */ |
|
231 |
// protected static void set(String key, long value) { |
|
232 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
233 |
// service.getRootNode() |
|
234 |
// .node(SCOPE).node(Application.PLUGIN_ID).putLong(key, value); //$NON-NLS-1$ |
|
235 |
// try { |
|
236 |
// service.getRootNode().flush(); |
|
237 |
// } catch (BackingStoreException e) { |
|
238 |
// System.err.println(e); |
|
239 |
// } |
|
240 |
// } |
|
241 |
// |
|
242 |
// /** |
|
243 |
// * set a property which value is a byte array. |
|
244 |
// * |
|
245 |
// * @param key the key |
|
246 |
// * @param value the value |
|
247 |
// */ |
|
248 |
// protected static void set(String key, byte[] value) { |
|
249 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
250 |
// service.getRootNode() |
|
251 |
// .node(SCOPE).node(Application.PLUGIN_ID).putByteArray(key, value); //$NON-NLS-1$ |
|
252 |
// try { |
|
253 |
// service.getRootNode().flush(); |
|
254 |
// } catch (BackingStoreException e) { |
|
255 |
// System.err.println(e); |
|
256 |
// } |
|
257 |
// } |
|
258 |
// |
|
259 |
// /** |
|
260 |
// * get a property as a String. |
|
261 |
// * |
|
262 |
// * @param key the key |
|
263 |
// * @return the string |
|
264 |
// */ |
|
265 |
// protected static String get(String key) { |
|
266 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
267 |
// return service.getRootNode() |
|
268 |
// .node(SCOPE).node(Application.PLUGIN_ID).get(key, null); //$NON-NLS-1$ |
|
269 |
// } |
|
270 |
// |
|
271 |
// /** |
|
272 |
// * get a property as a String. |
|
273 |
// * |
|
274 |
// * @param key the key |
|
275 |
// * @return the string |
|
276 |
// */ |
|
277 |
// protected static String get(String key, String def) { |
|
278 |
// String rez = get(key); |
|
279 |
// if (rez == null) rez = def; |
|
280 |
// return rez; |
|
281 |
// } |
|
282 |
// |
|
283 |
// /** |
|
284 |
// * get a property as a Boolean. |
|
285 |
// * |
|
286 |
// * @param key the key |
|
287 |
// * @return the boolean |
|
288 |
// */ |
|
289 |
// protected static Boolean getBoolean(String key) { |
|
290 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
291 |
// return service.getRootNode() |
|
292 |
// .node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, false); //$NON-NLS-1$ |
|
293 |
// } |
|
294 |
// |
|
295 |
// /** |
|
296 |
// * get a property as a Boolean. |
|
297 |
// * |
|
298 |
// * @param key the key |
|
299 |
// * @param defaultvalue the defaultvalue |
|
300 |
// * @return the boolean |
|
301 |
// */ |
|
302 |
// protected static Boolean getBoolean(String key, boolean defaultvalue) { |
|
303 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
304 |
// return service.getRootNode() |
|
305 |
// .node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, defaultvalue); //$NON-NLS-1$ |
|
306 |
// } |
|
307 |
// |
|
308 |
// /** |
|
309 |
// * get a property as a Double. |
|
310 |
// * |
|
311 |
// * @param key the key |
|
312 |
// * @return the double |
|
313 |
// */ |
|
314 |
// protected static Double getDouble(String key) { |
|
315 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
316 |
// return service.getRootNode() |
|
317 |
// .node(SCOPE).node(Application.PLUGIN_ID).getDouble(key, 0.0d); //$NON-NLS-1$ |
|
318 |
// } |
|
319 |
// |
|
320 |
// /** |
|
321 |
// * get a property as a Integer. |
|
322 |
// * |
|
323 |
// * @param key the key |
|
324 |
// * @return the int |
|
325 |
// */ |
|
326 |
// protected static Integer getInt(String key) { |
|
327 |
// return getInt(key, 0); |
|
328 |
// } |
|
329 |
// |
|
330 |
// /** |
|
331 |
// * Gets the int. |
|
332 |
// * |
|
333 |
// * @param key the key |
|
334 |
// * @param i the i |
|
335 |
// * @return the int |
|
336 |
// */ |
|
337 |
// protected static int getInt(String key, int i) { |
|
338 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
339 |
// return service.getRootNode() |
|
340 |
// .node(SCOPE).node(Application.PLUGIN_ID).getInt(key, i); //$NON-NLS-1$ |
|
341 |
// } |
|
342 |
// |
|
343 |
// |
|
344 |
// /** |
|
345 |
// * Gets the float. |
|
346 |
// * |
|
347 |
// * @param key the key |
|
348 |
// * @param def the def |
|
349 |
// * @return the float |
|
350 |
// */ |
|
351 |
// protected static float getFloat(String key, float def) { |
|
352 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
353 |
// return service.getRootNode() |
|
354 |
// .node(SCOPE).node(Application.PLUGIN_ID).getFloat(key, def); //$NON-NLS-1$ |
|
355 |
// } |
|
356 |
// |
|
357 |
// /** |
|
358 |
// * remove a property. |
|
359 |
// * |
|
360 |
// * @param key the key |
|
361 |
// */ |
|
362 |
// protected static void remove(String key) { |
|
363 |
// IPreferencesService service = Platform.getPreferencesService(); |
|
364 |
// service.getRootNode() |
|
365 |
// .node(SCOPE).node(Application.PLUGIN_ID).remove(key); //$NON-NLS-1$ |
|
366 |
// try { |
|
367 |
// service.getRootNode().flush(); |
|
368 |
// } catch (BackingStoreException e) { |
|
369 |
// System.err.println(e); |
|
370 |
// } |
|
371 |
// } |
|
372 |
// |
|
373 |
//// /** |
|
374 |
//// * return all stored properties. |
|
375 |
//// * |
|
376 |
//// * @return the properties |
|
377 |
//// */ |
|
378 |
//// protected static Properties getProperties() { |
|
379 |
//// return ApplicationWorkbenchAdvisor.getProperties(); |
|
380 |
//// } |
|
381 |
// |
|
382 |
// /** |
|
383 |
// * Gets the string. |
|
384 |
// * |
|
385 |
// * @param key the key |
|
386 |
// * @param defaultvalue the defaultvalue |
|
387 |
// * @return the string |
|
388 |
// */ |
|
389 |
// protected static String getString(String key, String defaultvalue) { |
|
390 |
// String ret = get(key); |
|
391 |
// if (ret == null) |
|
392 |
// return defaultvalue; |
|
393 |
// return ret; |
|
394 |
// } |
|
380 | 395 |
|
381 |
/** |
|
382 |
* Gets the string. |
|
383 |
* |
|
384 |
* @param key the key |
|
385 |
* @param defaultvalue the defaultvalue |
|
386 |
* @return the string |
|
387 |
*/ |
|
388 |
protected static String getString(String key, String defaultvalue) { |
|
389 |
String ret = get(key); |
|
390 |
if (ret == null) |
|
391 |
return defaultvalue; |
|
392 |
return ret; |
|
393 |
} |
|
394 |
|
|
395 | 396 |
protected static String[] getAllKeys() { |
396 | 397 |
IPreferencesService service = Platform.getPreferencesService(); |
397 | 398 |
Preferences prefs = service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID); //$NON-NLS-1$ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 1185) | ||
---|---|---|
87 | 87 |
import org.txm.objects.Project; |
88 | 88 |
import org.txm.rcp.commands.OpenWelcomePage; |
89 | 89 |
import org.txm.rcp.commands.RestartTXM; |
90 |
import org.txm.rcp.commands.workspace.LoadBinaryCorporaDirectory; |
|
90 | 91 |
import org.txm.rcp.commands.workspace.LoadBinaryCorpus; |
91 | 92 |
import org.txm.rcp.handlers.results.DeleteObject; |
92 | 93 |
import org.txm.rcp.handlers.scripts.ExecuteGroovyScript; |
... | ... | |
177 | 178 |
} |
178 | 179 |
|
179 | 180 |
private void openCGU() { |
180 |
String cgu = TxmPreferences.get("cgu");
|
|
181 |
String cgu = TBXPreferences.getInstance().getString("cgu");
|
|
181 | 182 |
if (!"true".equals(cgu)) { |
182 | 183 |
//System.out.println("Opening CGU..."); |
183 | 184 |
//Display.getCurrent() works because this code is run during the splash screen |
... | ... | |
192 | 193 |
}; |
193 | 194 |
boolean ret = (dialog.open() == MessageDialog.OK) && dialog.hasCheckBeenPressed(); |
194 | 195 |
if (ret) { |
195 |
TxmPreferences.set("cgu", "true");
|
|
196 |
TBXPreferences.getInstance().put("cgu", "true");
|
|
196 | 197 |
} else { |
197 | 198 |
System.exit(0); |
198 | 199 |
} |
... | ... | |
256 | 257 |
// restore corpora if TXMHOME has been created |
257 | 258 |
if (txmHomeRestored) { |
258 | 259 |
//createBackUpDirectory(monitor); |
260 |
System.out.println("Installing sample corpus..."); |
|
259 | 261 |
installCorporaFromSamplesDirectory(monitor); |
260 |
this.syncExec(new Runnable() { |
|
261 |
@Override |
|
262 |
public void run() { |
|
263 |
try { |
|
264 |
// Toolbox.restartWorkspace(monitor); |
|
265 |
SearchEnginesManager.getCQPSearchEngine().stop(); |
|
266 |
SearchEnginesManager.getCQPSearchEngine().start(monitor); |
|
267 |
CorporaView.refresh(); |
|
268 |
} catch (Exception e) { |
|
269 |
// TODO Auto-generated catch block |
|
270 |
e.printStackTrace(); |
|
271 |
} |
|
272 |
} |
|
273 |
}); |
|
262 |
// this.syncExec(new Runnable() { |
|
263 |
// @Override |
|
264 |
// public void run() { |
|
265 |
// try { |
|
266 |
// SearchEnginesManager.getCQPSearchEngine().stop(); |
|
267 |
// SearchEnginesManager.getCQPSearchEngine().start(monitor); |
|
268 |
// CorporaView.refresh(); |
|
269 |
// } catch (Exception e) { |
|
270 |
// // TODO Auto-generated catch block |
|
271 |
// e.printStackTrace(); |
|
272 |
// } |
|
273 |
// } |
|
274 |
// }); |
|
274 | 275 |
} |
275 | 276 |
|
276 | 277 |
monitor.done(); |
... | ... | |
583 | 584 |
} |
584 | 585 |
|
585 | 586 |
TBXPreferences.getInstance().put(TBXPreferences.INSTALL_DIR, installDirectory.getAbsolutePath()); |
587 |
TBXPreferences.getInstance().flush(); |
|
586 | 588 |
TXMPreferences.saveAll(); |
587 | 589 |
return true; |
588 | 590 |
} |
... | ... | |
674 | 676 |
|
675 | 677 |
// check if TXMHOME of the user is set and exists |
676 | 678 |
needToRestoreTXMHOME = testTXMHOMEPreferenceAndDirectory(); |
677 |
|
|
679 |
Log.info("needToRestoreTXMHOME="+needToRestoreTXMHOME+" installPreferenceRestored="+installPreferenceRestored); |
|
678 | 680 |
if (needToRestoreTXMHOME || installPreferenceRestored) { |
679 | 681 |
|
680 | 682 |
System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_7); |
... | ... | |
705 | 707 |
|
706 | 708 |
// save preference if USER_TXM_HOME has changed |
707 | 709 |
TBXPreferences.getInstance().put(TBXPreferences.USER_TXM_HOME, txmhomedir.getAbsolutePath()); |
708 |
TXMPreferences.saveAll(); |
|
710 |
TBXPreferences.getInstance().flush(); |
|
711 |
//TXMPreferences.saveAll(); |
|
709 | 712 |
|
710 | 713 |
Log.info("TXM User directory is set to: "+txmhomedir); |
711 | 714 |
|
... | ... | |
811 | 814 |
|
812 | 815 |
// load corpora from the install directory |
813 | 816 |
if (sampleCorporaDirectory.exists()) { //$NON-NLS-1$ |
814 |
Log.info(TXMUIMessages.ApplicationWorkbenchAdvisor_11); |
|
815 |
monitor.setTaskName(TXMUIMessages.ApplicationWorkbenchAdvisor_11); |
|
816 |
//File corporaDir = new File(txmhomedir.getAbsolutePath(), "corpora"); //$NON-NLS-1$ |
|
817 | 817 |
|
818 |
|
|
819 |
File[] sampleCorpusFiles = sampleCorporaDirectory.listFiles(); //$NON-NLS-1$ |
|
820 |
|
|
821 |
if (sampleCorpusFiles != null) for (File zipFile : sampleCorpusFiles) { |
|
822 |
try { |
|
823 |
String filename = zipFile.getName(); |
|
824 |
File basedir; |
|
825 |
String basedirname; |
|
826 |
if (filename.endsWith(".txm") || filename.endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
827 |
if (!zipFile.canRead()) { |
|
828 |
System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_45, zipFile)); |
|
829 |
continue; // go to next binary file |
|
830 |
} |
|
831 |
|
|
832 |
//build binary dir path |
|
833 |
basedirname = Zip.getRoot(zipFile); |
|
834 |
basedir = new File(corporaDir, basedirname); |
|
835 |
|
|
836 |
try { |
|
837 |
Zip.decompress(zipFile.getAbsolutePath(), corporaDir.getAbsolutePath(), false); |
|
838 |
} catch (IOException e) { |
|
839 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
|
840 |
} |
|
841 |
} else if (zipFile.isDirectory()) { |
|
842 |
//basedir = zipFile; |
|
843 |
// basedir = new File(corporaDir, zipFile.getName().toUpperCase()); |
|
844 |
// if (basedir.exists()) { |
|
845 |
// System.out.println("Updating "+basedir.getName()+" corpus from TXM sample directory corpus."); |
|
846 |
// DeleteDir.deleteDirectory(basedir); |
|
818 |
LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(sampleCorporaDirectory); |
|
819 |
// Log.info(TXMUIMessages.ApplicationWorkbenchAdvisor_11); |
|
820 |
// monitor.setTaskName(TXMUIMessages.ApplicationWorkbenchAdvisor_11); |
|
821 |
// //File corporaDir = new File(txmhomedir.getAbsolutePath(), "corpora"); //$NON-NLS-1$ |
|
822 |
// |
|
823 |
// |
|
824 |
// File[] sampleCorpusFiles = sampleCorporaDirectory.listFiles(); //$NON-NLS-1$ |
|
825 |
// |
|
826 |
// if (sampleCorpusFiles != null) for (File zipFile : sampleCorpusFiles) { |
|
827 |
// try { |
|
828 |
// String filename = zipFile.getName(); |
|
829 |
// File basedir; |
|
830 |
// String basedirname; |
|
831 |
// if (filename.endsWith(".txm") || filename.endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
832 |
// if (!zipFile.canRead()) { |
|
833 |
// System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_45, zipFile)); |
|
834 |
// continue; // go to next binary file |
|
847 | 835 |
// } |
848 |
// FileCopy.copyFiles(zipFile, basedir); // copy the sample corpus to load |
|
849 |
} else { |
|
850 |
System.out.println(NLS.bind(TXMUIMessages.AddBase_22, zipFile)); |
|
851 |
System.out.println(TXMUIMessages.AddBase_25); |
|
852 |
continue; |
|
853 |
} |
|
854 |
|
|
855 |
// Project project = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(basedir, monitor); |
|
856 |
// if (project != null) { |
|
857 |
// basenames.add(project.getName()); |
|
858 |
// sampleCorpusLoaded.add(project.getName()); |
|
836 |
// |
|
837 |
// //build binary dir path |
|
838 |
// basedirname = Zip.getRoot(zipFile); |
|
839 |
// basedir = new File(corporaDir, basedirname); |
|
840 |
// |
|
841 |
// try { |
|
842 |
// Zip.decompress(zipFile.getAbsolutePath(), corporaDir.getAbsolutePath(), false); |
|
843 |
// } catch (IOException e) { |
|
844 |
// System.out.println(NLS.bind(TXMUIMessages.AddBase_31, e)); |
|
845 |
// } |
|
846 |
// } else if (zipFile.isDirectory()) { |
|
847 |
// //basedir = zipFile; |
|
848 |
//// basedir = new File(corporaDir, zipFile.getName().toUpperCase()); |
|
849 |
//// if (basedir.exists()) { |
|
850 |
//// System.out.println("Updating "+basedir.getName()+" corpus from TXM sample directory corpus."); |
|
851 |
//// DeleteDir.deleteDirectory(basedir); |
|
852 |
//// } |
|
853 |
//// FileCopy.copyFiles(zipFile, basedir); // copy the sample corpus to load |
|
854 |
// } else { |
|
855 |
// System.out.println(NLS.bind(TXMUIMessages.AddBase_22, zipFile)); |
|
856 |
// System.out.println(TXMUIMessages.AddBase_25); |
|
857 |
// continue; |
|
859 | 858 |
// } |
860 |
|
|
861 |
} catch (Exception e) { |
|
862 |
System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_51+zipFile); |
|
863 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
|
864 |
} |
|
865 |
} |
|
859 |
// |
|
860 |
//// Project project = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(basedir, monitor); |
|
861 |
//// if (project != null) { |
|
862 |
//// basenames.add(project.getName()); |
|
863 |
//// sampleCorpusLoaded.add(project.getName()); |
|
864 |
//// } |
|
865 |
// |
|
866 |
// } catch (Exception e) { |
|
867 |
// System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_51+zipFile); |
|
868 |
// org.txm.rcp.utils.Logger.printStackTrace(e); |
|
869 |
// } |
|
870 |
// } |
|
866 | 871 |
} |
867 | 872 |
|
868 | 873 |
// for (File projectDir : corporaDir.listFiles()) { // load sample corpus and previous corpus as well |
tmp/org.txm.annotation.core/build.properties (revision 1185) | ||
---|---|---|
1 | 1 |
#Fri Jul 06 10:25:02 CEST 2018 |
2 | 2 |
output..=bin/ |
3 |
bin.includes=plugin.xml,META-INF/,.,libs/ |
|
3 |
bin.includes = plugin.xml,\ |
|
4 |
META-INF/,\ |
|
5 |
.,\ |
|
6 |
libs/,\ |
|
7 |
OSGI-INF/ |
|
4 | 8 |
source..=src/ |
5 | 9 |
qualifier=svn |
tmp/org.txm.chartsengine.r.core/build.properties (revision 1185) | ||
---|---|---|
1 | 1 |
#Fri Jul 06 10:25:07 CEST 2018 |
2 | 2 |
output..=bin/ |
3 |
bin.includes=META-INF/,.,plugin.xml |
|
3 |
bin.includes = META-INF/,\ |
|
4 |
.,\ |
|
5 |
plugin.xml,\ |
|
6 |
OSGI-INF/ |
|
4 | 7 |
source..=src/ |
5 | 8 |
qualifier=svn |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1185) | ||
---|---|---|
189 | 189 |
/** |
190 | 190 |
* |
191 | 191 |
*/ |
192 |
public TXMPreferences() {
|
|
192 |
protected TXMPreferences() {
|
|
193 | 193 |
super(); |
194 | 194 |
TXMPreferences.instances.put(this.getClass(), this); |
195 | 195 |
this.commandPreferencesNodeQualifier = FrameworkUtil.getBundle(this.getClass()).getSymbolicName(); |
... | ... | |
1436 | 1436 |
* @param value |
1437 | 1437 |
*/ |
1438 | 1438 |
public static void put(String nodePath, String key, Object value) { |
1439 |
|
|
1439 |
if (!nodePath.startsWith("/project") && !nodePath.startsWith("/instance")) { |
|
1440 |
nodePath = "/instance/"+nodePath; |
|
1441 |
} |
|
1440 | 1442 |
if (Integer.class.isInstance(value)) { |
1441 | 1443 |
preferencesRootNode.node(nodePath).putInt(key, (Integer) value); |
1442 | 1444 |
} |
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1185) | ||
---|---|---|
176 | 176 |
* @throws Exception |
177 | 177 |
*/ |
178 | 178 |
public Project(Workspace workspace, String name, boolean needToBuild) throws Exception { |
179 |
super("project/" + name + "/" + createUUID() + "_Project", workspace); |
|
179 |
super("/project/" + name + "/" + createUUID() + "_Project", workspace);
|
|
180 | 180 |
|
181 | 181 |
this.needToBuild = needToBuild; |
182 | 182 |
this.internalPersistable = true; |
... | ... | |
1122 | 1122 |
} |
1123 | 1123 |
|
1124 | 1124 |
/** |
1125 |
* Gets the project parameters root path ("project/[project name]/") |
|
1125 |
* Gets the project parameters root path ("/project/[project name]/")
|
|
1126 | 1126 |
* @return |
1127 | 1127 |
*/ |
1128 | 1128 |
public String getParametersNodeRootPath() { |
1129 |
return "project/" + this.rcpProject.getName() + "/"; |
|
1129 |
return "/project/" + this.rcpProject.getName() + "/";
|
|
1130 | 1130 |
} |
1131 | 1131 |
|
1132 | 1132 |
public List<? extends CorpusBuild> getCorpora() { |
... | ... | |
1161 | 1161 |
*/ |
1162 | 1162 |
public static void loadProjectsFromProjectScope(IProject rcpProject) { |
1163 | 1163 |
//IScopeContext projectScope = new ProjectScope(projects[i]); |
1164 |
ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths("project/" + rcpProject.getName() + "/"); |
|
1164 |
ArrayList<String> resultNodePaths = TXMPreferences.getAllResultsNodePaths("/project/" + rcpProject.getName() + "/");
|
|
1165 | 1165 |
|
1166 | 1166 |
Log.info("Toolbox.initialize(): loading project " + rcpProject.getName() + "..."); |
1167 | 1167 |
Log.info("Toolbox.initialize(): " + resultNodePaths.size() + " node(s) found in project " + rcpProject.getName() + "..."); |
tmp/org.txm.chartsengine.jfreechart.core/build.properties (revision 1185) | ||
---|---|---|
1 | 1 |
#Fri Jul 06 10:25:06 CEST 2018 |
2 | 2 |
output..=bin/ |
3 |
bin.includes=META-INF/,.,plugin.xml |
|
3 |
bin.includes = META-INF/,\ |
|
4 |
.,\ |
|
5 |
plugin.xml,\ |
|
6 |
OSGI-INF/ |
|
4 | 7 |
source..=src/ |
5 | 8 |
qualifier=svn |
Formats disponibles : Unified diff