Révision 325
tmp/org.txm.concordance.core/META-INF/MANIFEST.MF (revision 325) | ||
---|---|---|
5 | 5 |
Bundle-Version: 1.0.0.qualifier |
6 | 6 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
7 | 7 |
Require-Bundle: org.txm.core |
8 |
Export-Package: org.txm.functions.concordances, |
|
9 |
org.txm.functions.concordances.comparators |
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/preferences/WordCloudPreferences.java (revision 325) | ||
---|---|---|
18 | 18 |
// auto populate the preference node qualifier from the current bundle id |
19 | 19 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(WordCloudPreferences.class).getSymbolicName(); |
20 | 20 |
|
21 |
|
|
22 | 21 |
public static final String PREFERENCES_PREFIX = "wordcloud_"; |
23 | 22 |
|
24 | 23 |
public static final String MAX_WORDS = PREFERENCES_PREFIX + "max_words"; //$NON-NLS-1$ |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 325) | ||
---|---|---|
31 | 31 |
import org.eclipse.swt.widgets.Composite; |
32 | 32 |
import org.eclipse.ui.IWorkbench; |
33 | 33 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
34 |
import org.txm.core.preferences.TXMPreferences; |
|
34 | 35 |
import org.txm.progression.core.messages.ProgressionCoreMessages; |
35 | 36 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
36 | 37 |
import org.txm.progression.rcp.adapters.ProgressionAdapterFactory; |
... | ... | |
64 | 65 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_CUMULATIVE, ProgressionUIMessages.ProgressionPreferencePage_3, chartsTab)); |
65 | 66 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_MONO_STYLE, ProgressionUIMessages.ProgressionPreferencePage_5, chartsTab)); |
66 | 67 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_REPEAT_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab)); |
67 |
|
|
68 |
float test = TxmPreferences.getFloat(ProgressionPreferences.CHART_BANDE_MULTIPLIER, 999f); |
|
69 |
if (test == 999f) { |
|
70 |
TxmPreferences.set(ProgressionPreferences.CHART_BANDE_MULTIPLIER, 1.0f); |
|
71 |
} |
|
72 |
|
|
68 |
|
|
73 | 69 |
DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.CHART_BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab); |
74 | 70 |
this.addField(bandemultiplierfield); |
75 | 71 |
// FIXME: valid range |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/preferences/JFCChartsEnginePreferencePage.java (revision 325) | ||
---|---|---|
41 | 41 |
import org.txm.chartsengine.jfreechart.core.preferences.JFCChartsEnginePreferences; |
42 | 42 |
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider; |
43 | 43 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
44 |
import org.txm.rcp.TxmPreferences;
|
|
44 |
import org.txm.core.preferences.TXMPreferences;
|
|
45 | 45 |
import org.txm.rcp.preferences.ExportPreferencePage; |
46 | 46 |
import org.txm.rcp.preferences.TXMPreferencePage; |
47 | 47 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
... | ... | |
87 | 87 |
this.setPreferenceStore(new TXMPreferenceStore(JFCChartsEnginePreferences.PREFERENCE_NODE)); |
88 | 88 |
} |
89 | 89 |
|
90 |
@Override |
|
91 |
public boolean performOk() { |
|
92 |
try { |
|
93 |
super.performOk(); |
|
94 |
|
|
95 |
// Change the JFC Charts engine output format |
|
96 |
ChartsEngine.getChartsEngine(JFCChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT)); |
|
97 |
|
|
98 |
// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one |
|
99 |
if(ChartsEngine.getCurrent() instanceof JFCChartsEngine) { |
|
100 |
SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent()); |
|
101 |
|
|
102 |
// Set the first charts engine supported export file format as default charts export file format |
|
103 |
TxmPreferences.set(ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
|
|
104 |
|
|
105 |
// Refresh the User\Export preference page to update "Default charts export file format" combo box |
|
106 |
PlatformUI.getWorkbench().getPreferenceManager(). |
|
107 |
find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$ |
|
108 |
|
|
109 |
} |
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
} catch (Exception e) { |
|
114 |
System.err.println(org.txm.rcp.Messages.FAILED_TO_SAVE_PREFERENCES + e); |
|
115 |
} |
|
116 |
return true; |
|
117 |
} |
|
90 |
// @Override
|
|
91 |
// public boolean performOk() {
|
|
92 |
// try {
|
|
93 |
// super.performOk();
|
|
94 |
// |
|
95 |
// // Change the JFC Charts engine output format
|
|
96 |
// ChartsEngine.getChartsEngine(JFCChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT));
|
|
97 |
// |
|
98 |
// // Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
|
|
99 |
// if(ChartsEngine.getCurrent() instanceof JFCChartsEngine) {
|
|
100 |
// SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
|
|
101 |
// |
|
102 |
// // Set the first charts engine supported export file format as default charts export file format
|
|
103 |
// TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
|
|
104 |
// |
|
105 |
// // Refresh the User\Export preference page to update "Default charts export file format" combo box
|
|
106 |
// PlatformUI.getWorkbench().getPreferenceManager().
|
|
107 |
// find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
|
|
108 |
// |
|
109 |
// }
|
|
110 |
// |
|
111 |
// |
|
112 |
// |
|
113 |
// } catch (Exception e) {
|
|
114 |
// System.err.println(org.txm.rcp.Messages.FAILED_TO_SAVE_PREFERENCES + e);
|
|
115 |
// }
|
|
116 |
// return true;
|
|
117 |
// }
|
|
118 | 118 |
} |
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeCAH.java (revision 325) | ||
---|---|---|
246 | 246 |
nclusterSpinner = new Spinner(composite, SWT.BORDER); |
247 | 247 |
nclusterSpinner.setMinimum(2); |
248 | 248 |
nclusterSpinner.setIncrement(1); |
249 |
nclusterSpinner.setSelection(TxmPreferences.getInt(CAHPreferences.N_CLUSTERS, 2));
|
|
249 |
nclusterSpinner.setSelection(TXMPreferences.getInt(CAHPreferences.PREFERENCES_NODE, CAHPreferences.N_CLUSTERS));
|
|
250 | 250 |
nclusterSpinner.setMaximum(50); |
251 | 251 |
|
252 | 252 |
// ROWS OR COLS |
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/CAHPreferencePage.java (revision 325) | ||
---|---|---|
54 | 54 |
@Override |
55 | 55 |
public void createFieldEditors() { |
56 | 56 |
|
57 |
|
|
58 | 57 |
IntegerFieldEditor nClusters = new IntegerFieldEditor(CAHPreferences.N_CLUSTERS, CAHUIMessages.CAHPreferencePage_2, getFieldEditorParent()); |
59 | 58 |
addField(nClusters); |
60 | 59 |
|
tmp/org.txm.cah.core/META-INF/MANIFEST.MF (revision 325) | ||
---|---|---|
8 | 8 |
org.txm.core;bundle-version="0.7.0", |
9 | 9 |
org.txm.chartsengine.r.core;bundle-version="1.0.0", |
10 | 10 |
org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0", |
11 |
org.txm.lexicaltable.core;bundle-version="1.0.0" |
|
11 |
org.txm.lexicaltable.core;bundle-version="1.0.0", |
|
12 |
org.txm.statsengine.core;bundle-version="1.0.0", |
|
13 |
org.txm.statsengine.r.core;bundle-version="1.0.0", |
|
14 |
org.txm.statsengine.r.rcp;bundle-version="1.0.0" |
|
12 | 15 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 |
13 | 16 |
Bundle-ActivationPolicy: lazy |
14 | 17 |
Export-Package: org.txm.cah.core.chartsengine.jfreechart, |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/TxmPreferences.java (revision 325) | ||
---|---|---|
49 | 49 |
public class TxmPreferences { |
50 | 50 |
|
51 | 51 |
|
52 |
public static final String SCOPE = "instance"; //$NON-NLS-1$
|
|
52 |
protected static final String SCOPE = "instance"; //$NON-NLS-1$
|
|
53 | 53 |
|
54 | 54 |
/** |
55 | 55 |
* print TxmPreferences in the console. |
56 | 56 |
*/ |
57 |
public static void dump() {
|
|
57 |
protected static void dump() {
|
|
58 | 58 |
try { |
59 | 59 |
IPreferencesService service = Platform.getPreferencesService(); |
60 | 60 |
System.out.println("root:"); //$NON-NLS-1$ |
... | ... | |
79 | 79 |
} |
80 | 80 |
} |
81 | 81 |
|
82 |
public static Preferences getPreferences() {
|
|
82 |
protected static Preferences getPreferences() {
|
|
83 | 83 |
IPreferencesService service = Platform.getPreferencesService(); |
84 | 84 |
return service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID); |
85 | 85 |
} |
... | ... | |
89 | 89 |
* |
90 | 90 |
* @param file the file |
91 | 91 |
*/ |
92 |
public static void importFromFile(File file) {
|
|
92 |
protected static void importFromFile(File file) {
|
|
93 | 93 |
importFromFile(file, "UTF-8", false); //$NON-NLS-1$ |
94 | 94 |
} |
95 | 95 |
|
... | ... | |
99 | 99 |
* @param file the file |
100 | 100 |
* @param encoding the encoding |
101 | 101 |
*/ |
102 |
public static boolean importFromFile(File file, String encoding, boolean javaproperties) {
|
|
102 |
protected static boolean importFromFile(File file, String encoding, boolean javaproperties) {
|
|
103 | 103 |
boolean ret = true; |
104 | 104 |
BufferedReader input = null; |
105 | 105 |
try { |
... | ... | |
142 | 142 |
* @param key the key |
143 | 143 |
* @param value the value |
144 | 144 |
*/ |
145 |
public static void set(String key, String value) {
|
|
145 |
protected static void set(String key, String value) {
|
|
146 | 146 |
IPreferencesService service = Platform.getPreferencesService(); |
147 | 147 |
service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID).put(key, value); //$NON-NLS-1$ |
148 | 148 |
try { |
... | ... | |
158 | 158 |
* @param key the key |
159 | 159 |
* @param value the value |
160 | 160 |
*/ |
161 |
public static void set(String key, boolean value) {
|
|
161 |
protected static void set(String key, boolean value) {
|
|
162 | 162 |
IPreferencesService service = Platform.getPreferencesService(); |
163 | 163 |
service.getRootNode() |
164 | 164 |
.node(SCOPE).node(Application.PLUGIN_ID).putBoolean(key, value); //$NON-NLS-1$ |
... | ... | |
175 | 175 |
* @param key the key |
176 | 176 |
* @param value the value |
177 | 177 |
*/ |
178 |
public static void set(String key, double value) {
|
|
178 |
protected static void set(String key, double value) {
|
|
179 | 179 |
IPreferencesService service = Platform.getPreferencesService(); |
180 | 180 |
service.getRootNode() |
181 | 181 |
.node(SCOPE).node(Application.PLUGIN_ID).putDouble(key, value); //$NON-NLS-1$ |
... | ... | |
192 | 192 |
* @param key the key |
193 | 193 |
* @param value the value |
194 | 194 |
*/ |
195 |
public static void set(String key, float value) {
|
|
195 |
protected static void set(String key, float value) {
|
|
196 | 196 |
IPreferencesService service = Platform.getPreferencesService(); |
197 | 197 |
service.getRootNode() |
198 | 198 |
.node(SCOPE).node(Application.PLUGIN_ID).putFloat(key, value); //$NON-NLS-1$ |
... | ... | |
209 | 209 |
* @param key the key |
210 | 210 |
* @param value the value |
211 | 211 |
*/ |
212 |
public static void set(String key, int value) {
|
|
212 |
protected static void set(String key, int value) {
|
|
213 | 213 |
IPreferencesService service = Platform.getPreferencesService(); |
214 | 214 |
service.getRootNode() |
215 | 215 |
.node(SCOPE).node(Application.PLUGIN_ID).putInt(key, value); //$NON-NLS-1$ |
... | ... | |
226 | 226 |
* @param key the key |
227 | 227 |
* @param value the value |
228 | 228 |
*/ |
229 |
public static void set(String key, long value) {
|
|
229 |
protected static void set(String key, long value) {
|
|
230 | 230 |
IPreferencesService service = Platform.getPreferencesService(); |
231 | 231 |
service.getRootNode() |
232 | 232 |
.node(SCOPE).node(Application.PLUGIN_ID).putLong(key, value); //$NON-NLS-1$ |
... | ... | |
243 | 243 |
* @param key the key |
244 | 244 |
* @param value the value |
245 | 245 |
*/ |
246 |
public static void set(String key, byte[] value) {
|
|
246 |
protected static void set(String key, byte[] value) {
|
|
247 | 247 |
IPreferencesService service = Platform.getPreferencesService(); |
248 | 248 |
service.getRootNode() |
249 | 249 |
.node(SCOPE).node(Application.PLUGIN_ID).putByteArray(key, value); //$NON-NLS-1$ |
... | ... | |
260 | 260 |
* @param key the key |
261 | 261 |
* @return the string |
262 | 262 |
*/ |
263 |
public static String get(String key) {
|
|
263 |
protected static String get(String key) {
|
|
264 | 264 |
IPreferencesService service = Platform.getPreferencesService(); |
265 | 265 |
return service.getRootNode() |
266 | 266 |
.node(SCOPE).node(Application.PLUGIN_ID).get(key, null); //$NON-NLS-1$ |
... | ... | |
272 | 272 |
* @param key the key |
273 | 273 |
* @return the string |
274 | 274 |
*/ |
275 |
public static String get(String key, String def) {
|
|
275 |
protected static String get(String key, String def) {
|
|
276 | 276 |
String rez = get(key); |
277 | 277 |
if (rez == null) rez = def; |
278 | 278 |
return rez; |
... | ... | |
284 | 284 |
* @param key the key |
285 | 285 |
* @return the boolean |
286 | 286 |
*/ |
287 |
public static Boolean getBoolean(String key) {
|
|
287 |
protected static Boolean getBoolean(String key) {
|
|
288 | 288 |
IPreferencesService service = Platform.getPreferencesService(); |
289 | 289 |
return service.getRootNode() |
290 | 290 |
.node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, false); //$NON-NLS-1$ |
... | ... | |
297 | 297 |
* @param defaultvalue the defaultvalue |
298 | 298 |
* @return the boolean |
299 | 299 |
*/ |
300 |
public static Boolean getBoolean(String key, boolean defaultvalue) {
|
|
300 |
protected static Boolean getBoolean(String key, boolean defaultvalue) {
|
|
301 | 301 |
IPreferencesService service = Platform.getPreferencesService(); |
302 | 302 |
return service.getRootNode() |
303 | 303 |
.node(SCOPE).node(Application.PLUGIN_ID).getBoolean(key, defaultvalue); //$NON-NLS-1$ |
... | ... | |
309 | 309 |
* @param key the key |
310 | 310 |
* @return the double |
311 | 311 |
*/ |
312 |
public static Double getDouble(String key) {
|
|
312 |
protected static Double getDouble(String key) {
|
|
313 | 313 |
IPreferencesService service = Platform.getPreferencesService(); |
314 | 314 |
return service.getRootNode() |
315 | 315 |
.node(SCOPE).node(Application.PLUGIN_ID).getDouble(key, 0.0d); //$NON-NLS-1$ |
... | ... | |
321 | 321 |
* @param key the key |
322 | 322 |
* @return the int |
323 | 323 |
*/ |
324 |
public static Integer getInt(String key) {
|
|
324 |
protected static Integer getInt(String key) {
|
|
325 | 325 |
return getInt(key, 0); |
326 | 326 |
} |
327 | 327 |
|
... | ... | |
332 | 332 |
* @param i the i |
333 | 333 |
* @return the int |
334 | 334 |
*/ |
335 |
public static int getInt(String key, int i) {
|
|
335 |
protected static int getInt(String key, int i) {
|
|
336 | 336 |
IPreferencesService service = Platform.getPreferencesService(); |
337 | 337 |
return service.getRootNode() |
338 | 338 |
.node(SCOPE).node(Application.PLUGIN_ID).getInt(key, i); //$NON-NLS-1$ |
... | ... | |
346 | 346 |
* @param def the def |
347 | 347 |
* @return the float |
348 | 348 |
*/ |
349 |
public static float getFloat(String key, float def) {
|
|
349 |
protected static float getFloat(String key, float def) {
|
|
350 | 350 |
IPreferencesService service = Platform.getPreferencesService(); |
351 | 351 |
return service.getRootNode() |
352 | 352 |
.node(SCOPE).node(Application.PLUGIN_ID).getFloat(key, def); //$NON-NLS-1$ |
... | ... | |
357 | 357 |
* |
358 | 358 |
* @param key the key |
359 | 359 |
*/ |
360 |
public static void remove(String key) {
|
|
360 |
protected static void remove(String key) {
|
|
361 | 361 |
IPreferencesService service = Platform.getPreferencesService(); |
362 | 362 |
service.getRootNode() |
363 | 363 |
.node(SCOPE).node(Application.PLUGIN_ID).remove(key); //$NON-NLS-1$ |
... | ... | |
373 | 373 |
// * |
374 | 374 |
// * @return the properties |
375 | 375 |
// */ |
376 |
// public static Properties getProperties() {
|
|
376 |
// protected static Properties getProperties() {
|
|
377 | 377 |
// return ApplicationWorkbenchAdvisor.getProperties(); |
378 | 378 |
// } |
379 | 379 |
|
... | ... | |
384 | 384 |
* @param defaultvalue the defaultvalue |
385 | 385 |
* @return the string |
386 | 386 |
*/ |
387 |
public static String getString(String key, String defaultvalue) {
|
|
387 |
protected static String getString(String key, String defaultvalue) {
|
|
388 | 388 |
String ret = get(key); |
389 | 389 |
if (ret == null) |
390 | 390 |
return defaultvalue; |
391 | 391 |
return ret; |
392 | 392 |
} |
393 | 393 |
|
394 |
public static String[] getAllKeys() {
|
|
394 |
protected static String[] getAllKeys() {
|
|
395 | 395 |
IPreferencesService service = Platform.getPreferencesService(); |
396 | 396 |
Preferences prefs = service.getRootNode().node(SCOPE).node(Application.PLUGIN_ID); //$NON-NLS-1$ |
397 | 397 |
try { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java (revision 325) | ||
---|---|---|
41 | 41 |
import org.eclipse.swt.widgets.Shell; |
42 | 42 |
import org.eclipse.ui.PlatformUI; |
43 | 43 |
import org.eclipse.ui.statushandlers.StatusManager; |
44 |
import org.txm.core.preferences.TXMPreferences; |
|
44 | 45 |
import org.txm.rcp.Messages; |
45 |
import org.txm.rcp.TxmPreferences; |
|
46 |
import org.txm.rcp.preferences.AdvancePreferencePage; |
|
46 |
import org.txm.rcp.preferences.RCPPreferences; |
|
47 | 47 |
import org.txm.utils.logger.Log; |
48 | 48 |
import org.txm.utils.zip.GZip; |
49 | 49 |
|
... | ... | |
197 | 197 |
Log.printStackTrace(e); |
198 | 198 |
} |
199 | 199 |
|
200 |
String updateLevel = TxmPreferences.getString(AdvancePreferencePage.UPDATE_LEVEL, "STABLE"); //$NON-NLS-1$
|
|
200 |
String updateLevel = TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UPDATE_LEVEL, "STABLE"); //$NON-NLS-1$
|
|
201 | 201 |
boolean alphaMode = false; |
202 | 202 |
boolean betaMode = false; |
203 | 203 |
boolean devMode = false; |
... | ... | |
261 | 261 |
Log.printStackTrace(e); |
262 | 262 |
} |
263 | 263 |
|
264 |
String updateLevel = TxmPreferences.getString(AdvancePreferencePage.UPDATE_LEVEL, "STABLE"); //$NON-NLS-1$
|
|
264 |
String updateLevel = TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UPDATE_LEVEL, "STABLE"); //$NON-NLS-1$
|
|
265 | 265 |
boolean alphaMode = false; |
266 | 266 |
boolean betaMode = false; |
267 | 267 |
boolean devMode = false; |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/InstallPluginHandler.java (revision 325) | ||
---|---|---|
13 | 13 |
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; |
14 | 14 |
import org.eclipse.equinox.p2.ui.ProvisioningUI; |
15 | 15 |
import org.eclipse.jface.wizard.WizardDialog; |
16 |
import org.txm.rcp.TxmPreferences;
|
|
17 |
import org.txm.rcp.preferences.AdvancePreferencePage;
|
|
16 |
import org.txm.core.preferences.TXMPreferences;
|
|
17 |
import org.txm.rcp.preferences.RCPPreferences;
|
|
18 | 18 |
import org.txm.utils.logger.Log; |
19 | 19 |
|
20 | 20 |
/** |
... | ... | |
45 | 45 |
|
46 | 46 |
RepositoryDiscoveryStrategy strategy = new RepositoryDiscoveryStrategy(); |
47 | 47 |
try { |
48 |
String updateLevel = TxmPreferences.getString(AdvancePreferencePage.UPDATE_LEVEL, "STABLE");//$NON-NLS-1$
|
|
48 |
String updateLevel = TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UPDATE_LEVEL, "STABLE");//$NON-NLS-1$
|
|
49 | 49 |
boolean alphaMode = false; |
50 | 50 |
boolean betaMode = false; |
51 | 51 |
boolean devMode = false; |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ExpertEnabled.java (revision 325) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.eclipse.core.expressions.PropertyTester; |
4 | 4 |
import org.txm.core.preferences.TBXPreferences; |
5 |
import org.txm.rcp.TxmPreferences; |
|
6 |
import org.txm.rcp.preferences.AdvancePreferencePage; |
|
5 |
import org.txm.core.preferences.TXMPreferences; |
|
7 | 6 |
|
8 | 7 |
public class ExpertEnabled extends PropertyTester { |
9 | 8 |
|
... | ... | |
14 | 13 |
public boolean test(Object receiver, String property, Object[] args, |
15 | 14 |
Object expectedValue) { |
16 | 15 |
|
17 |
boolean expert = TxmPreferences.getBoolean(TBXPreferences.EXPERT_USER);
|
|
16 |
boolean expert = TXMPreferences.getBoolean(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPERT_USER);
|
|
18 | 17 |
//System.out.println("IS expert enabled: "+expert); |
19 | 18 |
return expert; |
20 | 19 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/FileTreeContentProvider.java (revision 325) | ||
---|---|---|
33 | 33 |
|
34 | 34 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
35 | 35 |
import org.eclipse.jface.viewers.Viewer; |
36 |
import org.txm.core.preferences.TXMPreferences; |
|
36 | 37 |
import org.txm.rcp.Messages; |
37 | 38 |
import org.txm.rcp.TxmPreferences; |
38 |
import org.txm.rcp.preferences.FileExplorerPreferencePage;
|
|
39 |
import org.txm.rcp.preferences.RCPPreferences;
|
|
39 | 40 |
|
40 | 41 |
// TODO: Auto-generated Javadoc |
41 | 42 |
/** |
... | ... | |
50 | 51 |
*/ |
51 | 52 |
@Override |
52 | 53 |
public Object[] getChildren(Object element) { |
53 |
String regex = TxmPreferences.getString(FileExplorerPreferencePage.FILES_TO_HIDE, ""); //$NON-NLS-1$
|
|
54 |
final boolean showHidden = TxmPreferences.getBoolean(FileExplorerPreferencePage.SHOW_HIDDEN_FILES, false);
|
|
55 |
final boolean showFolder = TxmPreferences.getBoolean(FileExplorerPreferencePage.SHOW_FOLDERS, false);
|
|
54 |
String regex = TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.FILES_TO_HIDE, ""); //$NON-NLS-1$
|
|
55 |
final boolean showHidden = TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SHOW_HIDDEN_FILES);
|
|
56 |
final boolean showFolder = TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SHOW_FOLDERS);
|
|
56 | 57 |
p = null; |
57 | 58 |
try { |
58 | 59 |
p = Pattern.compile(regex); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/LanguageSwitchHandler.java (revision 325) | ||
---|---|---|
43 | 43 |
import org.eclipse.core.commands.ExecutionException; |
44 | 44 |
import org.eclipse.core.runtime.Platform; |
45 | 45 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
46 |
import org.eclipse.equinox.app.IApplication; |
|
47 | 46 |
import org.eclipse.jface.window.Window; |
48 | 47 |
import org.eclipse.osgi.service.datalocation.Location; |
49 | 48 |
import org.eclipse.osgi.util.NLS; |
50 | 49 |
import org.eclipse.swt.widgets.Shell; |
51 | 50 |
import org.eclipse.ui.PlatformUI; |
52 | 51 |
import org.eclipse.ui.handlers.HandlerUtil; |
53 |
import org.txm.Toolbox;
|
|
52 |
import org.txm.core.preferences.TXMPreferences;
|
|
54 | 53 |
import org.txm.rcp.Application; |
55 | 54 |
import org.txm.rcp.Messages; |
56 | 55 |
import org.txm.rcp.TxmPreferences; |
57 |
import org.txm.rcp.preferences.LocalePreferencePage;
|
|
56 |
import org.txm.rcp.preferences.RCPPreferences;
|
|
58 | 57 |
import org.txm.rcp.swt.dialog.ComboDialog; |
59 | 58 |
import org.txm.utils.logger.Log; |
60 | 59 |
import org.txm.utils.logger.MessageBox; |
... | ... | |
93 | 92 |
values.add("ru"); //$NON-NLS-1$ |
94 | 93 |
ComboDialog d = new ComboDialog(shell, Messages.LanguageSwitchHandler_3, values, |
95 | 94 |
service.getString(Application.PLUGIN_ID, |
96 |
LocalePreferencePage.UI_LOCALE, "fr", null)); //$NON-NLS-1$
|
|
95 |
RCPPreferences.UI_LOCALE, "fr", null)); //$NON-NLS-1$
|
|
97 | 96 |
if (d.open() == Window.OK) { |
98 |
TxmPreferences.set(LocalePreferencePage.UI_LOCALE, d
|
|
97 |
TXMPreferences.putString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UI_LOCALE, d
|
|
99 | 98 |
.getSelectedValue()); |
100 | 99 |
} else |
101 | 100 |
return null; |
102 | 101 |
|
103 | 102 |
String locale = service.getString(Application.PLUGIN_ID, |
104 |
LocalePreferencePage.UI_LOCALE, "fr", null); //$NON-NLS-1$
|
|
103 |
RCPPreferences.UI_LOCALE, "fr", null); //$NON-NLS-1$
|
|
105 | 104 |
if (locale.length() == 0) |
106 | 105 |
Log.warning(Messages.LanguageSwitchHandler_0); |
107 | 106 |
// Does not work: |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/RunGroovyScript.java (revision 325) | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import org.eclipse.core.runtime.IProgressMonitor; |
38 | 38 |
import org.eclipse.core.runtime.IStatus; |
39 |
import org.eclipse.core.runtime.Platform; |
|
40 | 39 |
import org.eclipse.core.runtime.Status; |
41 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
|
42 | 40 |
import org.eclipse.jface.action.Action; |
43 | 41 |
import org.eclipse.osgi.util.NLS; |
44 | 42 |
import org.eclipse.swt.SWT; |
... | ... | |
46 | 44 |
import org.eclipse.ui.IWorkbenchWindow; |
47 | 45 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
48 | 46 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
47 |
import org.txm.core.preferences.TBXPreferences; |
|
48 |
import org.txm.core.preferences.TXMPreferences; |
|
49 | 49 |
import org.txm.importer.scripting.GroovyImportScriptRunner; |
50 | 50 |
import org.txm.rcp.Application; |
51 | 51 |
import org.txm.rcp.IImageKeys; |
52 | 52 |
import org.txm.rcp.Messages; |
53 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
54 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
55 | 53 |
import org.txm.rcp.swt.dialog.LastOpened; |
56 | 54 |
import org.txm.rcp.utils.JobHandler; |
57 | 55 |
|
... | ... | |
104 | 102 |
|
105 | 103 |
FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN); |
106 | 104 |
dialog.setFilterExtensions(new String[] { Messages.RunGroovyScript_3 }); |
107 |
IPreferencesService service = Platform.getPreferencesService(); |
|
108 |
String scriptRootDir = service.getString(Application.PLUGIN_ID, |
|
109 |
ScriptPreferencePage.SCRIPT_ROOT_DIR, |
|
110 |
ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null); |
|
111 |
String scriptCurrentDir = service.getString(Application.PLUGIN_ID, |
|
112 |
ScriptPreferencePage.SCRIPT_CURRENT_DIR, |
|
113 |
ScriptPreferenceInitializer.SCRIPT_CURRENT_DIR_DEFAULT, null); |
|
105 |
String scriptRootDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
106 |
String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
107 |
|
|
114 | 108 |
|
115 | 109 |
if (LastOpened.getFolder(ID) != null) { |
116 | 110 |
scriptCurrentDir = LastOpened.getFolder(ID); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenTXMUserPreferences.java (revision 325) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.commands; |
|
29 |
|
|
30 |
import java.util.Arrays; |
|
31 |
|
|
32 |
import org.eclipse.core.commands.AbstractHandler; |
|
33 |
import org.eclipse.core.commands.ExecutionEvent; |
|
34 |
import org.eclipse.core.commands.ExecutionException; |
|
35 |
import org.eclipse.jface.preference.IPreferenceNode; |
|
36 |
import org.eclipse.jface.preference.PreferenceDialog; |
|
37 |
import org.eclipse.jface.preference.PreferenceManager; |
|
38 |
import org.eclipse.jface.preference.PreferenceNode; |
|
39 |
import org.eclipse.swt.custom.BusyIndicator; |
|
40 |
import org.eclipse.swt.widgets.Display; |
|
41 |
import org.eclipse.swt.widgets.Shell; |
|
42 |
import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog; |
|
43 |
import org.txm.cooccurrence.rcp.preferences.CoocPreferencePage; |
|
44 |
import org.txm.progression.rcp.preferences.ProgressionPreferencePage; |
|
45 |
import org.txm.rcp.Messages; |
|
46 |
import org.txm.rcp.preferences.ConcordancerPreferencePage; |
|
47 |
import org.txm.rcp.preferences.DiagnosticPreferencePage; |
|
48 |
import org.txm.rcp.preferences.ExportPreferencePage; |
|
49 |
import org.txm.rcp.preferences.LocalePreferencePage; |
|
50 |
import org.txm.rcp.preferences.ReferencerPreferencePage; |
|
51 |
import org.txm.rcp.preferences.UserPreferencePage; |
|
52 |
import org.txm.specificities.rcp.preferences.SpecificitiesPreferencePage; |
|
53 |
// TODO: Auto-generated Javadoc |
|
54 |
/** |
|
55 |
* The Class OpenTXMUserPreferences. |
|
56 |
*/ |
|
57 |
// FIXME: see if this class is still in used |
|
58 |
public class OpenTXMUserPreferences extends AbstractHandler { |
|
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
62 |
*/ |
|
63 |
@Override |
|
64 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
65 |
|
|
66 |
configureWorkspaceSettings(); |
|
67 |
|
|
68 |
return null; |
|
69 |
} |
|
70 |
|
|
71 |
|
|
72 |
/** |
|
73 |
* Configure workspace settings. |
|
74 |
*/ |
|
75 |
protected void configureWorkspaceSettings() { |
|
76 |
|
|
77 |
IPreferenceNode userNode = new PreferenceNode(UserPreferencePage.ID, new UserPreferencePage()); |
|
78 |
|
|
79 |
Arrays.toString(userNode.getSubNodes()); |
|
80 |
|
|
81 |
IPreferenceNode concordanceNode = new PreferenceNode(ConcordancerPreferencePage.ID, new ConcordancerPreferencePage()); |
|
82 |
// IPreferenceNode cooccurrencesNode = new PreferenceNode(CoocPreferencePage.ID, new CoocPreferencePage()); |
|
83 |
// IPreferenceNode caNode = new PreferenceNode(CAPreferencePage.ID, new CAPreferencePage()); |
|
84 |
IPreferenceNode informationsNode = new PreferenceNode(DiagnosticPreferencePage.ID, new DiagnosticPreferencePage()); |
|
85 |
IPreferenceNode exportNode = new PreferenceNode(ExportPreferencePage.ID, new ExportPreferencePage()); |
|
86 |
IPreferenceNode languageNode = new PreferenceNode(LocalePreferencePage.ID, new LocalePreferencePage()); |
|
87 |
// IPreferenceNode progressionNode = new PreferenceNode(ProgressionPreferencePage.ID, new ProgressionPreferencePage()); |
|
88 |
// IPreferenceNode specifNode = new PreferenceNode(SpecificitiesPreferencePage.ID, new SpecificitiesPreferencePage()); |
|
89 |
// IPreferenceNode ltNode = new PreferenceNode(LexicalTablePreferencePage.ID, new LexicalTablePreferencePage()); |
|
90 |
IPreferenceNode refNode = new PreferenceNode(ReferencerPreferencePage.ID, new ReferencerPreferencePage()); |
|
91 |
|
|
92 |
userNode.add(concordanceNode); |
|
93 |
// userNode.add(cooccurrencesNode); |
|
94 |
// userNode.add(caNode); |
|
95 |
userNode.add(informationsNode); |
|
96 |
userNode.add(exportNode); |
|
97 |
userNode.add(languageNode); |
|
98 |
// userNode.add(progressionNode); |
|
99 |
// userNode.add(specifNode); |
|
100 |
// userNode.add(ltNode); |
|
101 |
userNode.add(refNode); |
|
102 |
|
|
103 |
PreferenceManager manager = new PreferenceManager(); |
|
104 |
manager.addToRoot(userNode); |
|
105 |
|
|
106 |
//manager.addTo(, concordanceNode); |
|
107 |
showPreferencePage(manager); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Show preference page. |
|
112 |
* |
|
113 |
* @param manager the manager |
|
114 |
*/ |
|
115 |
protected void showPreferencePage(PreferenceManager manager) { |
|
116 |
|
|
117 |
|
|
118 |
final PreferenceDialog dialog = new WorkbenchPreferenceDialog(new Shell(), manager); |
|
119 |
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { |
|
120 |
@Override |
|
121 |
public void run() { |
|
122 |
dialog.create(); |
|
123 |
dialog.setMessage(Messages.OpenTXMUserPreferences_0); |
|
124 |
dialog.open(); |
|
125 |
} |
|
126 |
}); |
|
127 |
} |
|
128 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/R/OpenEmptyEditor.java (revision 325) | ||
---|---|---|
35 | 35 |
import org.eclipse.core.commands.ExecutionException; |
36 | 36 |
import org.eclipse.osgi.util.NLS; |
37 | 37 |
import org.txm.core.preferences.TBXPreferences; |
38 |
import org.txm.core.preferences.TXMPreferences; |
|
38 | 39 |
import org.txm.rcp.Messages; |
39 | 40 |
import org.txm.rcp.TxmPreferences; |
40 | 41 |
import org.txm.rcp.commands.EditFile; |
41 |
import org.txm.rcp.preferences.ScriptPreferencePage;
|
|
42 |
import org.txm.rcp.preferences.RCPPreferences;
|
|
42 | 43 |
import org.txm.utils.logger.Log; |
43 | 44 |
// TODO: Auto-generated Javadoc |
44 | 45 |
/** |
... | ... | |
51 | 52 |
*/ |
52 | 53 |
@Override |
53 | 54 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
54 |
File txmhome = new File(TxmPreferences.getString(TBXPreferences.USER_TXM_HOME, "")); //$NON-NLS-1$
|
|
55 |
File txmhome = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME, "")); //$NON-NLS-1$
|
|
55 | 56 |
File scripts = new File(txmhome, "scripts"); //$NON-NLS-1$ |
56 | 57 |
scripts.mkdir(); |
57 | 58 |
if (!scripts.exists()) |
... | ... | |
68 | 69 |
return null; |
69 | 70 |
} |
70 | 71 |
|
71 |
int nosession = TxmPreferences.getInt(ScriptPreferencePage.NO_SESSION, 1);
|
|
72 |
int nosession = TXMPreferences.getInt(RCPPreferences.PREFERENCES_NODE, RCPPreferences.NO_SESSION);
|
|
72 | 73 |
|
73 | 74 |
File temp = new File(Rscripts, "session"+nosession+".R"); //$NON-NLS-1$ //$NON-NLS-2$ |
74 | 75 |
|
75 | 76 |
//create newt session no |
76 | 77 |
nosession++; |
77 |
TxmPreferences.set(ScriptPreferencePage.NO_SESSION, nosession);
|
|
78 |
TXMPreferences.putInt(RCPPreferences.PREFERENCES_NODE, RCPPreferences.NO_SESSION, nosession);
|
|
78 | 79 |
|
79 | 80 |
try { |
80 | 81 |
temp.createNewFile(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateMacro.java (revision 325) | ||
---|---|---|
34 | 34 |
import org.eclipse.core.commands.AbstractHandler; |
35 | 35 |
import org.eclipse.core.commands.ExecutionEvent; |
36 | 36 |
import org.eclipse.core.commands.ExecutionException; |
37 |
import org.eclipse.core.runtime.Platform; |
|
38 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
|
39 | 37 |
import org.eclipse.jface.dialogs.InputDialog; |
40 | 38 |
import org.eclipse.jface.viewers.ISelection; |
41 | 39 |
import org.eclipse.jface.viewers.IStructuredSelection; |
... | ... | |
44 | 42 |
import org.eclipse.ui.IWorkbenchPage; |
45 | 43 |
import org.eclipse.ui.IWorkbenchWindow; |
46 | 44 |
import org.eclipse.ui.handlers.HandlerUtil; |
47 |
import org.txm.rcp.Application; |
|
45 |
import org.txm.core.preferences.TBXPreferences; |
|
46 |
import org.txm.core.preferences.TXMPreferences; |
|
48 | 47 |
import org.txm.rcp.Messages; |
49 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
50 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
51 | 48 |
import org.txm.rcp.swt.dialog.LastOpened; |
52 |
import org.txm.rcp.views.fileexplorer.Explorer; |
|
53 | 49 |
import org.txm.rcp.views.fileexplorer.MacroExplorer; |
54 | 50 |
import org.txm.utils.AsciiUtils; |
55 | 51 |
import org.txm.utils.io.IOUtils; |
... | ... | |
67 | 63 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
68 | 64 |
|
69 | 65 |
//get scripts dir |
70 |
IPreferencesService service = Platform.getPreferencesService(); |
|
71 |
String scriptRootDir = service.getString(Application.PLUGIN_ID, |
|
72 |
ScriptPreferencePage.SCRIPT_ROOT_DIR, |
|
73 |
ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null); |
|
66 |
String scriptRootDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
74 | 67 |
File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$ |
75 | 68 |
|
76 | 69 |
//if selection is a file, get its path |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/base/DeleteObject.java (revision 325) | ||
---|---|---|
49 | 49 |
import org.eclipse.ui.IWorkbenchWindow; |
50 | 50 |
import org.eclipse.ui.handlers.HandlerUtil; |
51 | 51 |
import org.eclipse.ui.internal.Workbench; |
52 |
import org.txm.core.preferences.TXMPreferences; |
|
52 | 53 |
import org.txm.core.results.ITXMResult; |
53 | 54 |
import org.txm.functions.Function; |
54 | 55 |
import org.txm.functions.concordances.Concordance; |
... | ... | |
56 | 57 |
import org.txm.functions.referencer.Referencer; |
57 | 58 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
58 | 59 |
import org.txm.objects.TxmObject; |
59 |
import org.txm.rcp.editors.TXMEditorPart; |
|
60 | 60 |
import org.txm.rcp.Messages; |
61 | 61 |
import org.txm.rcp.StatusLine; |
62 |
import org.txm.rcp.TxmPreferences; |
|
63 | 62 |
import org.txm.rcp.commands.editor.CustomizableEditor; |
64 |
import org.txm.rcp.preferences.UserPreferencePage; |
|
63 |
import org.txm.rcp.editors.TXMEditorPart; |
|
64 |
import org.txm.rcp.preferences.RCPPreferences; |
|
65 | 65 |
import org.txm.rcp.utils.JobHandler; |
66 | 66 |
import org.txm.rcp.views.BasesView; |
67 | 67 |
import org.txm.rcp.views.QueriesView; |
... | ... | |
110 | 110 |
public static synchronized boolean askContinueToDelete(final IStructuredSelection selection) { |
111 | 111 |
continueToDelete = true; |
112 | 112 |
|
113 |
boolean dontShowAlert = !TxmPreferences.getBoolean( |
|
114 |
UserPreferencePage.USER_ALERT_DELETE, false); |
|
113 |
boolean dontShowAlert = !TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.USER_ALERT_DELETE); |
|
115 | 114 |
|
116 | 115 |
if (dontShowAlert) { |
117 | 116 |
Display.getDefault().syncExec(new Runnable() { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFolder.java (revision 325) | ||
---|---|---|
41 | 41 |
import org.eclipse.ui.IWorkbenchPart; |
42 | 42 |
import org.eclipse.ui.handlers.HandlerUtil; |
43 | 43 |
import org.txm.core.preferences.TBXPreferences; |
44 |
import org.txm.core.preferences.TXMPreferences; |
|
44 | 45 |
import org.txm.rcp.Messages; |
45 |
import org.txm.rcp.TxmPreferences; |
|
46 | 46 |
import org.txm.rcp.swt.dialog.LastOpened; |
47 | 47 |
import org.txm.rcp.views.fileexplorer.Explorer; |
48 | 48 |
import org.txm.rcp.views.fileexplorer.MacroExplorer; |
... | ... | |
62 | 62 |
.getActivePage().getActivePart(); |
63 | 63 |
|
64 | 64 |
//get scripts dir |
65 |
String dir = TxmPreferences.getString(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
|
|
65 |
String dir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
|
|
66 | 66 |
|
67 | 67 |
//if selection is a file, get its path |
68 | 68 |
ISelection selection = HandlerUtil.getCurrentSelection(event); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CreateFile.java (revision 325) | ||
---|---|---|
33 | 33 |
import org.eclipse.core.commands.AbstractHandler; |
34 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
35 | 35 |
import org.eclipse.core.commands.ExecutionException; |
36 |
import org.eclipse.core.runtime.Platform; |
|
37 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
|
38 | 36 |
import org.eclipse.jface.viewers.ISelection; |
39 | 37 |
import org.eclipse.jface.viewers.IStructuredSelection; |
40 | 38 |
import org.eclipse.osgi.util.NLS; |
... | ... | |
44 | 42 |
import org.eclipse.ui.IWorkbenchPage; |
45 | 43 |
import org.eclipse.ui.IWorkbenchWindow; |
46 | 44 |
import org.eclipse.ui.handlers.HandlerUtil; |
47 |
import org.txm.rcp.Application; |
|
45 |
import org.txm.core.preferences.TBXPreferences; |
|
46 |
import org.txm.core.preferences.TXMPreferences; |
|
48 | 47 |
import org.txm.rcp.Messages; |
49 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
50 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
51 | 48 |
import org.txm.rcp.swt.dialog.LastOpened; |
52 | 49 |
import org.txm.rcp.views.fileexplorer.Explorer; |
53 | 50 |
import org.txm.rcp.views.fileexplorer.MacroExplorer; |
... | ... | |
65 | 62 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
66 | 63 |
|
67 | 64 |
//get scripts dir |
68 |
IPreferencesService service = Platform.getPreferencesService(); |
|
69 |
String scriptCurrentDir = service.getString(Application.PLUGIN_ID, |
|
70 |
ScriptPreferencePage.SCRIPT_CURRENT_DIR, |
|
71 |
ScriptPreferenceInitializer.SCRIPT_CURRENT_DIR_DEFAULT, |
|
72 |
null); |
|
65 |
String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
73 | 66 |
|
74 | 67 |
boolean useSavedValue = true; // if a file/folder is selected, dont use the saved value |
75 | 68 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ExportResult.java (revision 325) | ||
---|---|---|
170 | 170 |
|
171 | 171 |
if (outfile.exists()) { |
172 | 172 |
// Open internal editor in the UI thread |
173 |
if(TxmPreferences.getBoolean(TBXPreferences.EXPORT_SHOW)) {
|
|
173 |
if(TXMPreferences.getBoolean(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPORT_SHOW)) {
|
|
174 | 174 |
this.syncExec(new Runnable() { |
175 | 175 |
@Override |
176 | 176 |
public void run() { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/ComputeDiagnostic.java (revision 325) | ||
---|---|---|
43 | 43 |
import org.eclipse.ui.handlers.HandlerUtil; |
44 | 44 |
import org.txm.Toolbox; |
45 | 45 |
import org.txm.core.preferences.TBXPreferences; |
46 |
import org.txm.core.preferences.TXMPreferences; |
|
46 | 47 |
import org.txm.functions.diagnostic.Diagnostic; |
47 | 48 |
import org.txm.rcp.JobsTimer; |
48 | 49 |
import org.txm.rcp.Messages; |
49 |
import org.txm.rcp.TxmPreferences; |
|
50 | 50 |
import org.txm.rcp.commands.OpenBrowser; |
51 | 51 |
import org.txm.rcp.editors.TXMWebBrowserEditor; |
52 |
import org.txm.rcp.preferences.DiagnosticPreferencePage;
|
|
52 |
import org.txm.rcp.preferences.RCPPreferences;
|
|
53 | 53 |
import org.txm.rcp.utils.JobHandler; |
54 | 54 |
import org.txm.searchengine.cqp.AbstractCqiClient; |
55 | 55 |
import org.txm.searchengine.cqp.NetCqiClient; |
... | ... | |
118 | 118 |
JobsTimer.start(); |
119 | 119 |
//this.setCurrentMonitor(monitor); |
120 | 120 |
monitor.beginTask(NLS.bind(Messages.Diagnostique_0, corpus.getName()), 100); |
121 |
final int maxvalue = TxmPreferences.getInt(DiagnosticPreferencePage.MAXVALUE);
|
|
121 |
final int maxvalue = TXMPreferences.getInt(RCPPreferences.PREFERENCES_NODE, RCPPreferences.MAXVALUE);
|
|
122 | 122 |
diagfile.getParentFile().mkdir(); |
123 | 123 |
|
124 | 124 |
if (monitor.isCanceled()) |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyScriptFromFile.java (revision 325) | ||
---|---|---|
32 | 32 |
import org.eclipse.core.commands.AbstractHandler; |
33 | 33 |
import org.eclipse.core.commands.ExecutionEvent; |
34 | 34 |
import org.eclipse.core.commands.ExecutionException; |
35 |
import org.eclipse.core.runtime.Platform; |
|
36 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
|
37 | 35 |
import org.eclipse.jface.viewers.ISelection; |
38 | 36 |
import org.eclipse.swt.SWT; |
39 | 37 |
import org.eclipse.swt.widgets.FileDialog; |
40 | 38 |
import org.eclipse.swt.widgets.Shell; |
41 | 39 |
import org.eclipse.ui.IWorkbenchPart; |
42 | 40 |
import org.eclipse.ui.handlers.HandlerUtil; |
43 |
import org.txm.rcp.Application; |
|
44 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
45 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
41 |
import org.txm.core.preferences.TBXPreferences; |
|
42 |
import org.txm.core.preferences.TXMPreferences; |
|
46 | 43 |
import org.txm.rcp.swt.dialog.LastOpened; |
47 | 44 |
/** |
48 | 45 |
* Ask the user to select a Groovy script using a File dialog and execute it |
... | ... | |
63 | 60 |
ISelection selection = HandlerUtil.getCurrentSelection(event); |
64 | 61 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
65 | 62 |
|
66 |
IPreferencesService service = Platform.getPreferencesService(); |
|
67 |
String scriptCurrentDir = service.getString(Application.PLUGIN_ID, |
|
68 |
ScriptPreferencePage.SCRIPT_ROOT_DIR, |
|
69 |
ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, |
|
70 |
null); |
|
63 |
String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
71 | 64 |
|
72 | 65 |
FileDialog dialog = new FileDialog(shell, SWT.OPEN); |
73 | 66 |
|
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteImportScript.java (revision 325) | ||
---|---|---|
28 | 28 |
package org.txm.rcp.commands; |
29 | 29 |
|
30 | 30 |
import groovy.lang.Binding; |
31 |
import groovy.lang.GroovyClassLoader; |
|
32 | 31 |
import groovy.util.GroovyScriptEngine; |
33 | 32 |
|
34 | 33 |
import java.io.File; |
... | ... | |
59 | 58 |
import org.txm.rcp.Messages; |
60 | 59 |
import org.txm.rcp.StatusLine; |
61 | 60 |
import org.txm.rcp.commands.workspace.LoadBinaryCorpus; |
62 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
63 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
64 | 61 |
import org.txm.rcp.utils.GSERunner; |
65 | 62 |
import org.txm.rcp.utils.JobHandler; |
66 | 63 |
import org.txm.rcp.views.corpora.CorporaView; |
... | ... | |
158 | 155 |
// groovy configuration |
159 | 156 |
IPreferencesService service = Platform.getPreferencesService(); |
160 | 157 |
String scriptRootDir = service.getString(Application.PLUGIN_ID, |
161 |
ScriptPreferencePage.SCRIPT_ROOT_DIR,
|
|
162 |
ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null);
|
|
158 |
TBXPreferences.USER_TXM_HOME+"/scripts",
|
|
159 |
"", null);
|
|
163 | 160 |
|
164 |
// ClassLoader parent = ExecuteImportScript.class.getClassLoader(); |
|
165 |
// final GroovyClassLoader loader = new GroovyClassLoader(parent); |
|
166 |
|
|
167 |
|
|
168 | 161 |
final String[] roots = new String[] { |
169 | 162 |
script.getParent(), |
170 | 163 |
scriptRootDir }; |
171 | 164 |
|
172 |
|
|
173 | 165 |
params.load(); // reload params |
174 | 166 |
|
175 | 167 |
// the binary directory which is going to be created |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteScript.java (revision 325) | ||
---|---|---|
33 | 33 |
import org.eclipse.core.commands.AbstractHandler; |
34 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
35 | 35 |
import org.eclipse.core.commands.ExecutionException; |
36 |
import org.eclipse.core.runtime.Platform; |
|
37 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
|
38 | 36 |
import org.eclipse.jface.dialogs.MessageDialog; |
39 | 37 |
import org.eclipse.jface.viewers.ISelection; |
40 | 38 |
import org.eclipse.jface.viewers.IStructuredSelection; |
... | ... | |
49 | 47 |
import org.eclipse.ui.IWorkbenchPart; |
50 | 48 |
import org.eclipse.ui.handlers.HandlerUtil; |
51 | 49 |
import org.eclipse.ui.ide.FileStoreEditorInput; |
52 |
import org.txm.rcp.Application; |
|
50 |
import org.txm.core.preferences.TBXPreferences; |
|
51 |
import org.txm.core.preferences.TXMPreferences; |
|
53 | 52 |
import org.txm.rcp.Messages; |
54 |
import org.txm.rcp.TxmPreferences; |
|
55 | 53 |
import org.txm.rcp.editors.TxtEditor; |
56 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
57 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
54 |
import org.txm.rcp.preferences.RCPPreferences; |
|
58 | 55 |
import org.txm.rcp.swt.dialog.LastOpened; |
59 | 56 |
import org.txm.statsengine.r.rcp.handlers.ExecuteRScript; |
60 | 57 |
// TODO: Auto-generated Javadoc |
... | ... | |
113 | 110 |
} |
114 | 111 |
dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$ |
115 | 112 |
|
116 |
IPreferencesService service = Platform.getPreferencesService(); |
|
117 |
String scriptCurrentDir = service.getString(Application.PLUGIN_ID, |
|
118 |
ScriptPreferencePage.SCRIPT_CURRENT_DIR, |
|
119 |
ScriptPreferenceInitializer.SCRIPT_CURRENT_DIR_DEFAULT, |
|
120 |
null); |
|
113 |
String scriptCurrentDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
121 | 114 |
|
122 | 115 |
dialog.setFilterPath(scriptCurrentDir); |
123 | 116 |
result = dialog.open(); |
... | ... | |
127 | 120 |
|
128 | 121 |
if (executionFromEditor && txteditor != null) { // save file if needed |
129 | 122 |
if (txteditor.isSaveOnCloseNeeded()) { // check if file need to be saved |
130 |
boolean doit = TxmPreferences.getBoolean(ScriptPreferencePage.SAVE_BEFORE_EXECUTION, false);
|
|
123 |
boolean doit = TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION);
|
|
131 | 124 |
//System.out.println("Save file? "+doit); |
132 | 125 |
if (!doit) { // ask user |
133 | 126 |
MessageDialog dialog = new MessageDialog(shell, Messages.ExecuteScript_0+result, null, |
... | ... | |
139 | 132 |
Composite container = (Composite) super.createDialogArea(parent); |
140 | 133 |
checkDefault = new Button(container, SWT.CHECK); |
141 | 134 |
checkDefault.setText(Messages.ExecuteScript_6); |
142 |
boolean b = TxmPreferences.getBoolean(ScriptPreferencePage.SAVE_BEFORE_EXECUTION, false);
|
|
135 |
boolean b = TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION);
|
|
143 | 136 |
checkDefault.setSelection(b); |
144 | 137 |
|
145 | 138 |
checkDefault.addSelectionListener(new SelectionListener() { |
... | ... | |
147 | 140 |
@Override |
148 | 141 |
public void widgetSelected(SelectionEvent e) { |
149 | 142 |
boolean b = checkDefault.getSelection(); |
150 |
TxmPreferences.set(ScriptPreferencePage.SAVE_BEFORE_EXECUTION, b);
|
|
143 |
TXMPreferences.putBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SAVE_BEFORE_EXECUTION, b);
|
|
151 | 144 |
} |
152 | 145 |
|
153 | 146 |
@Override |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenManual.java (revision 325) | ||
---|---|---|
37 | 37 |
import org.eclipse.core.commands.ExecutionEvent; |
38 | 38 |
import org.eclipse.core.commands.ExecutionException; |
39 | 39 |
import org.txm.core.preferences.TBXPreferences; |
40 |
import org.txm.rcp.TxmPreferences;
|
|
40 |
import org.txm.core.preferences.TXMPreferences;
|
|
41 | 41 |
import org.txm.utils.logger.Log; |
42 | 42 |
|
43 | 43 |
/** |
... | ... | |
66 | 66 |
|
67 | 67 |
public static void open() { |
68 | 68 |
String locale = Locale.getDefault().getLanguage(); |
69 |
String installdir = TxmPreferences.getString(TBXPreferences.INSTALL_DIR, ""); //$NON-NLS-1$
|
|
69 |
String installdir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR, ""); //$NON-NLS-1$
|
|
70 | 70 |
|
71 | 71 |
String file = files.get(locale); |
72 | 72 |
if (file == null) file = files.get(default_locale); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ExecuteGroovyText.java (revision 325) | ||
---|---|---|
46 | 46 |
import org.eclipse.core.runtime.preferences.IPreferencesService; |
47 | 47 |
import org.eclipse.jface.text.TextSelection; |
48 | 48 |
import org.eclipse.jface.viewers.ISelection; |
49 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
50 | 49 |
import org.eclipse.osgi.util.NLS; |
51 | 50 |
import org.eclipse.ui.IWorkbenchPart; |
52 | 51 |
import org.eclipse.ui.handlers.HandlerUtil; |
53 | 52 |
import org.eclipse.ui.ide.FileStoreEditorInput; |
53 |
import org.txm.core.preferences.TBXPreferences; |
|
54 |
import org.txm.core.preferences.TXMPreferences; |
|
54 | 55 |
import org.txm.rcp.Application; |
55 | 56 |
import org.txm.rcp.Messages; |
56 | 57 |
import org.txm.rcp.editors.TxtEditor; |
57 |
import org.txm.rcp.preferences.ScriptPreferenceInitializer; |
|
58 |
import org.txm.rcp.preferences.ScriptPreferencePage; |
|
59 | 58 |
import org.txm.rcp.utils.JobHandler; |
60 | 59 |
import org.txm.rcp.views.corpora.CorporaView; |
61 | 60 |
|
... | ... | |
111 | 110 |
scriptfile)); |
112 | 111 |
return null; |
113 | 112 |
} |
114 |
IPreferencesService service = Platform.getPreferencesService(); |
|
115 |
final String scriptRootDir = service.getString(Application.PLUGIN_ID, |
|
116 |
ScriptPreferencePage.SCRIPT_ROOT_DIR, |
|
117 |
ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null); |
|
113 |
final String scriptRootDir = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.USER_TXM_HOME)+ "/scripts"; |
|
118 | 114 |
|
119 | 115 |
// get current selection of the corpora view |
120 | 116 |
final Object corpusViewSelection = CorporaView.getSelection(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ConcordancerPreferenceInitializer.java (revision 325) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.preferences; |
|
29 |
|
|
30 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
|
31 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
32 |
import org.txm.rcp.Activator; |
|
33 |
|
|
34 |
// TODO: Auto-generated Javadoc |
|
35 |
/** |
|
36 |
* The Class ConcordancerPreferenceInitializer. |
|
37 |
*/ |
|
38 |
public class ConcordancerPreferenceInitializer extends |
|
39 |
AbstractPreferenceInitializer { |
|
40 |
|
|
41 |
/** The Constant N_LINE_PER_PAGE_DEFAULT. */ |
|
42 |
public static final int N_LINE_PER_PAGE_DEFAULT = 100; |
|
43 |
|
|
44 |
/** The Constant LEFT_CONTEXT_SIZE_DEFAULT. */ |
|
45 |
public static final int LEFT_CONTEXT_SIZE_DEFAULT = 15; |
|
46 |
|
|
47 |
/** The Constant RIGHT_CONTEXT_SIZE_DEFAULT. */ |
|
48 |
public static final int RIGHT_CONTEXT_SIZE_DEFAULT = 15; |
|
49 |
|
|
50 |
/* (non-Javadoc) |
|
51 |
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() |
|
52 |
*/ |
|
53 |
@Override |
|
54 |
public void initializeDefaultPreferences() { |
|
55 |
Activator a = Activator.getDefault(); |
|
56 |
IPreferenceStore store = a.getPreferenceStore(); |
|
57 |
store.setDefault(ConcordancerPreferencePage.N_LINE_PER_PAGE, |
|
58 |
N_LINE_PER_PAGE_DEFAULT); |
|
59 |
store.setDefault(ConcordancerPreferencePage.LEFT_CONTEXT_SIZE, |
|
60 |
LEFT_CONTEXT_SIZE_DEFAULT); |
|
61 |
store.setDefault(ConcordancerPreferencePage.RIGHT_CONTEXT_SIZE, |
|
62 |
RIGHT_CONTEXT_SIZE_DEFAULT); |
|
63 |
} |
|
64 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ScriptPreferenceInitializer.java (revision 325) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.preferences; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
|
33 |
import org.txm.Toolbox; |
|
34 |
import org.txm.core.preferences.TBXPreferences; |
|
35 |
import org.txm.rcp.Activator; |
|
36 |
|
|
37 |
// TODO: Auto-generated Javadoc |
|
38 |
/** |
|
39 |
* The Class ScriptPreferenceInitializer. |
|
40 |
*/ |
|
41 |
public class ScriptPreferenceInitializer extends AbstractPreferenceInitializer { |
|
42 |
|
|
43 |
/** The txmhome. */ |
|
44 |
static String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME); |
|
45 |
|
|
46 |
/** The Constant SCRIPT_ROOT_DIR_DEFAULT. */ |
|
47 |
public static final String SCRIPT_ROOT_DIR_DEFAULT = txmhome + File.separator + File.separator + "scripts"; //$NON-NLS-1$ |
|
48 |
|
|
49 |
/** The Constant SCRIPT_CURRENT_DIR_DEFAULT. */ |
|
50 |
public static final String SCRIPT_CURRENT_DIR_DEFAULT = txmhome + File.separator + "scripts"; //$NON-NLS-1$ |
|
51 |
|
|
52 |
/* (non-Javadoc) |
|
53 |
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
public void initializeDefaultPreferences() { |
|
57 |
Activator a = Activator.getDefault(); |
|
58 |
a.getPreferenceStore(); |
|
59 |
} |
|
60 |
|
|
61 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/OpenPathFromPreferenceFieldEditor.java (revision 325) | ||
---|---|---|
1 |
package org.txm.rcp.preferences; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
|
|
6 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
|
7 |
import org.eclipse.swt.SWT; |
|
8 |
import org.eclipse.swt.events.DisposeEvent; |
|
9 |
import org.eclipse.swt.events.DisposeListener; |
|
10 |
import org.eclipse.swt.events.SelectionAdapter; |
|
11 |
import org.eclipse.swt.events.SelectionEvent; |
|
12 |
import org.eclipse.swt.widgets.Button; |
|
13 |
import org.eclipse.swt.widgets.Composite; |
|
14 |
import org.txm.rcp.TxmPreferences; |
|
15 |
|
|
16 |
public class OpenPathFromPreferenceFieldEditor extends BooleanFieldEditor { |
|
17 |
private Button theCheckBox; |
|
18 |
String preferenceName; |
|
19 |
public OpenPathFromPreferenceFieldEditor(String name, String title, Composite parent, String preferencename) { |
|
20 |
super(name, title, parent); |
|
21 |
this.preferenceName = preferencename; |
|
22 |
} |
|
23 |
|
|
24 |
/** |
|
25 |
* Returns the change button for this field editor. |
|
26 |
* |
|
27 |
* @param parent |
|
28 |
* The Composite to create the receiver in. |
|
29 |
* |
|
30 |
* @return the change button |
|
31 |
*/ |
|
32 |
@Override |
|
33 |
protected Button getChangeControl(Composite parent) { |
|
34 |
|
|
35 |
if (theCheckBox == null) { |
|
36 |
theCheckBox = super.getChangeControl(parent); |
|
37 |
theCheckBox.dispose(); |
|
38 |
theCheckBox = new Button(parent, SWT.PUSH | SWT.LEFT); |
|
39 |
theCheckBox.setFont(parent.getFont()); |
|
40 |
theCheckBox.addSelectionListener(new SelectionAdapter() { |
|
41 |
@Override |
|
42 |
public void widgetSelected(SelectionEvent e) { |
|
43 |
java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); |
|
44 |
try { |
|
45 |
String path = TxmPreferences.get(preferenceName); |
|
46 |
if (path == null | path.length() == 0) { |
|
47 |
System.out.println(preferenceName+" preference is not set."); |
|
48 |
return; |
|
49 |
} |
|
50 |
File dir = new File(path); |
|
51 |
if (dir.exists()) { |
|
52 |
desktop.open(dir); |
|
53 |
} else { |
|
54 |
System.out.println("Cannot open: "+dir); |
|
55 |
} |
|
56 |
} catch (IOException e1) { |
|
57 |
// TODO Auto-generated catch block |
|
58 |
e1.printStackTrace(); |
|
59 |
} |
|
60 |
} |
|
61 |
}); |
|
62 |
theCheckBox.addDisposeListener(new DisposeListener() { |
|
63 |
@Override |
|
64 |
public void widgetDisposed(DisposeEvent event) { |
|
65 |
theCheckBox = null; |
|
66 |
} |
|
67 |
}); |
|
68 |
} else { |
|
69 |
checkParent(theCheckBox, parent); |
|
70 |
} |
|
71 |
return theCheckBox; |
|
72 |
} |
|
73 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/CQPPreferenceInitializer.java (revision 325) | ||
---|---|---|
1 |
// Copyright © 2010-2013 ENS de Lyon. |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.preferences; |
|
29 |
|
|
30 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
|
31 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
32 |
import org.txm.core.preferences.TBXPreferences; |
|
33 |
import org.txm.rcp.Activator; |
|
34 |
import org.txm.rcp.Messages; |
|
35 |
// TODO: Auto-generated Javadoc |
|
36 |
/** |
|
37 |
* Class used to initialize default preference values. |
|
38 |
*/ |
|
39 |
public class CQPPreferenceInitializer extends AbstractPreferenceInitializer { |
|
40 |
|
|
41 |
/* |
|
42 |
* (non-Javadoc) |
|
43 |
* |
|
44 |
* @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer# |
|
45 |
* initializeDefaultPreferences() |
|
46 |
*/ |
|
47 |
|
|
48 |
/** The Constant CQI_DEFAULT_SERVER_IS_REMOTE. */ |
|
49 |
public static final boolean CQI_DEFAULT_SERVER_IS_REMOTE = false; |
|
50 |
|
|
51 |
/** The Constant CQI_DEFAULT_SERVER_HOST. */ |
|
52 |
public static final String CQI_DEFAULT_SERVER_HOST = Messages.CQPPreferenceInitializer_0; |
|
53 |
|
|
54 |
/** The Constant CQI_DEFAULT_SERVER_PORT. */ |
|
55 |
public static final int CQI_DEFAULT_SERVER_PORT = 4877; |
|
56 |
|
|
57 |
/** The Constant CQI_DEFAULT_SERVER_LOGIN. */ |
|
58 |
public static final String CQI_DEFAULT_SERVER_LOGIN = Messages.CQPPreferenceInitializer_1; |
|
59 |
|
|
60 |
/** The Constant CQI_DEFAULT_SERVER_PASSWORD. */ |
|
61 |
public static final String CQI_DEFAULT_SERVER_PASSWORD = ""; //$NON-NLS-1$ |
|
62 |
|
|
63 |
/** The Constant CQI_DEFAULT_SERVER_PATH_TO_EXECUTABLE. */ |
|
64 |
public static final String CQI_DEFAULT_SERVER_PATH_TO_EXECUTABLE = ""; //default value expected to be set by te command line option; see Application.java //$NON-NLS-1$ |
|
65 |
|
|
66 |
/** The Constant CQI_DEFAULT_SERVER_PATH_TO_REGISTRY. */ |
|
67 |
public static final String CQI_DEFAULT_SERVER_PATH_TO_REGISTRY = ""; //default value expected to be set by te command line option; see Application.java //$NON-NLS-1$ |
|
68 |
|
|
69 |
/** The Constant CQI_DEFAULT_SERVER_PATH_TO_INIT_FILE. */ |
|
70 |
public static final String CQI_DEFAULT_SERVER_PATH_TO_INIT_FILE = ""; //default value expected to be set by te command line option; see Application.java //$NON-NLS-1$ |
|
71 |
|
|
72 |
/** The Constant CQI_DEFAULT_SERVER_ADDITIONAL_OPTIONS. */ |
|
73 |
public static final String CQI_DEFAULT_SERVER_ADDITIONAL_OPTIONS = " -b 1000000 -d OFF"; //$NON-NLS-1$ |
|
74 |
|
|
75 |
/* (non-Javadoc) |
|
76 |
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() |
|
77 |
*/ |
|
78 |
@Override |
|
79 |
public void initializeDefaultPreferences() { |
|
80 |
// new |
|
81 |
// DefaultScope().getNode(ReprioritizerPlugin.getId()); |
|
82 |
Activator a = Activator.getDefault(); |
|
83 |
IPreferenceStore store = a.getPreferenceStore(); |
|
84 |
|
|
85 |
store.setDefault(TBXPreferences.CQI_SERVER_IS_REMOTE, |
|
86 |
CQI_DEFAULT_SERVER_IS_REMOTE); |
|
87 |
store.setDefault(TBXPreferences.CQI_SERVER_HOST, |
|
88 |
CQI_DEFAULT_SERVER_HOST); |
|
89 |
store.setDefault(TBXPreferences.CQI_SERVER_PORT, |
|
90 |
CQI_DEFAULT_SERVER_PORT); |
|
91 |
store.setDefault(TBXPreferences.CQI_SERVER_LOGIN, |
|
92 |
CQI_DEFAULT_SERVER_LOGIN); |
|
93 |
store.setDefault(TBXPreferences.CQI_SERVER_PASSWORD, |
|
94 |
CQI_DEFAULT_SERVER_PASSWORD); |
|
95 |
// store.setDefault(TBXPreferences.CQI_SERVER_PATH_TO_EXECUTABLE,CQI_DEFAULT_SERVER_PATH_TO_EXECUTABLE); |
|
96 |
// store.setDefault(TBXPreferences.CQI_SERVER_PATH_TO_REGISTRY, |
|
97 |
// CQI_DEFAULT_SERVER_PATH_TO_REGISTRY); |
|
98 |
// store.setDefault(TBXPreferences.CQI_SERVER_PATH_TO_INIT_FILE, |
|
99 |
// CQI_DEFAULT_SERVER_PATH_TO_INIT_FILE); |
|
100 |
store.setDefault(TBXPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, |
|
101 |
CQI_DEFAULT_SERVER_ADDITIONAL_OPTIONS); |
|
102 |
} |
|
103 |
|
|
104 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ReferencerPreferencePage.java (revision 325) | ||
---|---|---|
46 | 46 |
* preferences can be accessed directly via the preference store. |
47 | 47 |
*/ |
48 | 48 |
|
49 |
public class ReferencerPreferencePage extends FieldEditorPreferencePage |
|
50 |
implements IWorkbenchPreferencePage { |
|
49 |
public class ReferencerPreferencePage extends RCPPreferencesPage { |
|
51 | 50 |
|
52 |
/** The Constant ID. */ |
|
53 |
public static final String ID = "org.txm.rcp.preferences.ReferencerPreferencePage"; //$NON-NLS-1$ |
|
54 |
|
|
55 |
/** The Constant SORTBYFREQ. */ |
|
56 |
public static final String SORTBYFREQ = "referencer_sorttype"; //$NON-NLS-1$ |
|
57 |
|
|
58 |
/** The preferences. */ |
|
59 |
private ScopedPreferenceStore preferences; |
|
60 |
|
|
61 | 51 |
/** The referencer_sorttype. */ |
62 | 52 |
private BooleanFieldEditor referencer_sorttype; |
63 | 53 |
|
... | ... | |
65 | 55 |
* Instantiates a new referencer preference page. |
66 | 56 |
*/ |
67 | 57 |
public ReferencerPreferencePage() { |
68 |
super(GRID); |
|
69 |
preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE, |
|
70 |
Application.PLUGIN_ID); |
|
71 |
setPreferenceStore(preferences); |
|
72 |
//setDescription(Messages.DiagnosticPreferencePage_1); |
|
58 |
super(); |
|
73 | 59 |
setTitle(Messages.ReferencerPreferencePage_2); |
74 | 60 |
} |
75 | 61 |
|
... | ... | |
81 | 67 |
@Override |
Formats disponibles : Unified diff