Révision 195
tmp/org.txm.core/META-INF/MANIFEST.MF (revision 195) | ||
---|---|---|
5 | 5 |
Bundle-Version: 0.7.0.qualifier |
6 | 6 |
Bundle-Activator: org.txm.toolbox.Activator |
7 | 7 |
Require-Bundle: org.eclipse.core.runtime, |
8 |
org.txm.chartsengine.core, |
|
9 | 8 |
org.eclipse.osgi.util;bundle-version="3.2.0", |
10 | 9 |
org.eclipse.core.net, |
11 | 10 |
org.eclipse.osgi, |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 195) | ||
---|---|---|
1 | 1 |
package org.txm.core.preferences; |
2 | 2 |
|
3 |
import java.util.ArrayList; |
|
3 | 4 |
import java.util.Arrays; |
4 | 5 |
|
5 | 6 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
... | ... | |
8 | 9 |
import org.eclipse.core.runtime.preferences.IScopeContext; |
9 | 10 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
10 | 11 |
import org.osgi.service.prefs.BackingStoreException; |
11 |
import org.osgi.service.prefs.Preferences; |
|
12 |
import org.txm.chartsengine.core.ChartsEngine; |
|
13 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
14 | 12 |
|
15 | 13 |
|
16 | 14 |
|
... | ... | |
38 | 36 |
/** |
39 | 37 |
* Default alternative nodes to look up when getting a preference. |
40 | 38 |
*/ |
41 |
public static final String[] alternativeNodesQualifiers = new String[]{ChartsEnginePreferences.PREFERENCES_NODE};
|
|
39 |
public static ArrayList<String> alternativeNodesQualifiers = new ArrayList<String>();
|
|
42 | 40 |
|
43 | 41 |
|
44 | 42 |
|
... | ... | |
74 | 72 |
} |
75 | 73 |
// look in the global alternative preferences nodes |
76 | 74 |
else if(!keyExists(nodeQualifier, key)) { |
77 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
78 |
if(keyExists(alternativeNodesQualifiers[i], key)) {
|
|
79 |
nodeQualifier = alternativeNodesQualifiers[i];
|
|
75 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
76 |
if(keyExists(alternativeNodesQualifiers.get(i), key)) {
|
|
77 |
nodeQualifier = alternativeNodesQualifiers.get(i);
|
|
80 | 78 |
break; |
81 | 79 |
} |
82 | 80 |
} |
... | ... | |
138 | 136 |
} |
139 | 137 |
// look in the global alternative preferences nodes |
140 | 138 |
else if(!keyExists(nodeQualifier, key)) { |
141 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
142 |
if(keyExists(alternativeNodesQualifiers[i], key)) {
|
|
143 |
nodeQualifier = alternativeNodesQualifiers[i];
|
|
139 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
140 |
if(keyExists(alternativeNodesQualifiers.get(i), key)) {
|
|
141 |
nodeQualifier = alternativeNodesQualifiers.get(i);
|
|
144 | 142 |
break; |
145 | 143 |
} |
146 | 144 |
} |
... | ... | |
201 | 199 |
} |
202 | 200 |
// look in the global alternative preferences nodes |
203 | 201 |
else if(!keyExists(nodeQualifier, key)) { |
204 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
205 |
if(keyExists(alternativeNodesQualifiers[i], key)) {
|
|
206 |
nodeQualifier = alternativeNodesQualifiers[i];
|
|
202 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
203 |
if(keyExists(alternativeNodesQualifiers.get(i), key)) {
|
|
204 |
nodeQualifier = alternativeNodesQualifiers.get(i);
|
|
207 | 205 |
break; |
208 | 206 |
} |
209 | 207 |
} |
... | ... | |
266 | 264 |
} |
267 | 265 |
// look in the global alternative preferences nodes |
268 | 266 |
else if(!keyExists(nodeQualifier, key)) { |
269 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
270 |
if(keyExists(alternativeNodesQualifiers[i], key)) {
|
|
271 |
nodeQualifier = alternativeNodesQualifiers[i];
|
|
267 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
268 |
if(keyExists(alternativeNodesQualifiers.get(i), key)) {
|
|
269 |
nodeQualifier = alternativeNodesQualifiers.get(i);
|
|
272 | 270 |
break; |
273 | 271 |
} |
274 | 272 |
} |
... | ... | |
331 | 329 |
} |
332 | 330 |
// look in the global alternative preferences nodes |
333 | 331 |
else if(!keyExists(nodeQualifier, key)) { |
334 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
335 |
if(keyExists(alternativeNodesQualifiers[i], key)) {
|
|
336 |
nodeQualifier = alternativeNodesQualifiers[i];
|
|
332 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
333 |
if(keyExists(alternativeNodesQualifiers.get(i), key)) {
|
|
334 |
nodeQualifier = alternativeNodesQualifiers.get(i);
|
|
337 | 335 |
break; |
338 | 336 |
} |
339 | 337 |
} |
... | ... | |
454 | 452 |
} |
455 | 453 |
|
456 | 454 |
// alternative global scope nodes |
457 |
for(int i = 0; i < alternativeNodesQualifiers.length; i++) {
|
|
458 |
System.out.println("TXMPreferences.dump(): Alternative global scope preferences for node " + alternativeNodesQualifiers[i] + ":");
|
|
459 |
dump(alternativeNodesQualifiers[i]);
|
|
455 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) {
|
|
456 |
System.out.println("TXMPreferences.dump(): Alternative global scope preferences for node " + alternativeNodesQualifiers.get(i) + ":");
|
|
457 |
dump(alternativeNodesQualifiers.get(i));
|
|
460 | 458 |
} |
461 | 459 |
} |
462 | 460 |
|
... | ... | |
486 | 484 |
return object.getClass().getName() + '@' + Integer.toHexString(object.hashCode()); |
487 | 485 |
} |
488 | 486 |
|
489 |
/** |
|
490 |
* Initializes the charts engine shared default preferences. |
|
491 |
* @param preferences |
|
492 |
*/ |
|
493 |
public static void initializeChartsEngineSharedPreferences(Preferences preferences) { |
|
494 |
preferences.putBoolean(ChartsEnginePreferences.SHOW_TITLE, true); |
|
495 |
preferences.putBoolean(ChartsEnginePreferences.SHOW_LEGEND, true); |
|
496 |
preferences.putBoolean(ChartsEnginePreferences.SHOW_GRID, true); |
|
497 |
preferences.putInt(ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_COLORS_MODE); |
|
498 |
} |
|
487 |
|
|
499 | 488 |
|
500 | 489 |
} |
tmp/org.txm.core/src/java/org/txm/searchengine/cqp/corpus/Partition.java (revision 195) | ||
---|---|---|
85 | 85 |
|
86 | 86 |
|
87 | 87 |
/** The results stored by class. */ |
88 |
private TreeMap<Class, List<Object>> results = new TreeMap<Class, List<Object>>();
|
|
88 |
private TreeMap<String, List<Object>> results = new TreeMap<String, List<Object>>();
|
|
89 | 89 |
|
90 | 90 |
/** |
91 | 91 |
* Creates a new partition on a corpus given a structure, a property of this |
... | ... | |
455 | 455 |
* @param result the result |
456 | 456 |
*/ |
457 | 457 |
public void storeResult(Object result) { |
458 |
if (!results.containsKey(result.getClass())) results.put(result.getClass(), new ArrayList<Object>());
|
|
459 |
results.get(result.getClass()).add(result); |
|
458 |
if (!results.containsKey(result.getClass().getName())) results.put(result.getClass().getName(), new ArrayList<Object>());
|
|
459 |
results.get(result.getClass().getName()).add(result);
|
|
460 | 460 |
} |
461 | 461 |
|
462 | 462 |
/** |
463 |
* Removes a result stored in thsi corpus.
|
|
463 |
* Removes a result stored in this corpus.
|
|
464 | 464 |
* |
465 | 465 |
* @param result the result |
466 | 466 |
* @return true, if successful |
467 | 467 |
*/ |
468 | 468 |
@Override |
469 | 469 |
public boolean removeResult(Object result) { |
470 |
if (!results.containsKey(result.getClass())) return false; |
|
470 |
if (!results.containsKey(result.getClass().getName())) return false;
|
|
471 | 471 |
|
472 |
boolean ret = results.get(result.getClass()).remove(result); |
|
472 |
boolean ret = results.get(result.getClass().getName()).remove(result);
|
|
473 | 473 |
return ret; |
474 | 474 |
} |
475 | 475 |
|
... | ... | |
481 | 481 |
@Override |
482 | 482 |
public List<Object> getResults() { |
483 | 483 |
ArrayList<Object> tmp = new ArrayList<Object>(); |
484 |
for (Class k : results.keySet()) {
|
|
484 |
for (String k : results.keySet()) {
|
|
485 | 485 |
tmp.addAll(results.get(k)); |
486 | 486 |
} |
487 | 487 |
return tmp; |
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 195) | ||
---|---|---|
43 | 43 |
import java.util.logging.Level; |
44 | 44 |
|
45 | 45 |
import org.apache.commons.lang.StringUtils; |
46 |
import org.txm.chartsengine.core.ChartsEngine; |
|
47 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
48 |
import org.txm.core.preferences.TXMPreferences; |
|
49 | 46 |
import org.txm.importer.cwb.PatchCwbRegistry; |
50 | 47 |
import org.txm.objects.Base; |
51 | 48 |
import org.txm.objects.Workspace; |
... | ... | |
570 | 567 |
stateStatEngine = false; |
571 | 568 |
} |
572 | 569 |
|
573 |
// creates charts engine |
|
574 |
ChartsEngine.createChartsEngines(); |
|
575 |
ChartsEngine.setCurrrentChartsEngine(TXMPreferences.getString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.CURRENT_NAME)); |
|
576 |
|
|
577 |
|
|
578 |
|
|
579 | 570 |
Log.info("Toolbox states: cqp:" + stateSearchEngine + Messages.Toolbox_21 + stateStatEngine + Messages.Toolbox_22 + stateWorkspace); //$NON-NLS-1$ |
580 | 571 |
} catch (Exception e) { |
581 | 572 |
initializing = false; |
Formats disponibles : Unified diff