Révision 1026
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.textsbalance.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
8 | 6 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
15 | 13 |
*/ |
16 | 14 |
public class TextsBalancePreferences extends TXMPreferences { |
17 | 15 |
|
18 |
// auto populate the preference node qualifier from the current bundle id |
|
19 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(TextsBalancePreferences.class).getSymbolicName(); |
|
20 | 16 |
|
21 |
public static final String PREFERENCES_PREFIX = "texts_balance_"; //$NON-NLS-1$ |
|
17 |
public static final String GROUP_BY_TEXTS = "group_by_texts"; //$NON-NLS-1$ |
|
18 |
public static final String METHOD = "method"; //$NON-NLS-1$ |
|
22 | 19 |
|
23 |
public static final String GROUP_BY_TEXTS = PREFERENCES_PREFIX + "group_by_texts"; //$NON-NLS-1$ |
|
24 |
public static final String METHOD = PREFERENCES_PREFIX + "method"; //$NON-NLS-1$ |
|
25 | 20 |
|
26 |
// local result preferences |
|
27 |
public static final String STRUCTURAL_UNIT = PREFERENCES_PREFIX + "structural_unit"; //$NON-NLS-1$ |
|
28 |
public static final String STRUCTURAL_UNIT_PROPERTY = PREFERENCES_PREFIX + "structural_unit_property"; //$NON-NLS-1$ |
|
21 |
/** |
|
22 |
* Gets the instance. |
|
23 |
* @return the instance |
|
24 |
*/ |
|
25 |
public static TXMPreferences getInstance() { |
|
26 |
if (!TXMPreferences.instances.containsKey(TextsBalancePreferences.class)) { |
|
27 |
new TextsBalancePreferences(); |
|
28 |
} |
|
29 |
return TXMPreferences.instances.get(TextsBalancePreferences.class); |
|
30 |
} |
|
31 |
|
|
29 | 32 |
|
30 | 33 |
@Override |
31 | 34 |
public void initializeDefaultPreferences() { |
32 | 35 |
|
33 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
36 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
34 | 37 |
preferences.putBoolean(GROUP_BY_TEXTS, true); |
35 | 38 |
preferences.putInt(METHOD, 2); |
36 | 39 |
|
... | ... | |
40 | 43 |
ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences); |
41 | 44 |
|
42 | 45 |
// to disable the functionality |
43 |
TXMPreferences.setEmpty(PREFERENCES_NODE, ChartsEnginePreferences.SHOW_GRID);
|
|
46 |
TXMPreferences.setEmpty(this.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_GRID);
|
|
44 | 47 |
} |
45 | 48 |
|
46 | 49 |
|
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 1026) | ||
---|---|---|
80 | 80 |
//this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE)); |
81 | 81 |
//System.out.println("ProgressionPreferences.getInstance() " + ProgressionPreferences.PREFERENCES_NODE); |
82 | 82 |
|
83 |
this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.getInstance().getPreferencesNode())); |
|
83 |
this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
84 | 84 |
|
85 | 85 |
//FIXME: description |
86 | 86 |
//setDescription("Progression"); |
tmp/org.txm.partition.core/src/org/txm/partition/core/preferences/PartitionDimensionsPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.partition.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
8 | 6 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
14 | 12 |
*/ |
15 | 13 |
public class PartitionDimensionsPreferences extends TXMPreferences { |
16 | 14 |
|
17 |
// auto populate the preference node qualifier from the current bundle id |
|
18 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(PartitionDimensionsPreferences.class).getSymbolicName(); |
|
19 | 15 |
|
20 |
public static final String PREFERENCES_PREFIX = "partition_"; //$NON-NLS-1$ |
|
21 | 16 |
|
22 |
public static final String CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE = PREFERENCES_PREFIX + "chart_dimensions_display_parts_count_in_title"; //$NON-NLS-1$
|
|
23 |
public static final String CHART_DIMENSIONS_SORT_BY_SIZE = PREFERENCES_PREFIX + "chart_dimensions_sort_by_parts_size"; //$NON-NLS-1$
|
|
17 |
public static final String CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE = "chart_dimensions_display_parts_count_in_title"; //$NON-NLS-1$ |
|
18 |
public static final String CHART_DIMENSIONS_SORT_BY_SIZE = "chart_dimensions_sort_by_parts_size"; //$NON-NLS-1$ |
|
24 | 19 |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* Gets the instance. |
|
24 |
* @return the instance |
|
25 |
*/ |
|
26 |
public static TXMPreferences getInstance() { |
|
27 |
if (!TXMPreferences.instances.containsKey(PartitionDimensionsPreferences.class)) { |
|
28 |
new PartitionDimensionsPreferences(); |
|
29 |
} |
|
30 |
return TXMPreferences.instances.get(PartitionDimensionsPreferences.class); |
|
31 |
} |
|
32 |
|
|
33 |
|
|
25 | 34 |
@Override |
26 | 35 |
public void initializeDefaultPreferences() { |
27 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
36 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
28 | 37 |
preferences.putBoolean(CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, true); |
29 | 38 |
preferences.putBoolean(CHART_DIMENSIONS_SORT_BY_SIZE, false); |
30 | 39 |
|
... | ... | |
32 | 41 |
ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences); |
33 | 42 |
|
34 | 43 |
// disable unavailable functionality |
35 |
TXMPreferences.setEmpty(PREFERENCES_NODE, ChartsEnginePreferences.SHOW_LEGEND);
|
|
44 |
TXMPreferences.setEmpty(this.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_LEGEND);
|
|
36 | 45 |
|
37 | 46 |
} |
38 | 47 |
|
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.core.ChartsEngine; |
8 | 6 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
16 | 14 |
public class ChartsEnginePreferences extends TXMPreferences { |
17 | 15 |
|
18 | 16 |
|
19 |
// auto populate the preference node qualifier from the current bundle id |
|
20 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(ChartsEnginePreferences.class).getSymbolicName(); |
|
21 |
|
|
22 | 17 |
/** |
23 | 18 |
* The name of the current charts engine. |
24 | 19 |
*/ |
... | ... | |
88 | 83 |
public final static String DEFAULT_CHART_TYPE = "[Default]"; //$NON-NLS-1$ |
89 | 84 |
|
90 | 85 |
|
86 |
/** |
|
87 |
* Gets the instance. |
|
88 |
* @return the instance |
|
89 |
*/ |
|
90 |
public static TXMPreferences getInstance() { |
|
91 |
if (!TXMPreferences.instances.containsKey(ChartsEnginePreferences.class)) { |
|
92 |
new ChartsEnginePreferences(); |
|
93 |
} |
|
94 |
return TXMPreferences.instances.get(ChartsEnginePreferences.class); |
|
95 |
} |
|
96 |
|
|
97 |
|
|
91 | 98 |
@Override |
92 | 99 |
public void initializeDefaultPreferences() { |
93 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
100 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
94 | 101 |
|
95 | 102 |
preferences.put(CURRENT_NAME, "jfreechart_charts_engine"); //$NON-NLS-1$ |
96 | 103 |
preferences.put(DEFAULT_EXPORT_FORMAT, "svg"); //$NON-NLS-1$ |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/Theme.java (revision 1026) | ||
---|---|---|
7 | 7 |
import java.util.ArrayList; |
8 | 8 |
|
9 | 9 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
10 |
import org.txm.core.preferences.TXMPreferences; |
|
11 | 10 |
|
12 | 11 |
/** |
13 | 12 |
* Base theme for charts. |
... | ... | |
48 | 47 |
*/ |
49 | 48 |
public Theme() { |
50 | 49 |
|
51 |
this.setMonochromeColor(TXMPreferences.getString(ChartsEnginePreferences.MONOCHROME_COLOR, ChartsEnginePreferences.PREFERENCES_NODE));
|
|
50 |
this.setMonochromeColor(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.MONOCHROME_COLOR));
|
|
52 | 51 |
|
53 | 52 |
this.palette1 = new ArrayList<Color>(1); |
54 | 53 |
this.palette5 = new ArrayList<Color>(5); |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java (revision 1026) | ||
---|---|---|
38 | 38 |
|
39 | 39 |
//ChartsEngine.setCurrrentChartsEngine(this.getEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE))); |
40 | 40 |
|
41 |
this.setCurrentEngine(TXMPreferences.getString(ChartsEnginePreferences.CURRENT_NAME, ChartsEnginePreferences.PREFERENCES_NODE));
|
|
41 |
this.setCurrentEngine(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.CURRENT_NAME));
|
|
42 | 42 |
|
43 | 43 |
|
44 | 44 |
|
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 1026) | ||
---|---|---|
9 | 9 |
import org.eclipse.core.runtime.CoreException; |
10 | 10 |
import org.eclipse.core.runtime.IConfigurationElement; |
11 | 11 |
import org.eclipse.core.runtime.Platform; |
12 |
import org.eclipse.core.runtime.RegistryFactory; |
|
13 | 12 |
import org.txm.Toolbox; |
14 | 13 |
import org.txm.chartsengine.core.messages.ChartsEngineCoreMessages; |
15 | 14 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
... | ... | |
74 | 73 |
|
75 | 74 |
|
76 | 75 |
static { |
77 |
TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.PREFERENCES_NODE);
|
|
76 |
TXMPreferences.alternativeNodesQualifiers.add(ChartsEnginePreferences.getInstance().getPreferencesNodeQualifier());
|
|
78 | 77 |
} |
79 | 78 |
|
80 | 79 |
/** |
... | ... | |
388 | 387 |
* @return |
389 | 388 |
*/ |
390 | 389 |
public static Font createFont() { |
391 |
return createFont(TXMPreferences.getString(ChartsEnginePreferences.FONT, ChartsEnginePreferences.PREFERENCES_NODE));
|
|
390 |
return createFont(ChartsEnginePreferences.getInstance().getString(ChartsEnginePreferences.FONT));
|
|
392 | 391 |
} |
393 | 392 |
|
394 | 393 |
/** |
... | ... | |
399 | 398 |
public File createTmpFile(String prefix) { |
400 | 399 |
File file = null; |
401 | 400 |
try { |
402 |
File resultsDir = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE), "results"); //$NON-NLS-1$
|
|
401 |
File resultsDir = new File(Toolbox.getTxmHomePath(), "results"); //$NON-NLS-1$
|
|
403 | 402 |
resultsDir.mkdirs(); |
404 | 403 |
|
405 | 404 |
// right padding to 3 characters long |
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1026) | ||
---|---|---|
285 | 285 |
this.standardComparators = new ArrayList<LineComparator>(); |
286 | 286 |
this.userDefinedComparators = new ArrayList<LineComparator>(); |
287 | 287 |
this.setStandardComparators(); |
288 |
concordance.setNLinePerPage(TXMPreferences.getInt(ConcordancePreferences.N_LINES_PER_PAGE, ConcordancePreferences.PREFERENCES_NODE));
|
|
288 |
concordance.setNLinePerPage(ConcordancePreferences.getInstance().getInt(ConcordancePreferences.N_LINES_PER_PAGE));
|
|
289 | 289 |
} |
290 | 290 |
|
291 | 291 |
|
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/preferences/ConcordancePreferencePage.java (revision 1026) | ||
---|---|---|
59 | 59 |
|
60 | 60 |
@Override |
61 | 61 |
public void init(IWorkbench workbench) { |
62 |
this.setPreferenceStore(new TXMPreferenceStore(ConcordancePreferences.PREFERENCES_NODE));
|
|
62 |
this.setPreferenceStore(new TXMPreferenceStore(ConcordancePreferences.getInstance().getPreferencesNodeQualifier()));
|
|
63 | 63 |
this.setTitle(ConcordanceUIMessages.ConcordancerPreferencePage_3); |
64 | 64 |
this.setImageDescriptor(ConcordanceAdapterFactory.ICON); |
65 | 65 |
} |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/preferences/JFCChartsEnginePreferencePage.java (revision 1026) | ||
---|---|---|
81 | 81 |
|
82 | 82 |
@Override |
83 | 83 |
public void init(IWorkbench workbench) { |
84 |
this.setPreferenceStore(new TXMPreferenceStore(JFCChartsEnginePreferences.PREFERENCE_NODE));
|
|
84 |
this.setPreferenceStore(new TXMPreferenceStore(JFCChartsEnginePreferences.getInstance().getPreferencesNodeQualifier()));
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
@Override |
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/jfreechart/themes/highcharts/chartcreators/JFCCAChartCreator.java (revision 1026) | ||
---|---|---|
60 | 60 |
|
61 | 61 |
chart = ChartFactory.createScatterPlot(Utils.createCAFactorialMapChartTitle(ca), |
62 | 62 |
"", "", dataset, PlotOrientation.VERTICAL, |
63 |
TXMPreferences.getBoolean(ChartsEnginePreferences.SHOW_LEGEND, |
|
64 |
CAPreferences.PREFERENCES_NODE), false, false); |
|
63 |
CAPreferences.getInstance().getBoolean(ChartsEnginePreferences.SHOW_LEGEND), false, false); |
|
65 | 64 |
|
66 | 65 |
// Custom renderer |
67 | 66 |
chart.getXYPlot().setRenderer(new CAItemSelectionRenderer(ca, chart)); |
tmp/org.txm.ca.core/src/org/txm/ca/core/preferences/CAPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.ca.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
8 | 6 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
16 | 14 |
*/ |
17 | 15 |
public class CAPreferences extends TXMPreferences { |
18 | 16 |
|
19 |
// auto populate the preference node qualifier from the current bundle id |
|
20 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(CAPreferences.class).getSymbolicName(); |
|
21 |
|
|
22 |
|
|
23 | 17 |
/** The Constant QUALITYDISPLAY. */ |
24 | 18 |
public static final String QUALITY_DISPLAY_FORMAT = "quality_display_format"; //$NON-NLS-1$ |
25 | 19 |
|
... | ... | |
48 | 42 |
public static final String SHOW_POINT_SHAPES = "chart_show_point_shapes"; //$NON-NLS-1$ |
49 | 43 |
|
50 | 44 |
|
45 |
/** |
|
46 |
* Gets the instance. |
|
47 |
* @return the instance |
|
48 |
*/ |
|
49 |
public static TXMPreferences getInstance() { |
|
50 |
if (!TXMPreferences.instances.containsKey(CAPreferences.class)) { |
|
51 |
new CAPreferences(); |
|
52 |
} |
|
53 |
return TXMPreferences.instances.get(CAPreferences.class); |
|
54 |
} |
|
51 | 55 |
|
56 |
|
|
52 | 57 |
@Override |
53 | 58 |
public void initializeDefaultPreferences() { |
54 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
59 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
55 | 60 |
|
56 | 61 |
preferences.putInt(F_MIN, 10); |
57 | 62 |
preferences.putInt(V_MAX, 200); |
... | ... | |
78 | 83 |
ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences); |
79 | 84 |
|
80 | 85 |
// disable unavailable functionality |
81 |
TXMPreferences.setEmpty(PREFERENCES_NODE, ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
86 |
TXMPreferences.setEmpty(this.getPreferencesNodeQualifier(), ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
82 | 87 |
|
83 | 88 |
} |
84 | 89 |
|
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 1026) | ||
---|---|---|
45 | 45 |
import org.rosuda.REngine.REngineException; |
46 | 46 |
import org.rosuda.REngine.Rserve.RConnection; |
47 | 47 |
import org.rosuda.REngine.Rserve.RserveException; |
48 |
import org.txm.Toolbox; |
|
48 | 49 |
import org.txm.core.preferences.TBXPreferences; |
49 | 50 |
import org.txm.core.preferences.TXMPreferences; |
50 | 51 |
import org.txm.statsengine.core.StatException; |
... | ... | |
247 | 248 |
//TODO: this method uses the right directory ? |
248 | 249 |
//Bundle bundle = FrameworkUtil.getBundle(RWorkspace.class); |
249 | 250 |
//File userdir = new File(bundle.getLocation()); |
250 |
File userDir = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE), "R");
|
|
251 |
File userDir = new File(Toolbox.getTxmHomePath(), "R");
|
|
251 | 252 |
//System.out.println("BUNDLE LOCATION OF '" + bundle.getSymbolicName() + "': " + userDir); |
252 | 253 |
workspace = new RWorkspace(userDir); |
253 | 254 |
} |
tmp/org.txm.chartsengine.graphstream.core/src/org/txm/chartsengine/graphstream/core/GSChartsEngine.java (revision 1026) | ||
---|---|---|
41 | 41 |
* Creates a GraphStream charts engine with output format from the preferences. |
42 | 42 |
*/ |
43 | 43 |
public GSChartsEngine() { |
44 |
this(TXMPreferences.getString(GSChartsEnginePreferences.OUTPUT_FORMAT, GSChartsEnginePreferences.PREFERENCE_NODE));
|
|
44 |
this(GSChartsEnginePreferences.getInstance().getString(GSChartsEnginePreferences.OUTPUT_FORMAT));
|
|
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
|
tmp/org.txm.chartsengine.graphstream.core/src/org/txm/chartsengine/graphstream/core/preferences/GSChartsEnginePreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.graphstream.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.graphstream.core.GSChartsEngine; |
8 | 6 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
16 | 14 |
public class GSChartsEnginePreferences extends TXMPreferences { |
17 | 15 |
|
18 | 16 |
|
19 |
public static final String PREFERENCE_NODE = FrameworkUtil.getBundle(GSChartsEnginePreferences.class).getSymbolicName(); |
|
20 |
|
|
21 |
|
|
22 | 17 |
public final static String PREFERENCES_PREFIX = GSChartsEngine.NAME + "_"; |
23 | 18 |
|
24 |
|
|
25 | 19 |
public static final String OUTPUT_FORMAT = PREFERENCES_PREFIX + "output_format"; //$NON-NLS-1$ |
26 | 20 |
|
27 |
|
|
21 |
|
|
28 | 22 |
/** |
29 |
* |
|
23 |
* Gets the instance. |
|
24 |
* @return the instance |
|
30 | 25 |
*/ |
31 |
public GSChartsEnginePreferences() { |
|
32 |
// TODO Auto-generated constructor stub |
|
26 |
public static TXMPreferences getInstance() { |
|
27 |
if (!TXMPreferences.instances.containsKey(GSChartsEnginePreferences.class)) { |
|
28 |
new GSChartsEnginePreferences(); |
|
29 |
} |
|
30 |
return TXMPreferences.instances.get(GSChartsEnginePreferences.class); |
|
33 | 31 |
} |
34 | 32 |
|
33 |
|
|
35 | 34 |
@Override |
36 | 35 |
public void initializeDefaultPreferences() { |
37 |
Preferences defaultPreferences = DefaultScope.INSTANCE.getNode(PREFERENCE_NODE);
|
|
36 |
Preferences defaultPreferences = this.getDefaultPreferencesNode();
|
|
38 | 37 |
defaultPreferences.put(OUTPUT_FORMAT, GSChartsEngine.OUTPUT_FORMAT_GRAPHSTREAM); |
39 | 38 |
} |
40 | 39 |
|
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 1026) | ||
---|---|---|
88 | 88 |
int minright = 1; |
89 | 89 |
int maxright = 50; |
90 | 90 |
|
91 |
int minf = TXMPreferences.getInt(TXMPreferences.F_MIN, CooccurrencePreferences.PREFERENCES_NODE);
|
|
92 |
int mincof = TXMPreferences.getInt(CooccurrencePreferences.MIN_COUNT, CooccurrencePreferences.PREFERENCES_NODE);
|
|
93 |
int minscore = (int) TXMPreferences.getDouble(CooccurrencePreferences.MIN_SCORE, CooccurrencePreferences.PREFERENCES_NODE);
|
|
94 |
boolean buildLexicalTableWithCooccurrents = TXMPreferences.getBoolean(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE, CooccurrencePreferences.PREFERENCES_NODE);
|
|
91 |
int minf = CooccurrencePreferences.getInstance().getInt(TXMPreferences.F_MIN);
|
|
92 |
int mincof = CooccurrencePreferences.getInstance().getInt(CooccurrencePreferences.MIN_COUNT);
|
|
93 |
int minscore = (int) CooccurrencePreferences.getInstance().getDouble(CooccurrencePreferences.MIN_SCORE);
|
|
94 |
boolean buildLexicalTableWithCooccurrents = CooccurrencePreferences.getInstance().getBoolean(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE);
|
|
95 | 95 |
|
96 | 96 |
StructuralUnit limit = null; |
97 | 97 |
Query query = null; |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/preferences/CoocPreferencePage.java (revision 1026) | ||
---|---|---|
97 | 97 |
|
98 | 98 |
@Override |
99 | 99 |
public void init(IWorkbench workbench) { |
100 |
this.setPreferenceStore(new TXMPreferenceStore(CooccurrencePreferences.PREFERENCES_NODE));
|
|
100 |
this.setPreferenceStore(new TXMPreferenceStore(CooccurrencePreferences.getInstance().getPreferencesNodeQualifier()));
|
|
101 | 101 |
//setDescription("Cooccurrences"); |
102 | 102 |
this.setTitle(CooccurrenceUIMessages.CoocPreferencePage_5); |
103 | 103 |
this.setImageDescriptor(CooccurrenceAdapterFactory.ICON); |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/LineLabelProvider.java (revision 1026) | ||
---|---|---|
45 | 45 |
public class LineLabelProvider implements ITableLabelProvider { |
46 | 46 |
|
47 | 47 |
/** The format. */ |
48 |
String format = TXMPreferences.getString(CooccurrencePreferences.SCORE_FORMAT, CooccurrencePreferences.PREFERENCES_NODE);
|
|
48 |
String format = CooccurrencePreferences.getInstance().getString(CooccurrencePreferences.SCORE_FORMAT);
|
|
49 | 49 |
|
50 | 50 |
/* (non-Javadoc) |
51 | 51 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/preferences/RChartsEnginePreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.r.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.chartsengine.core.ChartsEngine; |
8 | 6 |
import org.txm.chartsengine.r.core.RChartsEngine; |
... | ... | |
17 | 15 |
public class RChartsEnginePreferences extends TXMPreferences { |
18 | 16 |
|
19 | 17 |
|
20 |
public static final String PREFERENCE_NODE = FrameworkUtil.getBundle(RChartsEnginePreferences.class).getSymbolicName(); |
|
21 |
|
|
22 |
|
|
23 | 18 |
public final static String PREFERENCES_PREFIX = RChartsEngine.NAME + "_"; |
24 | 19 |
|
25 | 20 |
|
26 | 21 |
public static final String OUTPUT_FORMAT = PREFERENCES_PREFIX + "output_format"; //$NON-NLS-1$ |
27 | 22 |
|
28 | 23 |
|
29 |
public RChartsEnginePreferences() { |
|
30 |
// TODO Auto-generated constructor stub |
|
24 |
|
|
25 |
/** |
|
26 |
* Gets the instance. |
|
27 |
* @return the instance |
|
28 |
*/ |
|
29 |
public static TXMPreferences getInstance() { |
|
30 |
if (!TXMPreferences.instances.containsKey(RChartsEnginePreferences.class)) { |
|
31 |
new RChartsEnginePreferences(); |
|
32 |
} |
|
33 |
return TXMPreferences.instances.get(RChartsEnginePreferences.class); |
|
31 | 34 |
} |
32 | 35 |
|
36 |
|
|
33 | 37 |
@Override |
34 | 38 |
public void initializeDefaultPreferences() { |
35 |
Preferences defaultPreferences = DefaultScope.INSTANCE.getNode(PREFERENCE_NODE);
|
|
39 |
Preferences defaultPreferences = this.getDefaultPreferencesNode();
|
|
36 | 40 |
defaultPreferences.put(OUTPUT_FORMAT, ChartsEngine.OUTPUT_FORMAT_SVG); |
37 | 41 |
} |
38 | 42 |
|
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 1026) | ||
---|---|---|
63 | 63 |
* Creates a R charts engine implementation. |
64 | 64 |
*/ |
65 | 65 |
public RChartsEngine() { |
66 |
this(TXMPreferences.getString(RChartsEnginePreferences.OUTPUT_FORMAT, RChartsEnginePreferences.PREFERENCE_NODE));
|
|
66 |
this(RChartsEnginePreferences.getInstance().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
|
|
67 | 67 |
} |
68 |
|
|
69 | 68 |
|
70 |
|
|
71 | 69 |
|
72 | 70 |
@Override |
73 | 71 |
public File createChartFile(Object chart, File file) { |
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationWriter.java (revision 1026) | ||
---|---|---|
90 | 90 |
List<String> textsIds = corpus.getTextsID(); |
91 | 91 |
System.out.println("Exporting annotations of "+StringUtils.join(textsIds, ", ")+"."); |
92 | 92 |
|
93 |
File resultDirectory = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE), "results/"+corpus.getName()+"_annotations");
|
|
93 |
File resultDirectory = new File(Toolbox.getTxmHomePath(), "results/"+corpus.getName()+"_annotations");
|
|
94 | 94 |
DeleteDir.deleteDirectory(resultDirectory); |
95 | 95 |
resultDirectory.mkdirs(); |
96 | 96 |
if (!(resultDirectory.exists() && resultDirectory.canWrite())) { |
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/preferences/AnnotationPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.annotation.kr.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.core.preferences.TXMPreferences; |
8 | 6 |
|
... | ... | |
15 | 13 |
public class AnnotationPreferences extends TXMPreferences { |
16 | 14 |
|
17 | 15 |
|
18 |
// auto populate the preference node qualifier from the current bundle id |
|
19 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(AnnotationPreferences.class).getSymbolicName(); |
|
20 |
|
|
21 | 16 |
public static final String ANNOTATION_MODE = "annotation_mode"; |
22 | 17 |
|
23 |
public AnnotationPreferences() { |
|
24 |
// TODO Auto-generated constructor stub |
|
18 |
/** |
|
19 |
* Gets the instance. |
|
20 |
* @return the instance |
|
21 |
*/ |
|
22 |
public static TXMPreferences getInstance() { |
|
23 |
if (!TXMPreferences.instances.containsKey(AnnotationPreferences.class)) { |
|
24 |
new AnnotationPreferences(); |
|
25 |
} |
|
26 |
return TXMPreferences.instances.get(AnnotationPreferences.class); |
|
25 | 27 |
} |
26 | 28 |
|
29 |
|
|
27 | 30 |
@Override |
28 | 31 |
public void initializeDefaultPreferences() { |
29 | 32 |
|
30 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
33 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
31 | 34 |
preferences.put(ANNOTATION_MODE, "simple"); |
32 | 35 |
} |
33 | 36 |
} |
tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/preferences/TextsBalancePreferencePage.java (revision 1026) | ||
---|---|---|
87 | 87 |
*/ |
88 | 88 |
@Override |
89 | 89 |
public void init(IWorkbench workbench) { |
90 |
this.setPreferenceStore(new TXMPreferenceStore(TextsBalancePreferences.PREFERENCES_NODE));
|
|
90 |
this.setPreferenceStore(new TXMPreferenceStore(TextsBalancePreferences.getInstance().getPreferencesNodeQualifier()));
|
|
91 | 91 |
this.setDescription("Texts balance charts."); |
92 | 92 |
this.setImageDescriptor(TextsBalanceAdapterFactory.ICON); |
93 | 93 |
} |
tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java (revision 1026) | ||
---|---|---|
15 | 15 |
public class ProgressionPreferences extends TXMPreferences { |
16 | 16 |
|
17 | 17 |
|
18 |
// auto populate the preference node qualifier from the current bundle id |
|
19 |
//public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(ProgressionPreferences.class).getSymbolicName(); |
|
20 |
|
|
21 |
|
|
22 | 18 |
/** The Constant REPEAT_VALUES. */ |
23 | 19 |
public static final String REPEAT_SAME_VALUES = "repeat_same_values"; //$NON-NLS-1$ |
24 | 20 |
|
... | ... | |
35 | 31 |
|
36 | 32 |
/** |
37 | 33 |
* Gets the instance. |
38 |
* @return |
|
34 |
* @return the instance
|
|
39 | 35 |
*/ |
40 | 36 |
public static TXMPreferences getInstance() { |
41 | 37 |
if (!TXMPreferences.instances.containsKey(ProgressionPreferences.class)) { |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 1026) | ||
---|---|---|
53 | 53 |
public SpecificitiesTableLabelProvider() { |
54 | 54 |
//this.partindexes = partindexes; |
55 | 55 |
//showPValues = "true".equals(Toolbox.getParam(SpecificitiesPreferencePage.SPECIF_PVALUES)); //$NON-NLS-1$ |
56 |
this.format = TXMPreferences.getString(SpecificitiesPreferences.FORMAT, SpecificitiesPreferences.PREFERENCES_NODE);
|
|
56 |
this.format = SpecificitiesPreferences.getInstance().getString(SpecificitiesPreferences.FORMAT);
|
|
57 | 57 |
if (format == null || format.trim().length() == 0) { |
58 | 58 |
format = "%,.1f"; //$NON-NLS-1$ |
59 | 59 |
} |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/preferences/SpecificitiesPreferencePage.java (revision 1026) | ||
---|---|---|
90 | 90 |
|
91 | 91 |
@Override |
92 | 92 |
public void init(IWorkbench workbench) { |
93 |
this.setPreferenceStore(new TXMPreferenceStore(SpecificitiesPreferences.PREFERENCES_NODE));
|
|
93 |
this.setPreferenceStore(new TXMPreferenceStore(SpecificitiesPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
94 | 94 |
this.setTitle(SpecificitiesUIMessages.SpecificitiesPreferencePage_2); |
95 | 95 |
this.setImageDescriptor(SpecificitiesAdapterFactory.ICON); |
96 | 96 |
} |
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/LemmaProjection.java (revision 1026) | ||
---|---|---|
220 | 220 |
FileCopy.copyFiles(txmDirectory, previousXMLTXMDirectory); |
221 | 221 |
|
222 | 222 |
// work |
223 |
File noMatchsFile = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE), "results/nomatch.txt");
|
|
223 |
File noMatchsFile = new File(Toolbox.getTxmHomePath(), "results/nomatch.txt");
|
|
224 | 224 |
HashSet<String> noMatchsSet = new HashSet<String>(); |
225 | 225 |
ConsoleProgressBar cpb = new ConsoleProgressBar(files.length); |
226 | 226 |
for (File xmlFile : files) { |
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/RemoveProperties.java (revision 1026) | ||
---|---|---|
108 | 108 |
FileCopy.copyFiles(txmDirectory, previousXMLTXMDirectory); |
109 | 109 |
|
110 | 110 |
// work |
111 |
File noMatchsFile = new File(TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE), "results/nomatch.txt");
|
|
111 |
File noMatchsFile = new File(Toolbox.getTxmHomePath(), "results/nomatch.txt");
|
|
112 | 112 |
HashSet<String> noMatchsSet = new HashSet<String>(); |
113 | 113 |
ConsoleProgressBar cpb = new ConsoleProgressBar(files.length); |
114 | 114 |
for (File xmlFile : files) { |
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java (revision 1026) | ||
---|---|---|
343 | 343 |
// Call treetagger-train |
344 | 344 |
if (ttSrcFile.exists() && lexique2.exists() && openclassfile.exists()) { |
345 | 345 |
System.out.println("Running "); |
346 |
String treetaggerBinDirectory = new File(TXMPreferences.getString(TreeTaggerPreferences.INSTALL_PATH, TBXPreferences.PREFERENCES_NODE), "bin").getAbsolutePath();
|
|
346 |
String treetaggerBinDirectory = new File(TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH), "bin").getAbsolutePath();
|
|
347 | 347 |
if (!treetaggerBinDirectory.endsWith("/")) treetaggerBinDirectory += "/"; |
348 | 348 |
|
349 | 349 |
TreeTagger tt = new TreeTagger(treetaggerBinDirectory, options); |
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/preferences/TreeTaggerPreferencePage.java (revision 1026) | ||
---|---|---|
57 | 57 |
|
58 | 58 |
@Override |
59 | 59 |
public void init(IWorkbench workbench) { |
60 |
this.setPreferenceStore(new TXMPreferenceStore(TreeTaggerPreferences.PREFERENCES_NODE));
|
|
60 |
this.setPreferenceStore(new TXMPreferenceStore(TreeTaggerPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
} |
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 1026) | ||
---|---|---|
232 | 232 |
+"\n };" |
233 | 233 |
+"\n}" |
234 | 234 |
+"\n} catch(e) {Element.prototype.scrollIntoViewIfNeeded = Element.prototype.scrollIntoView}"; |
235 |
protected boolean fastWordHighLight = TXMPreferences.getBoolean(SynopticEditionPreferences.FAST_HIGHLIGHT, SynopticEditionPreferences.PREFERENCES_NODE);
|
|
235 |
protected boolean fastWordHighLight = SynopticEditionPreferences.getInstance().getBoolean(SynopticEditionPreferences.FAST_HIGHLIGHT);
|
|
236 | 236 |
private ArrayList<ProgressListener> beforeHighlighListeners; |
237 | 237 |
public ArrayList<ProgressListener> getBeforeHighlighListeners() { |
238 | 238 |
return beforeHighlighListeners; |
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/preferences/SynopticEditionPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.edition.rcp.preferences; |
2 | 2 |
|
3 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
4 |
import org.osgi.framework.FrameworkUtil; |
|
5 | 3 |
import org.osgi.service.prefs.Preferences; |
6 | 4 |
import org.txm.core.preferences.TXMPreferences; |
7 | 5 |
|
... | ... | |
14 | 12 |
*/ |
15 | 13 |
public class SynopticEditionPreferences extends TXMPreferences { |
16 | 14 |
|
17 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(SynopticEditionPreferences.class).getSymbolicName(); |
|
18 | 15 |
|
19 | 16 |
/** |
20 | 17 |
* |
21 | 18 |
*/ |
22 | 19 |
public static final String FAST_HIGHLIGHT = "fast_highlight"; //$NON-NLS-1$ |
23 | 20 |
|
21 |
|
|
22 |
/** |
|
23 |
* Gets the instance. |
|
24 |
* @return the instance |
|
25 |
*/ |
|
26 |
public static TXMPreferences getInstance() { |
|
27 |
if (!TXMPreferences.instances.containsKey(SynopticEditionPreferences.class)) { |
|
28 |
new SynopticEditionPreferences(); |
|
29 |
} |
|
30 |
return TXMPreferences.instances.get(SynopticEditionPreferences.class); |
|
31 |
} |
|
32 |
|
|
24 | 33 |
@Override |
25 | 34 |
public void initializeDefaultPreferences() { |
26 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
35 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
27 | 36 |
preferences.putBoolean(FAST_HIGHLIGHT, true); |
28 | 37 |
} |
29 | 38 |
} |
tmp/org.txm.index.core/src/org/txm/index/core/preferences/IndexPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.index.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.core.preferences.TXMPreferences; |
8 | 6 |
|
... | ... | |
14 | 12 |
*/ |
15 | 13 |
public class IndexPreferences extends TXMPreferences { |
16 | 14 |
|
17 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(IndexPreferences.class).getSymbolicName(); |
|
18 |
|
|
19 |
|
|
20 | 15 |
/** |
21 | 16 |
* |
22 | 17 |
*/ |
23 | 18 |
public static final String PROPERTIES_SEPARATOR = "properties_separator"; //$NON-NLS-1$ |
24 | 19 |
|
25 | 20 |
/** |
26 |
* |
|
21 |
* Number of the line of the current page.
|
|
27 | 22 |
*/ |
28 | 23 |
public static final String N_TOP_INDEX = "n_top_index"; //$NON-NLS-1$ |
29 | 24 |
|
25 |
/** |
|
26 |
* Gets the instance. |
|
27 |
* @return the instance |
|
28 |
*/ |
|
29 |
public static TXMPreferences getInstance() { |
|
30 |
if (!TXMPreferences.instances.containsKey(IndexPreferences.class)) { |
|
31 |
new IndexPreferences(); |
|
32 |
} |
|
33 |
return TXMPreferences.instances.get(IndexPreferences.class); |
|
34 |
} |
|
35 |
|
|
36 |
|
|
30 | 37 |
@Override |
31 | 38 |
public void initializeDefaultPreferences() { |
32 | 39 |
|
33 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
40 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
34 | 41 |
preferences.put(UNIT_PROPERTIES, DEFAULT_UNIT_PROPERTY); //$NON-NLS-1$ |
35 | 42 |
preferences.put(UNIT_PROPERTY, DEFAULT_UNIT_PROPERTY); //$NON-NLS-1$ |
36 | 43 |
preferences.put(PROPERTIES_SEPARATOR, "_"); //$NON-NLS-1$ |
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/preferences/CooccurrencePreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.cooccurrence.core.preferences; |
2 | 2 |
|
3 | 3 |
|
4 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
5 |
import org.osgi.framework.FrameworkUtil; |
|
6 | 4 |
import org.osgi.service.prefs.Preferences; |
7 | 5 |
import org.txm.core.preferences.TXMPreferences; |
8 | 6 |
|
... | ... | |
15 | 13 |
*/ |
16 | 14 |
public class CooccurrencePreferences extends TXMPreferences { |
17 | 15 |
|
18 |
|
|
19 |
// auto populate the preference node qualifier from the current bundle id |
|
20 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(CooccurrencePreferences.class).getSymbolicName(); |
|
21 |
|
|
22 | 16 |
/** The Constant SCOREFORMAT. */ |
23 | 17 |
public static final String SCORE_FORMAT = "score_format"; //$NON-NLS-1$ |
24 | 18 |
|
... | ... | |
43 | 37 |
|
44 | 38 |
|
45 | 39 |
/** |
46 |
* |
|
40 |
* Gets the instance. |
|
41 |
* @return the instance |
|
47 | 42 |
*/ |
48 |
public CooccurrencePreferences() { |
|
49 |
// TODO Auto-generated constructor stub |
|
43 |
public static TXMPreferences getInstance() { |
|
44 |
if (!TXMPreferences.instances.containsKey(CooccurrencePreferences.class)) { |
|
45 |
new CooccurrencePreferences(); |
|
46 |
} |
|
47 |
return TXMPreferences.instances.get(CooccurrencePreferences.class); |
|
50 | 48 |
} |
51 | 49 |
|
50 |
|
|
52 | 51 |
@Override |
53 | 52 |
public void initializeDefaultPreferences() { |
54 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
53 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
55 | 54 |
|
56 | 55 |
preferences.put(SCORE_FORMAT, "E00"); //$NON-NLS-1$ |
57 | 56 |
preferences.putInt(F_MIN, 2); |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/preferences/LexicalTablePreferencePage.java (revision 1026) | ||
---|---|---|
63 | 63 |
|
64 | 64 |
@Override |
65 | 65 |
public void init(IWorkbench workbench) { |
66 |
this.setPreferenceStore(new TXMPreferenceStore(LexicalTablePreferences.PREFERENCES_NODE));
|
|
66 |
this.setPreferenceStore(new TXMPreferenceStore(LexicalTablePreferences.getInstance().getPreferencesNodeQualifier()));
|
|
67 | 67 |
this.setTitle(LexicalTableCoreMessages.RESULT_TYPE); |
68 | 68 |
this.setImageDescriptor(LexicalTableAdapterFactory.ICON); |
69 | 69 |
} |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 1026) | ||
---|---|---|
41 | 41 |
import org.txm.ca.core.functions.CA; |
42 | 42 |
import org.txm.ca.core.preferences.CAPreferences; |
43 | 43 |
import org.txm.ca.rcp.editors.CAParametersDialog; |
44 |
import org.txm.ca.rcp.messages.CAUIMessages; |
|
45 | 44 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
46 | 45 |
import org.txm.core.messages.TXMCoreMessages; |
47 | 46 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
108 | 107 |
} |
109 | 108 |
try { |
110 | 109 |
String title = AHCUIMessages.bind(AHCUIMessages.ComputeCAH_0, partition.getName()); |
111 |
int vMax = TXMPreferences.getInt(TXMPreferences.V_MAX, CAPreferences.PREFERENCES_NODE);
|
|
112 |
int fMin = TXMPreferences.getInt(TXMPreferences.F_MIN, CAPreferences.PREFERENCES_NODE);
|
|
110 |
int vMax = CAPreferences.getInstance().getInt(TXMPreferences.V_MAX);
|
|
111 |
int fMin = CAPreferences.getInstance().getInt(TXMPreferences.F_MIN);
|
|
113 | 112 |
Shell shell = Display.getCurrent().getActiveShell(); |
114 | 113 |
CAParametersDialog d = new CAParametersDialog(shell, partition.getParent(), title); |
115 | 114 |
d.setFminAndVMax(fMin, vMax); |
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/preferences/AHCPreferencePage.java (revision 1026) | ||
---|---|---|
88 | 88 |
|
89 | 89 |
@Override |
90 | 90 |
public void init(IWorkbench workbench) { |
91 |
this.setPreferenceStore(new TXMPreferenceStore(AHCPreferences.PREFERENCES_NODE));
|
|
91 |
this.setPreferenceStore(new TXMPreferenceStore(AHCPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
92 | 92 |
//setDescription("AHC"); |
93 | 93 |
this.setTitle(AHCCoreMessages.RESULT_TYPE); |
94 | 94 |
this.setImageDescriptor(AHCAdapterFactory.ICON); |
tmp/org.txm.treetagger.core/src/org/txm/treetagger/core/TreeTaggerEngine.java (revision 1026) | ||
---|---|---|
20 | 20 |
@Override |
21 | 21 |
public boolean isRunning() { |
22 | 22 |
|
23 |
ttBinaryDirectory = new File(TreeTaggerPreferences.getString(TreeTaggerPreferences.INSTALL_PATH, TreeTaggerPreferences.PREFERENCES_NODE)+"/bin/");
|
|
23 |
ttBinaryDirectory = new File(TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH)+"/bin/");
|
|
24 | 24 |
if (!ttBinaryDirectory.exists()) { |
25 | 25 |
System.out.println("Error: path to TreeTagger is wrong: "+ttBinaryDirectory); |
26 | 26 |
return false; |
27 | 27 |
} |
28 | 28 |
|
29 |
ttModelsDirectory = new File(TreeTaggerPreferences.getString(TreeTaggerPreferences.MODELS_PATH, TreeTaggerPreferences.PREFERENCES_NODE));
|
|
29 |
ttModelsDirectory = new File(TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.MODELS_PATH));
|
|
30 | 30 |
if (!ttModelsDirectory.exists()) { |
31 | 31 |
System.out.println("Error: path to TreeTagger path is wrong: "+ttModelsDirectory); |
32 | 32 |
return false; |
33 | 33 |
} |
34 | 34 |
|
35 |
options = TreeTaggerPreferences.getString(TreeTaggerPreferences.OPTIONS, TreeTaggerPreferences.PREFERENCES_NODE).split(" ");
|
|
35 |
options = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.OPTIONS).split(" ");
|
|
36 | 36 |
|
37 | 37 |
return ttBinaryDirectory != null && ttBinaryDirectory.exists() && ttModelsDirectory != null && ttModelsDirectory.exists(); |
38 | 38 |
} |
tmp/org.txm.treetagger.core/src/org/txm/treetagger/core/preferences/TreeTaggerPreferences.java (revision 1026) | ||
---|---|---|
7 | 7 |
import java.net.URL; |
8 | 8 |
import java.util.Properties; |
9 | 9 |
|
10 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
11 |
import org.osgi.framework.FrameworkUtil; |
|
12 | 10 |
import org.osgi.framework.Version; |
13 | 11 |
import org.osgi.service.prefs.Preferences; |
14 | 12 |
import org.txm.core.preferences.TXMPreferences; |
... | ... | |
25 | 23 |
public class TreeTaggerPreferences extends TXMPreferences { |
26 | 24 |
|
27 | 25 |
|
28 |
// auto populate the preference node qualifier from the current bundle id |
|
29 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(TreeTaggerPreferences.class).getSymbolicName(); |
|
30 |
|
|
31 |
public static final String PREFERENCES_PREFIX = "treetagger_"; //$NON-NLS-1$ |
|
32 |
|
|
33 | 26 |
/** |
34 | 27 |
* contains the last bundle version setting the TreeTagger binariesl directory |
35 | 28 |
*/ |
36 |
public static final String INSTALLED_BINARIES_VERSION = PREFERENCES_PREFIX + "installed_binaries_version"; //$NON-NLS-1$
|
|
29 |
public static final String INSTALLED_BINARIES_VERSION = "installed_binaries_version"; //$NON-NLS-1$ |
|
37 | 30 |
/** |
38 | 31 |
* contains the last bundle version setting the TreeTagger models directory |
39 | 32 |
*/ |
40 |
public static final String INSTALLED_MODELS_VERSION = PREFERENCES_PREFIX + "installed_models_version"; //$NON-NLS-1$
|
|
33 |
public static final String INSTALLED_MODELS_VERSION = "installed_models_version"; //$NON-NLS-1$ |
|
41 | 34 |
|
42 | 35 |
/** |
43 | 36 |
* Installation path. |
44 | 37 |
*/ |
45 |
public static final String INSTALL_PATH = PREFERENCES_PREFIX + "install_path"; //$NON-NLS-1$
|
|
38 |
public static final String INSTALL_PATH = "install_path"; //$NON-NLS-1$ |
|
46 | 39 |
|
47 | 40 |
/** |
48 | 41 |
* Models path. |
49 | 42 |
*/ |
50 |
public static final String MODELS_PATH = PREFERENCES_PREFIX + "models_path"; //$NON-NLS-1$
|
|
43 |
public static final String MODELS_PATH = "models_path"; //$NON-NLS-1$ |
|
51 | 44 |
|
52 |
public static final String OPTIONS = PREFERENCES_PREFIX + "options"; //$NON-NLS-1$
|
|
45 |
public static final String OPTIONS = "options"; //$NON-NLS-1$ |
|
53 | 46 |
|
54 |
public static final String FIX_APOSTROPHES = PREFERENCES_PREFIX + "fix_apostrophes"; //$NON-NLS-1$
|
|
47 |
public static final String FIX_APOSTROPHES = "fix_apostrophes"; //$NON-NLS-1$ |
|
55 | 48 |
|
49 |
|
|
50 |
/** |
|
51 |
* Gets the instance. |
|
52 |
* @return the instance |
|
53 |
*/ |
|
54 |
public static TXMPreferences getInstance() { |
|
55 |
if (!TXMPreferences.instances.containsKey(TreeTaggerPreferences.class)) { |
|
56 |
new TreeTaggerPreferences(); |
|
57 |
} |
|
58 |
return TXMPreferences.instances.get(TreeTaggerPreferences.class); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
56 | 62 |
@Override |
57 | 63 |
public void initializeDefaultPreferences() { |
58 | 64 |
|
59 | 65 |
// Default preferences if no org.txm.treetagger.core fragment is found |
60 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
66 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
61 | 67 |
|
62 | 68 |
String installPath = "/usr/lib/treetagger"; //"System.getProperty("osgi.user.area") + "/TXM/treetagger"; //$NON-NLS-1$ //$NON-NLS-2$ |
63 | 69 |
if (System.getProperty("os.name").contains("Windows")) { |
... | ... | |
71 | 77 |
preferences.putBoolean(FIX_APOSTROPHES, false); |
72 | 78 |
|
73 | 79 |
// FIXME: need to validate this code + need to check if it's still useful |
74 |
String bversion = TXMPreferences.getString(INSTALLED_BINARIES_VERSION, PREFERENCES_NODE);
|
|
75 |
String mversion = TXMPreferences.getString(INSTALLED_MODELS_VERSION, PREFERENCES_NODE);
|
|
80 |
String bversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_BINARIES_VERSION);
|
|
81 |
String mversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_MODELS_VERSION);
|
|
76 | 82 |
|
77 | 83 |
// if TXM is launch for the first time bversion and mversion valus are empty |
78 | 84 |
if (bversion == null || bversion.equals("") || mversion == null || mversion.equals("")) { |
... | ... | |
95 | 101 |
for (String k : keys) { |
96 | 102 |
if (previousProperties.getProperty(previousProperties.getProperty(k)) != null) { |
97 | 103 |
preferences.put(k, installPath); |
98 |
TreeTaggerPreferences.put(PREFERENCES_NODE, k, previousProperties.getProperty(k));
|
|
104 |
TreeTaggerPreferences.getInstance().put(k, previousProperties.getProperty(k));
|
|
99 | 105 |
} |
100 | 106 |
} |
101 | 107 |
} |
... | ... | |
104 | 110 |
} |
105 | 111 |
} |
106 | 112 |
|
107 |
TreeTaggerPreferences.put(PREFERENCES_NODE, INSTALLED_BINARIES_VERSION, "0.0.0");
|
|
108 |
TreeTaggerPreferences.put(PREFERENCES_NODE, INSTALLED_MODELS_VERSION, "0.0.0");
|
|
113 |
TreeTaggerPreferences.getInstance().put(INSTALLED_BINARIES_VERSION, "0.0.0");
|
|
114 |
TreeTaggerPreferences.getInstance().put(INSTALLED_MODELS_VERSION, "0.0.0");
|
|
109 | 115 |
|
110 |
bversion = TXMPreferences.getString(INSTALLED_BINARIES_VERSION, PREFERENCES_NODE);
|
|
111 |
mversion = TXMPreferences.getString(INSTALLED_MODELS_VERSION, PREFERENCES_NODE);
|
|
116 |
bversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_BINARIES_VERSION);
|
|
117 |
mversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_MODELS_VERSION);
|
|
112 | 118 |
} |
113 | 119 |
|
114 | 120 |
// look for org.txm.treetagger.core.<osname> fragment |
... | ... | |
138 | 144 |
new File(binariesDir, "bin/tree-tagger").setExecutable(true); // linux&mac |
139 | 145 |
new File(binariesDir, "bin/train-tree-tagger").setExecutable(true); // linux&mac |
140 | 146 |
preferences.put(INSTALL_PATH, binariesDir.getAbsolutePath()); |
141 |
TreeTaggerPreferences.put(PREFERENCES_NODE, INSTALLED_BINARIES_VERSION, binariesFragmentVersion.toString());
|
|
147 |
TreeTaggerPreferences.getInstance().put(INSTALLED_BINARIES_VERSION, binariesFragmentVersion.toString());
|
|
142 | 148 |
System.out.println("Done."); |
143 | 149 |
} catch (MalformedURLException e) { |
144 | 150 |
// TODO Auto-generated catch block |
... | ... | |
155 | 161 |
if (path.startsWith("file:")) path = path.substring(5); |
156 | 162 |
File modelsDir = new File(path, "res/models"); |
157 | 163 |
preferences.put(MODELS_PATH, modelsDir.getAbsolutePath()); //$NON-NLS-1$ |
158 |
TreeTaggerPreferences.put(PREFERENCES_NODE, INSTALLED_MODELS_VERSION, modelsFragmentVersion.toString());
|
|
164 |
TreeTaggerPreferences.getInstance().put(INSTALLED_MODELS_VERSION, modelsFragmentVersion.toString());
|
|
159 | 165 |
System.out.println("Done."); |
160 | 166 |
} catch (MalformedURLException e) { |
161 | 167 |
// TODO Auto-generated catch block |
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/Properties.java (revision 1026) | ||
---|---|---|
38 | 38 |
import java.util.Locale; |
39 | 39 |
|
40 | 40 |
import org.eclipse.osgi.util.NLS; |
41 |
import org.txm.Toolbox; |
|
41 | 42 |
import org.txm.core.preferences.TBXPreferences; |
42 | 43 |
import org.txm.core.preferences.TXMPreferences; |
43 | 44 |
import org.txm.core.results.Parameter; |
... | ... | |
612 | 613 |
this.stepStructuralUnits(); |
613 | 614 |
this.worked(1); |
614 | 615 |
|
615 |
String txmhome = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE);
|
|
616 |
String txmhome = Toolbox.getTxmHomePath();
|
|
616 | 617 |
String filename = corpus.getMainCorpus() + "-" + corpus.getName(); //$NON-NLS-1$ |
617 | 618 |
if (corpus instanceof MainCorpus) { |
618 | 619 |
filename = corpus.getName(); //$NON-NLS-1$ |
tmp/org.txm.treetaggerinstaller.rcp/src/org/txm/treetagger/DoInstallStep.java (revision 1026) | ||
---|---|---|
63 | 63 |
File OSDir = new File(treetaggerDir, os); |
64 | 64 |
final File treetaggerModelsDir = new File(treetaggerDir, "models"); |
65 | 65 |
|
66 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.INSTALL_PATH, OSDir.getAbsolutePath());
|
|
66 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.INSTALL_PATH, OSDir.getAbsolutePath());
|
|
67 | 67 |
|
68 |
final String previousModelDirectoryPath = TXMPreferences.getString(TreeTaggerPreferences.MODELS_PATH, TBXPreferences.PREFERENCES_NODE);
|
|
68 |
final String previousModelDirectoryPath = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.MODELS_PATH);
|
|
69 | 69 |
if (previousModelDirectoryPath == null) { |
70 | 70 |
Log.info("Set TreeTagger model directory to: "+treetaggerModelsDir); |
71 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
71 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
72 | 72 |
} else if (previousModelDirectoryPath.equals(treetaggerModelsDir.getAbsolutePath())) { |
73 | 73 |
// nothing to do |
74 | 74 |
Log.info("No change to TreeTagger model directory."); |
... | ... | |
94 | 94 |
boolean b = MessageDialog.openConfirm(shell, "TreeTagger model directory", "The TreeTagger model directory is already set in TXM preferences and is not empty: \n - "+StringUtils.join(filenames, "\n - ")+"\n\nKeep using this one ?\n("+previousModelDirectoryPath+")"); |
95 | 95 |
if (!b) { |
96 | 96 |
Log.info("Set TreeTagger model directory to: "+treetaggerModelsDir); |
97 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
97 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
98 | 98 |
} else { |
99 | 99 |
Log.info("Keep TreeTagger model directory to: "+previousModelDirectoryDirectory); |
100 | 100 |
} |
101 | 101 |
} |
102 | 102 |
}); |
103 | 103 |
} else { |
104 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
104 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.MODELS_PATH, treetaggerModelsDir.getAbsolutePath());
|
|
105 | 105 |
} |
106 | 106 |
} |
107 | 107 |
|
108 |
String ttdir = TXMPreferences.getString(TreeTaggerPreferences.INSTALL_PATH, TBXPreferences.PREFERENCES_NODE);
|
|
109 |
String ttmodeldir = TXMPreferences.getString(TreeTaggerPreferences.MODELS_PATH, TBXPreferences.PREFERENCES_NODE);
|
|
108 |
String ttdir = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH);
|
|
109 |
String ttmodeldir = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.MODELS_PATH);
|
|
110 | 110 |
Log.warning("TreeTagger preferences set to: "+ttdir+ " and "+ttmodeldir); |
111 | 111 |
TXMPreferences.put(TreeTaggerInstallerPreferences.PREFERENCES_NODE, TreeTaggerInstallerPreferences.VERSION, currentVersion.toString()); |
112 | 112 |
|
113 | 113 |
//FIXME: to beremoved when 0.8.0 preferences are ready |
114 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.INSTALL_PATH, ttdir);
|
|
115 |
TXMPreferences.put(TBXPreferences.PREFERENCES_NODE, TreeTaggerPreferences.MODELS_PATH, ttmodeldir);
|
|
114 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.INSTALL_PATH, ttdir);
|
|
115 |
TreeTaggerPreferences.getInstance().put(TreeTaggerPreferences.MODELS_PATH, ttmodeldir);
|
|
116 | 116 |
} |
117 | 117 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/preferences/IndexPreferencesPage.java (revision 1026) | ||
---|---|---|
8 | 8 |
import org.txm.rcp.preferences.TXMPreferencePage; |
9 | 9 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
10 | 10 |
|
11 |
/** |
|
12 |
* Index preferences page. |
|
13 |
* |
|
14 |
* @author sjacquot |
|
15 |
* |
|
16 |
*/ |
|
11 | 17 |
public class IndexPreferencesPage extends TXMPreferencePage { |
12 | 18 |
|
13 | 19 |
@Override |
14 | 20 |
public void init(IWorkbench workbench) { |
15 | 21 |
|
16 |
this.setPreferenceStore(new TXMPreferenceStore(IndexPreferences.PREFERENCES_NODE));
|
|
22 |
this.setPreferenceStore(new TXMPreferenceStore(IndexPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
17 | 23 |
this.setTitle("Index"); |
18 | 24 |
this.setImageDescriptor(IndexAdapterFactory.ICON); |
19 | 25 |
} |
tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/preferences/AnnotationPreferencePage.java (revision 1026) | ||
---|---|---|
74 | 74 |
*/ |
75 | 75 |
@Override |
76 | 76 |
public void init(IWorkbench workbench) { |
77 |
this.setPreferenceStore(new TXMPreferenceStore(AnnotationPreferences.PREFERENCES_NODE));
|
|
77 |
this.setPreferenceStore(new TXMPreferenceStore(AnnotationPreferences.getInstance().getPreferencesNodeQualifier()));
|
|
78 | 78 |
//this.setTitle("WordCloud"); |
79 | 79 |
this.setImageDescriptor(IImageKeys.getImageDescriptor(IImageKeys.PENCIL)); |
80 | 80 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1026) | ||
---|---|---|
46 | 46 |
@Override |
47 | 47 |
public boolean start(IProgressMonitor monitor) throws Exception { |
48 | 48 |
|
49 |
if (monitor != null) monitor.subTask("Starting Corpus Engine..."); |
|
49 |
if (monitor != null) { |
|
50 |
monitor.subTask("Starting Corpus Engine..."); |
|
51 |
} |
|
50 | 52 |
|
51 | 53 |
boolean cqiserverok = false; |
52 | 54 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java (revision 1026) | ||
---|---|---|
1 | 1 |
package org.txm.searchengine.cqp; |
2 | 2 |
|
3 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
|
4 |
import org.osgi.framework.FrameworkUtil; |
|
5 | 3 |
import org.osgi.service.prefs.Preferences; |
6 | 4 |
import org.txm.core.preferences.TXMPreferences; |
7 | 5 |
|
... | ... | |
14 | 12 |
*/ |
15 | 13 |
public class CQPPreferences extends TXMPreferences { |
16 | 14 |
|
17 |
// auto populate the preference node qualifier from the current bundle id |
|
18 |
public static String PREFERENCES_NODE = FrameworkUtil.getBundle(CQPPreferences.class).getSymbolicName(); |
|
19 | 15 |
|
20 |
public static final String PREFERENCES_PREFIX = "cqp_"; //$NON-NLS-1$ |
|
21 |
|
|
22 | 16 |
/** |
23 | 17 |
* List of part names |
24 | 18 |
*/ |
25 |
public static final String PARTNAMES = "part_names"; //$NON-NLS-1$ |
|
19 |
public static final String PART_NAMES = "part_names"; //$NON-NLS-1$
|
|
26 | 20 |
|
21 |
|
|
22 |
/** |
|
23 |
* Gets the instance. |
|
24 |
* @return the instance |
|
25 |
*/ |
|
26 |
public static TXMPreferences getInstance() { |
|
27 |
if (!TXMPreferences.instances.containsKey(CQPPreferences.class)) { |
|
28 |
new CQPPreferences(); |
|
29 |
} |
|
30 |
return TXMPreferences.instances.get(CQPPreferences.class); |
|
31 |
} |
|
27 | 32 |
|
33 |
|
|
28 | 34 |
@Override |
29 | 35 |
public void initializeDefaultPreferences() { |
30 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
|
|
36 |
Preferences preferences = this.getDefaultPreferencesNode();
|
|
31 | 37 |
} |
32 | 38 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 1026) | ||
---|---|---|
268 | 268 |
*/ |
269 | 269 |
public String getFullName() throws CqiClientException { |
270 | 270 |
try { |
271 |
return CorpusManager.getCorpusManager().getCqiClient() |
|
272 |
.corpusFullName(this.cqpId); |
|
271 |
return CorpusManager.getCorpusManager().getCqiClient().corpusFullName(this.cqpId); |
|
273 | 272 |
} catch (Exception e) { |
274 | 273 |
throw new CqiClientException(e); |
275 | 274 |
} |
... | ... | |
285 | 284 |
*/ |
286 | 285 |
@Override |
287 | 286 |
public WordProperty getProperty(String name) throws CqiClientException { |
288 |
if (this.lexicalUnitsProperties == null) |
|
287 |
if (this.lexicalUnitsProperties == null) {
|
|
289 | 288 |
getProperties(); |
289 |
} |
|
290 | 290 |
|
291 | 291 |
int idx = name.indexOf("."); |
292 | 292 |
if (idx > 0) { // the name if a qualified name |
... | ... | |
294 | 294 |
} |
295 | 295 |
|
296 | 296 |
for (WordProperty property : this.lexicalUnitsProperties) { |
297 |
if (property.getName().equals(name)) |
|
297 |
if (property.getName().equals(name)) {
|
|
298 | 298 |
return property; |
299 |
} |
|
299 | 300 |
} |
300 | 301 |
return null; |
301 | 302 |
} |
... | ... | |
308 | 309 |
* .lang.String) |
309 | 310 |
*/ |
310 | 311 |
@Override |
311 |
public StructuralUnit getStructuralUnit(String name) |
|
312 |
throws CqiClientException { |
|
313 |
if (this.structuralUnits == null) |
|
312 |
public StructuralUnit getStructuralUnit(String name) throws CqiClientException { |
|
313 |
if (this.structuralUnits == null) { |
|
314 | 314 |
getStructuralUnits(); |
315 |
for (StructuralUnit unit : this.structuralUnits) |
|
316 |
if (unit.getName().equals(name)) |
|
315 |
} |
|
316 |
for (StructuralUnit unit : this.structuralUnits) { |
|
317 |
if (unit.getName().equals(name)) { |
|
317 | 318 |
return unit; |
319 |
} |
|
320 |
} |
|
318 | 321 |
return null; |
319 | 322 |
} |
320 | 323 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java (revision 1026) | ||
---|---|---|
34 | 34 |
import org.txm.searchengine.cqp.corpus.query.Query; |
35 | 35 |
import org.w3c.dom.Element; |
36 | 36 |
|
37 |
// TODO: Auto-generated Javadoc |
|
38 | 37 |
/** |
39 | 38 |
* A Part is related to the {@link Partition} and is a CQP subcorpus. |
40 | 39 |
* |
... | ... | |
71 | 70 |
|
72 | 71 |
this.partition.addChild(this); |
73 | 72 |
this.setVisible(false); |
73 |
this.persistable = true; |
|
74 |
this.userPersistable = false; |
|
75 |
|
|
76 |
// try { |
|
77 |
// this.compute(); |
|
78 |
// } |
|
79 |
// catch (Exception e) { |
|
80 |
// // TODO Auto-generated catch block |
|
81 |
// e.printStackTrace(); |
|
82 |
// } |
|
83 |
|
|
74 | 84 |
} |
75 | 85 |
|
76 | 86 |
/** |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1026) | ||
---|---|---|
76 | 76 |
/** The Constant serialVersionUID. */ |
77 | 77 |
private static final long serialVersionUID = 4420732757687971253L; |
78 | 78 |
|
79 |
/** |
|
80 |
* Get the safe values (spacial char regexp safe). |
|
81 |
* |
|
82 |
* @param property the property |
|
83 |
* @param corpus the corpus |
|
84 |
* @return the safe values |
|
85 |
* @throws CqiClientException the cqi client exception |
|
86 |
*/ |
|
87 |
private static List<String> getSafeValues(StructuralUnitProperty property, Corpus corpus) throws CqiClientException { |
|
88 |
List<String> values = property.getValues(corpus); |
|
89 |
for(int i = 0 ; i < values.size() ; i++) |
|
90 |
values.set(i, Query.addBackSlash(values.get(i))); |
|
91 |
return values; |
|
92 |
} |
|
79 |
/** sum of parts size, stored for efficiency reasons**/ |
|
80 |
int totalsize = -1; |
|
93 | 81 |
|
82 |
|
|
94 | 83 |
/** The property, if not null the partition will forge its own queries */ |
95 | 84 |
@Parameter(key=TXMPreferences.STRUCTURAL_UNIT_PROPERTY) |
96 | 85 |
protected StructuralUnitProperty pProperty; |
... | ... | |
107 | 96 |
/** |
108 | 97 |
* the parts names -> do the parts order |
109 | 98 |
*/ |
110 |
@Parameter(key=CQPPreferences.PARTNAMES) |
|
99 |
@Parameter(key=CQPPreferences.PART_NAMES)
|
|
111 | 100 |
protected List<String> pPartNames; |
112 | 101 |
/** |
113 | 102 |
* the partition name to set |
114 | 103 |
*/ |
115 | 104 |
@Parameter(key=TXMPreferences.LAZY_NAME) |
116 | 105 |
protected String pName; |
117 |
/** sum of parts size, stored for efficiency reasons**/ |
|
118 |
int totalsize = -1; |
|
119 | 106 |
|
120 | 107 |
|
121 | 108 |
// /** |
... | ... | |
458 | 445 |
* @return the the number of parts. |
459 | 446 |
*/ |
460 | 447 |
public int getNPart() { |
448 |
// FIXME: later should just return the direct children count |
|
461 | 449 |
try { |
462 | 450 |
if (!hasBeenComputedOnce()) { |
463 | 451 |
compute(); |
... | ... | |
713 | 701 |
@Override |
714 | 702 |
public boolean setParameters(TXMParameters parameters) { |
715 | 703 |
this.pName = parameters.getString(TXMPreferences.LAZY_NAME); |
716 |
String tmp = parameters.getString(CQPPreferences.PARTNAMES); |
|
704 |
String tmp = parameters.getString(CQPPreferences.PART_NAMES);
|
|
717 | 705 |
if (tmp != null) { |
718 | 706 |
this.pPartNames = Arrays.asList(tmp.split("\t")); |
719 | 707 |
} else { |
... | ... | |
758 | 746 |
e.printStackTrace(); |
759 | 747 |
} |
760 | 748 |
|
761 |
tmp = this.getStringParameterValue(CQPPreferences.PARTNAMES); |
|
749 |
tmp = this.getStringParameterValue(CQPPreferences.PART_NAMES);
|
|
762 | 750 |
if (tmp != null) { |
763 | 751 |
this.pPartNames = Arrays.asList(tmp.split("\t")); |
764 | 752 |
} else { |
... | ... | |
789 | 777 |
} |
790 | 778 |
|
791 | 779 |
if (this.pPartNames != null) { |
792 |
this.saveParameter(CQPPreferences.PARTNAMES, StringUtils.join(pPartNames, "\t")); |
|
780 |
this.saveParameter(CQPPreferences.PART_NAMES, StringUtils.join(pPartNames, "\t"));
|
|
793 | 781 |
} |
794 | 782 |
|
795 | 783 |
if (this.pQueries != null) { |
... | ... | |
802 | 790 |
|
803 | 791 |
return true; |
804 | 792 |
} |
793 |
|
|
794 |
/** |
|
795 |
* Get the safe values (spacial char regexp safe). |
|
796 |
* |
|
797 |
* @param property the property |
|
798 |
* @param corpus the corpus |
|
799 |
* @return the safe values |
|
800 |
* @throws CqiClientException the cqi client exception |
|
801 |
*/ |
|
802 |
private static List<String> getSafeValues(StructuralUnitProperty property, Corpus corpus) throws CqiClientException { |
|
803 |
List<String> values = property.getValues(corpus); |
|
804 |
for(int i = 0 ; i < values.size() ; i++) |
|
805 |
values.set(i, Query.addBackSlash(values.get(i))); |
|
806 |
return values; |
|
807 |
} |
|
805 | 808 |
|
809 |
|
|
810 |
|
|
806 | 811 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java (revision 1026) | ||
---|---|---|
154 | 154 |
* @return the partition |
155 | 155 |
* @throws CqiClientException the cqi client exception |
156 | 156 |
*/ |
157 |
public Partition createPartition(String name, List<String> queries, |
|
158 |
List<String> partnames, boolean registered) |
|
159 |
throws Exception { |
|
157 |
public Partition createPartition(String name, List<String> queries, List<String> partnames, boolean registered) throws Exception { |
|
160 | 158 |
Partition partition = new Partition(this); |
161 | 159 |
partition.setParameters(name, queries, partnames); |
162 | 160 |
partition.compute(); |
163 |
if (!registered) |
|
161 |
if (!registered) {
|
|
164 | 162 |
partition.registerToParent(); |
163 |
} |
|
165 | 164 |
return partition; |
166 | 165 |
} |
167 | 166 |
|
... | ... | |
175 | 174 |
* @return the partition |
176 | 175 |
* @throws CqiClientException the cqi client exception |
177 | 176 |
*/ |
178 |
public Partition createPartition(String name, StructuralUnit structure, |
|
179 |
StructuralUnitProperty property, List<String> values, |
|
180 |
boolean registered) throws Exception { |
|
177 |
public Partition createPartition(String name, StructuralUnit structure, StructuralUnitProperty property, List<String> values, boolean registered) throws Exception { |
|
181 | 178 |
Partition partition = new Partition(this); |
182 | 179 |
partition.setParameters(name, property, values); |
183 | 180 |
partition.compute(); |
184 |
if (!registered) |
|
181 |
if (!registered) {
|
|
185 | 182 |
partition.registerToParent(); |
183 |
} |
|
186 | 184 |
return partition; |
187 | 185 |
} |
188 | 186 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java (revision 1026) | ||
---|---|---|
235 | 235 |
*/ |
236 | 236 |
|
237 | 237 |
// Warning !! for WINDOWS ONLY the "" value does not work with the ProcessBuilder we must set the value to "\"\"" |
238 |
String empty_value_code = TXMPreferences.getString(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE, TBXPreferences.PREFERENCES_NODE);
|
|
238 |
String empty_value_code = Toolbox.getPreference(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE);
|
|
239 | 239 |
if (OSDetector.isFamilyWindows()) { |
240 | 240 |
if (empty_value_code == null) empty_value_code = "\"\""; |
241 | 241 |
empty_value_code = empty_value_code.trim(); |
tmp/org.txm.statsengine.r.rcp/src/org/txm/rcp/commands/R/OpenEmptyEditor.java (revision 1026) | ||
---|---|---|
34 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
35 | 35 |
import org.eclipse.core.commands.ExecutionException; |
Formats disponibles : Unified diff