Revision 325

tmp/org.txm.chartsengine.r.rcp/src/org/txm/rcp/chartsengine/r/preferences/RChartsEnginePreferencePage.java (revision 325)
41 41
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences;
42 42
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
43 43
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
44
import org.txm.rcp.TxmPreferences;
45 44
import org.txm.rcp.preferences.ExportPreferencePage;
46 45
import org.txm.rcp.preferences.TXMPreferencePage;
47 46
import org.txm.rcp.preferences.TXMPreferenceStore;
......
87 86
		this.setPreferenceStore(new TXMPreferenceStore(RChartsEnginePreferences.PREFERENCE_NODE));
88 87
	}
89 88

  
90

  
91
	@Override
92
	public boolean performOk() {
93
		try {
94
			super.performOk();
95

  
96
			
97
			// Change the R Charts engine output format
98
			ChartsEngine.getChartsEngine(RChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
99

  
100
			
101
			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
102
			if(ChartsEngine.getCurrent() instanceof RChartsEngine)	{
103
				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
104
				
105
				// Set the first charts engine supported export file format as default charts export file format
106
				TxmPreferences.set(ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
107
				
108
				// Refresh the User\Export preference page to update "Default charts export file format" combo box
109
				PlatformUI.getWorkbench().getPreferenceManager().
110
					find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
111

  
112
			}
113
			
114
			
115
		} catch (Exception e) {
116
			System.err.println(org.txm.rcp.Messages.FAILED_TO_SAVE_PREFERENCES + e);
117
		}
118
		return true;
119
	}
89
//	@Override
90
//	public boolean performOk() {
91
//		try {
92
//			super.performOk();
93
//
94
//			
95
//			// Change the R Charts engine output format
96
//			ChartsEngine.getChartsEngine(RChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
97
//
98
//			
99
//			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
100
//			if(ChartsEngine.getCurrent() instanceof RChartsEngine)	{
101
//				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
102
//				
103
//				// Set the first charts engine supported export file format as default charts export file format
104
//				TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
105
//				
106
//				// Refresh the User\Export preference page to update "Default charts export file format" combo box
107
//				PlatformUI.getWorkbench().getPreferenceManager().
108
//					find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
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
//	}
120 118
}
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 325)
87 87
import org.txm.cooccurrence.rcp.messages.CooccurrenceUIMessages;
88 88
import org.txm.core.messages.TXMCoreMessages;
89 89
import org.txm.core.preferences.TXMPreferences;
90
import org.txm.rcp.editors.TXMEditorPart;
91 90
import org.txm.rcp.JobsTimer;
92 91
import org.txm.rcp.Messages;
93 92
import org.txm.rcp.StatusLine;
94 93
import org.txm.rcp.TxmPreferences;
95 94
import org.txm.rcp.commands.editor.CustomizableEditor;
96 95
import org.txm.rcp.commands.link.CooccurrencesToConcordances;
96
import org.txm.rcp.editors.TXMEditorPart;
97 97
import org.txm.rcp.editors.TableKeyListener;
98
import org.txm.rcp.preferences.UserPreferencePage;
98
import org.txm.rcp.preferences.RCPPreferences;
99 99
import org.txm.rcp.swt.widget.AssistedQueryWidget;
100 100
import org.txm.rcp.swt.widget.EmpantWidget;
101 101
import org.txm.rcp.swt.widget.PropertiesSelector;
......
445 445
		propsArea.addValueChangeListener(new Listener() {
446 446
			@Override
447 447
			public void handleEvent(Event event) {
448
				if (TxmPreferences.getBoolean(UserPreferencePage.AUTO_UPDATE_EDITOR))
448
				if (TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.AUTO_UPDATE_EDITOR))
449 449
					compute();
450 450
			}
451 451
		});
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.synopticeditor.rcp/src/org/txm/rcp/synoptic/preferences/EditionPreferencePage.java (revision 325)
13 13

  
14 14
	private BooleanFieldEditor slow_highlight;
15 15
	
16
	public static String SLOW_HIGHLIGHT = "org.txm.rcp.synoptic.slow_highlight";
17 16
	
18 17
	public EditionPreferencePage() {
19 18
		super();
......
28 27

  
29 28
	@Override
30 29
	protected void createFieldEditors() {
31
		slow_highlight = new BooleanFieldEditor(SLOW_HIGHLIGHT,
30
		slow_highlight = new BooleanFieldEditor(EditionPreferences.SLOW_HIGHLIGHT,
32 31
				"Enable slow but robust word highlight", getFieldEditorParent());
33 32
		addField(slow_highlight);
34 33
	}
tmp/org.txm.synopticeditor.rcp/src/org/txm/rcp/synoptic/preferences/EditionPreferences.java (revision 325)
1
package org.txm.rcp.synoptic.preferences;
2

  
3
import org.eclipse.core.runtime.preferences.DefaultScope;
4
import org.osgi.service.prefs.Preferences;
5
import org.txm.core.preferences.TXMPreferences;
6

  
7
public class EditionPreferences extends TXMPreferences {
8

  
9
	public static String PREFERENCES_NODE = "org.txm.rcp.synoptic";
10
	
11
	public static String SLOW_HIGHLIGHT = "org.txm.rcp.synoptic.slow_highlight";
12

  
13
	@Override
14
	public void initializeDefaultPreferences() {
15
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
16
		preferences.putBoolean(SLOW_HIGHLIGHT, false);
17
	}
18
}
0 19

  
tmp/org.txm.synopticeditor.rcp/src/org/txm/rcp/synoptic/editor/EditionPanel.java (revision 325)
24 24
import org.eclipse.swt.widgets.Menu;
25 25
import org.eclipse.swt.widgets.MenuItem;
26 26
import org.eclipse.ui.internal.browser.BrowserViewer;
27
import org.txm.core.preferences.TXMPreferences;
27 28
import org.txm.objects.Corpus;
28 29
import org.txm.objects.Edition;
29 30
import org.txm.objects.Page;
30 31
import org.txm.objects.Text;
31 32
import org.txm.rcp.synoptic.preferences.EditionPreferencePage;
33
import org.txm.rcp.synoptic.preferences.EditionPreferences;
32 34
import org.txm.rcp.StatusLine;
33 35
import org.txm.rcp.TxmPreferences;
34 36
import org.txm.rcp.utils.IOClipboard;
......
151 153
					//+"\nalert(\"create sheet:\"+sheet);"
152 154
					+"\n";
153 155

  
154
	protected boolean slowWordHighLight = TxmPreferences.getBoolean(EditionPreferencePage.SLOW_HIGHLIGHT, false);
156
	protected boolean slowWordHighLight = TXMPreferences.getBoolean(EditionPreferences.PREFERENCES_NODE, EditionPreferences.SLOW_HIGHLIGHT);
155 157
	
156 158
	protected boolean firstLoad = true;
157 159
	public EditionPanel(SynopticEditionEditor synopticEditionEditor, Composite parent, int style, Edition edition) {
......
162 164

  
163 165
		progresslistener = new ProgressListener() {
164 166
			
165
			@Override
166 167
			public void changed(ProgressEvent event) { }
167 168

  
168 169
			@Override
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.rcp/plugin.xml (revision 325)
340 340
   <extension
341 341
         point="org.eclipse.core.runtime.preferences">
342 342
      <initializer
343
            class="org.txm.rcp.preferences.CQPPreferenceInitializer">
343
            class="org.txm.rcp.preferences.RCPPreferences">
344 344
      </initializer>
345
      <initializer
346
            class="org.txm.rcp.preferences.ConcordancerPreferenceInitializer">
347
      </initializer>
348
      <initializer
349
            class="org.txm.rcp.preferences.ScriptPreferenceInitializer">
350
      </initializer>
351 345
   </extension>
352 346
  <extension
353 347
         point="org.eclipse.ui.preferencePages">
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/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/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/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/NLPPreferencePage.java (revision 325)
27 27
//
28 28
package org.txm.rcp.preferences;
29 29

  
30
import org.eclipse.core.runtime.preferences.ConfigurationScope;
31
import org.eclipse.jface.preference.FieldEditorPreferencePage;
32
import org.eclipse.ui.IWorkbench;
33
import org.eclipse.ui.IWorkbenchPreferencePage;
34
import org.eclipse.ui.preferences.ScopedPreferenceStore;
35
import org.txm.rcp.Application;
36
import org.txm.rcp.Messages;
37 30
// TODO: Auto-generated Javadoc
38 31
/**
39 32
 * The Class NLPPreferencePage.
40 33
 */
41
public class NLPPreferencePage extends FieldEditorPreferencePage implements
42
		IWorkbenchPreferencePage {
34
public class NLPPreferencePage extends RCPPreferencesPage {
43 35

  
44
	/** The preferences. */
45
	private ScopedPreferenceStore preferences;
46

  
47 36
	/**
48 37
	 * Instantiates a new nLP preference page.
49 38
	 */
50 39
	public NLPPreferencePage() {
51
		super(GRID);
52
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
53
				Application.PLUGIN_ID);
54
		setPreferenceStore(preferences);
40
		super();
55 41
		//setDescription("..."); //$NON-NLS-1$
56 42
	}
57 43

  
58 44
	/* (non-Javadoc)
59
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
60
	 */
61
	@Override
62
	public void init(IWorkbench workbench) {
63
		// TODO Auto-generated method stub
64
	}
65

  
66
	/* (non-Javadoc)
67
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
68
	 */
69
	@Override
70
	public boolean isValid() {
71
		return true;
72
	}
73

  
74
	/* (non-Javadoc)
75
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
76
	 */
77
	@Override
78
	public boolean performOk() {
79
		try {
80
			super.performOk();
81
			preferences.save();
82
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
83
		} catch (Exception e) {
84
			System.err.println(Messages.FAILED_TO_SAVE_PREFERENCES + e);
85
		}
86
		return true;
87
	}
88

  
89
	/* (non-Javadoc)
90 45
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
91 46
	 */
92 47
	@Override
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/TreeTaggerPreferencePage.java (revision 325)
27 27
//
28 28
package org.txm.rcp.preferences;
29 29

  
30
import org.eclipse.core.runtime.preferences.ConfigurationScope;
31 30
import org.eclipse.jface.preference.BooleanFieldEditor;
32 31
import org.eclipse.jface.preference.DirectoryFieldEditor;
33
import org.eclipse.jface.preference.FieldEditorPreferencePage;
34 32
import org.eclipse.jface.preference.StringFieldEditor;
35
import org.eclipse.ui.IWorkbench;
36
import org.eclipse.ui.IWorkbenchPreferencePage;
37
import org.eclipse.ui.preferences.ScopedPreferenceStore;
38
import org.txm.Toolbox;
39 33
import org.txm.core.preferences.TBXPreferences;
40
import org.txm.rcp.Application;
41 34
import org.txm.rcp.Messages;
42 35
// TODO: Auto-generated Javadoc
43 36
/**
......
51 44
 * preferences can be accessed directly via the preference store.
52 45
 */
53 46

  
54
public class TreeTaggerPreferencePage extends FieldEditorPreferencePage
55
		implements IWorkbenchPreferencePage {
47
public class TreeTaggerPreferencePage extends RCPPreferencesPage {
56 48

  
57
	/** The Constant TREETAGGER_INSTALL_PATH. */
58
	public static final String TREETAGGER_INSTALL_PATH = TBXPreferences.TREETAGGER_INSTALL_PATH;
59
	
60
	/** The Constant TREETAGGER_MODELS_PATH. */
61
	public static final String TREETAGGER_MODELS_PATH = TBXPreferences.TREETAGGER_MODELS_PATH;
62

  
63
	public static final String TREETAGGER_OPTIONS = TBXPreferences.TREETAGGER_OPTIONS;
64
	
65
	public static final String TREETAGGER_APOSTROPHE = TBXPreferences.TREETAGGER_APOSTROPHE;
66
	
67
	/** The preferences. */
68
	private ScopedPreferenceStore preferences;
69

  
70 49
	/** The treetagger_install_path. */
71 50
	private DirectoryFieldEditor treetagger_install_path;
72 51
	
......
85 64
	 * Instantiates a new tree tagger preference page.
86 65
	 */
87 66
	public TreeTaggerPreferencePage() {
88
		super(GRID);
89
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
90
				Application.PLUGIN_ID);
91
		setPreferenceStore(preferences);
92
		//setDescription(Messages.TreeTaggerPreferencePage_0);
67
		super();
93 68
	}
94 69

  
95 70
	/**
......
100 75
	@Override
101 76
	public void createFieldEditors() {
102 77
		treetagger_install_path = new DirectoryFieldEditor(
103
				TREETAGGER_INSTALL_PATH, Messages.TreeTaggerPreferencePage_1,
78
				TBXPreferences.TREETAGGER_INSTALL_PATH, Messages.TreeTaggerPreferencePage_1,
104 79
				getFieldEditorParent());
105 80
		addField(treetagger_install_path);
106 81

  
107 82
		treetagger_models_path = new DirectoryFieldEditor(
108
				TREETAGGER_MODELS_PATH, Messages.TreeTaggerPreferencePage_2,
83
				TBXPreferences.TREETAGGER_MODELS_PATH, Messages.TreeTaggerPreferencePage_2,
109 84
				getFieldEditorParent());
110 85
		addField(treetagger_models_path);
111 86
		
112
//		treetagger_opendir = new OpenPathFromPreferenceFieldEditor("treetagger_open_button", "Open TreeTagger directory", getFieldEditorParent(), TREETAGGER_INSTALL_PATH);
113
//		addField(treetagger_opendir);
114
//		
115
//		treetagger_opendir = new OpenPathFromPreferenceFieldEditor("treetagger_open_button2", "Open models directory", getFieldEditorParent(), TREETAGGER_MODELS_PATH);
116
//		addField(treetagger_opendir);
117
		
118 87
		treetagger_options = new StringFieldEditor(
119
				TREETAGGER_OPTIONS, Messages.TreeTaggerPreferencePage_3,
88
				TBXPreferences.TREETAGGER_OPTIONS, Messages.TreeTaggerPreferencePage_3,
120 89
				getFieldEditorParent());
121 90
		addField(treetagger_options);
122 91
		
123 92
		
124 93
		
125 94
		treetagger_apostrophe = new BooleanFieldEditor(
126
				TREETAGGER_APOSTROPHE, Messages.TreeTaggerPreferencePage_0,
95
				TBXPreferences.TREETAGGER_APOSTROPHE, Messages.TreeTaggerPreferencePage_0,
127 96
				getFieldEditorParent());
128 97
		addField(treetagger_apostrophe);
129 98
	}
130

  
131
	/*
132
	 * (non-Javadoc)
133
	 * 
134
	 * @see
135
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
136
	 */
137
	@Override
138
	public void init(IWorkbench workbench) {
139
	}
140

  
141
	/* (non-Javadoc)
142
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
143
	 */
144
	@Override
145
	public boolean isValid() {
146
		return true; // Otherwise the bahaviour is so strange ....
147
	}
148

  
149
	/* (non-Javadoc)
150
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
151
	 */
152
	@Override
153
	public boolean performOk() {
154
		try {
155
			super.performOk();
156
			preferences.save();
157
			//System.out.println("PROPS : "+(org.txm.rcp.ApplicationWorkbenchAdvisor.getProperties()));
158
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
159
		} catch (Exception e) {
160
			System.err.println(Messages.FAILED_TO_SAVE_PREFERENCES + e);
161
		}
162
		return true;
163
	}
164 99
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/LocalePreferencePage.java (revision 325)
29 29

  
30 30
import java.io.IOException;
31 31

  
32
import org.eclipse.core.runtime.preferences.ConfigurationScope;
33
import org.eclipse.jface.preference.FieldEditorPreferencePage;
34 32
import org.eclipse.jface.preference.RadioGroupFieldEditor;
35 33
import org.eclipse.osgi.util.NLS;
36 34
import org.eclipse.ui.IWorkbench;
37
import org.eclipse.ui.IWorkbenchPreferencePage;
38 35
import org.eclipse.ui.preferences.ScopedPreferenceStore;
39 36
import org.txm.rcp.Application;
40 37
import org.txm.rcp.Messages;
......
42 39
/**
43 40
 * The Class LocalePreferencePage.
44 41
 */
45
public class LocalePreferencePage extends FieldEditorPreferencePage implements
46
		IWorkbenchPreferencePage {
42
public class LocalePreferencePage extends RCPPreferencesPage {
47 43

  
48
	/** The Constant UI_LOCALE. */
49
	public static final String UI_LOCALE = "ui_locale"; //$NON-NLS-1$
50

  
51 44
	/** The Constant ID. */
52 45
	public static final String ID = "org.txm.rcp.preferences.LocalePreferencePage"; //$NON-NLS-1$
53 46

  
......
61 54
	 * Instantiates a new locale preference page.
62 55
	 */
63 56
	public LocalePreferencePage() {
64
		super(GRID);
65
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
66
				Application.PLUGIN_ID);
67
		setPreferenceStore(preferences);
68
		//setDescription(Messages.LocalePreferencePage_1);
57
		super();
69 58
		setTitle(Messages.LocalePreferencePage_1);
70 59
	}
71 60

  
......
75 64
	@Override
76 65
	protected void createFieldEditors() {
77 66
		String[][] values = { { "français", "fr" }, { "english", "en" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
78
		locale = new RadioGroupFieldEditor(UI_LOCALE,
67
		locale = new RadioGroupFieldEditor(RCPPreferences.UI_LOCALE,
79 68
				Messages.LocalePreferencePage_2, 1, values,
80 69
				getFieldEditorParent());
81 70
		addField(locale);
82 71
	}
83

  
84
	/* (non-Javadoc)
85
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
86
	 */
87
	@Override
88
	public void init(IWorkbench workbench) {
89
	}
90

  
91
	/* (non-Javadoc)
92
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
93
	 */
94
	@Override
95
	public boolean isValid() {
96
		return true;
97
	}
98

  
99
	/* (non-Javadoc)
100
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
101
	 */
102
	@Override
103
	public boolean performOk() {
104
		try {
105
			super.performOk();
106
			preferences.save();
107
			// System.out.println("Locale ok");
108
			// System.out.println(org.txm.rcp.ApplicationWorkbenchAdvisor.getProperties());
109
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
110
		} catch (IOException e) {
111
			System.err.println(NLS.bind(
112
					Messages.FAILED_TO_SAVE_PREFERENCES, e));
113
		}
114
		return true;
115
	}
116 72
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ConcordancerPreferencePage.java (revision 325)
27 27
//
28 28
package org.txm.rcp.preferences;
29 29

  
30
import org.eclipse.core.runtime.preferences.ConfigurationScope;
31
import org.eclipse.jface.preference.FieldEditorPreferencePage;
32 30
import org.eclipse.jface.preference.IntegerFieldEditor;
33
import org.eclipse.ui.IWorkbench;
34
import org.eclipse.ui.IWorkbenchPreferencePage;
35
import org.eclipse.ui.preferences.ScopedPreferenceStore;
36
import org.txm.rcp.Application;
37 31
import org.txm.rcp.Messages;
38 32
// TODO: Auto-generated Javadoc
39 33
/**
40 34
 * The Class ConcordancerPreferencePage.
41 35
 */
42
public class ConcordancerPreferencePage extends FieldEditorPreferencePage
43
		implements IWorkbenchPreferencePage {
36
public class ConcordancerPreferencePage extends RCPPreferencesPage {
44 37
	
45
	/** The Constant N_LINE_PER_PAGE. */
46
	public static final String N_LINE_PER_PAGE = "conc_n_lines_per_page"; //$NON-NLS-1$
47
	
48
	/** The Constant LEFT_CONTEXT_SIZE. */
49
	public static final String LEFT_CONTEXT_SIZE = "conc_left_context_size"; //$NON-NLS-1$
50
	
51
	/** The Constant RIGHT_CONTEXT_SIZE. */
52
	public static final String RIGHT_CONTEXT_SIZE = "conc_right_context_size"; //$NON-NLS-1$
53
	
54
	/** The Constant ID. */
55
	public static final String ID = "org.txm.rcp.preferences.ConcordancerPreferencePage"; //$NON-NLS-1$
56

  
57
	/** The preferences. */
58
	private ScopedPreferenceStore preferences;
59

  
60 38
	/** The n_line_per_page. */
61 39
	private IntegerFieldEditor n_line_per_page;
62 40
	
......
70 48
	 * Instantiates a new concordancer preference page.
71 49
	 */
72 50
	public ConcordancerPreferencePage() {
73
		super(GRID);
74
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
75
				Application.PLUGIN_ID);
76
		setPreferenceStore(preferences);
77
		//setDescription(Messages.ConcordancerPreferencePage_3);
51
		super();
78 52
		setTitle(Messages.ConcordancerPreferencePage_3);
79 53
	}
80 54

  
......
83 57
	 */
84 58
	@Override
85 59
	protected void createFieldEditors() {
86
		n_line_per_page = new IntegerFieldEditor(N_LINE_PER_PAGE,
60
		n_line_per_page = new IntegerFieldEditor(RCPPreferences.N_LINE_PER_PAGE,
87 61
				Messages.ConcordancerPreferencePage_4, getFieldEditorParent());
88 62
		addField(n_line_per_page);
89
		leftContextSize = new IntegerFieldEditor(LEFT_CONTEXT_SIZE,
63
		leftContextSize = new IntegerFieldEditor(RCPPreferences.LEFT_CONTEXT_SIZE,
90 64
				Messages.ConcordancerPreferencePage_5, getFieldEditorParent());
91 65
		addField(leftContextSize);
92
		rightContextSize = new IntegerFieldEditor(RIGHT_CONTEXT_SIZE,
66
		rightContextSize = new IntegerFieldEditor(RCPPreferences.RIGHT_CONTEXT_SIZE,
93 67
				Messages.ConcordancerPreferencePage_6, getFieldEditorParent());
94 68
		addField(rightContextSize);
95 69
	}
96

  
97
	/* (non-Javadoc)
98
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
99
	 */
100
	@Override
101
	public void init(IWorkbench workbench) {
102
	}
103

  
104
	/* (non-Javadoc)
105
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
106
	 */
107
	@Override
108
	public boolean isValid() {
109
		return true;
110
		// return n_line_per_page.getIntValue()>0;
111
	}
112

  
113
	/* (non-Javadoc)
114
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
115
	 */
116
	@Override
117
	public boolean performOk() {
118
		try {
119
			super.performOk();
120
			preferences.save();
121
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
122
		} catch (Exception e) {
123
			System.err.println(Messages.FAILED_TO_SAVE_PREFERENCES + e);
124
		}
125
		return true;
126
	}
127

  
128 70
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/FileExplorerPreferencePage.java (revision 325)
29 29

  
30 30
import java.io.IOException;
31 31

  
32
import org.eclipse.core.runtime.preferences.ConfigurationScope;
33 32
import org.eclipse.jface.preference.BooleanFieldEditor;
34 33
import org.eclipse.jface.preference.FieldEditorPreferencePage;
35 34
import org.eclipse.jface.preference.StringFieldEditor;
......
37 36
import org.eclipse.ui.IWorkbench;
38 37
import org.eclipse.ui.IWorkbenchPreferencePage;
39 38
import org.eclipse.ui.preferences.ScopedPreferenceStore;
39
import org.txm.core.preferences.TXMPreferences;
40 40
import org.txm.rcp.Application;
41 41
import org.txm.rcp.Messages;
42
import org.txm.rcp.TxmPreferences;
43 42
import org.txm.rcp.views.fileexplorer.Explorer;
44 43
// TODO: Auto-generated Javadoc
45 44
/**
46 45
 * The Class ExportPreferencePage.
47 46
 */
48
public class FileExplorerPreferencePage extends FieldEditorPreferencePage implements
49
		IWorkbenchPreferencePage {
47
public class FileExplorerPreferencePage extends RCPPreferencesPage {
50 48

  
51
	/** The Constant FILES_TO_HIDE. */
52
	public static final String FILES_TO_HIDE = "files_to_hide"; //$NON-NLS-1$
53
	
54
	/** The Constant ID. */
55
	public static final String ID = "org.txm.rcp.preferences.FileExplorerPreferencePage"; //$NON-NLS-1$
56 49

  
57
	public static final String SHOW_HIDDEN_FILES = "show_hidden_files"; //$NON-NLS-1$
58
	
59
	public static final String SHOW_FOLDERS = "show_folders"; //$NON-NLS-1$
60
	
61 50
	/** The show_export. */
62 51
	private StringFieldEditor files_to_hide;
63 52
	private BooleanFieldEditor show_hidden_files;
64 53
	//private BooleanFieldEditor show_folders;
65
	
54

  
66 55
	/** The preferences. */
67 56
	private ScopedPreferenceStore preferences;
68 57

  
......
70 59
	 * Instantiates a new export preference page.
71 60
	 */
72 61
	public FileExplorerPreferencePage() {
73
		super(GRID);
74
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE,
75
				Application.PLUGIN_ID);
76
		setPreferenceStore(preferences);
77
		//setDescription(Messages.ExportPreferencePage_1);
62
		super();
78 63
		setTitle(Messages.ExportPreferencePage_1);
79 64
	}
80 65

  
......
83 68
	 */
84 69
	@Override
85 70
	protected void createFieldEditors() {
86
		
87
		files_to_hide = new StringFieldEditor(FILES_TO_HIDE,
71

  
72
		files_to_hide = new StringFieldEditor(RCPPreferences.FILES_TO_HIDE,
88 73
				Messages.FileExplorerPreferencePage_0, getFieldEditorParent());
89 74
		addField(files_to_hide);
90
		
91
		show_hidden_files = new BooleanFieldEditor(SHOW_HIDDEN_FILES,
75

  
76
		show_hidden_files = new BooleanFieldEditor(RCPPreferences.SHOW_HIDDEN_FILES,
92 77
				Messages.FileExplorerPreferencePage_1, getFieldEditorParent());
93 78
		addField(show_hidden_files);
94
		
79

  
95 80
		//show_folders = new BooleanFieldEditor(SHOW_FOLDERS, Messages.FileExplorerPreferencePage_2, getFieldEditorParent());
96 81
		//addField(show_folders);
97
		TxmPreferences.set(SHOW_FOLDERS, true);
82
		TXMPreferences.putBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.SHOW_FOLDERS, true);
98 83
	}
99 84

  
100 85
	/* (non-Javadoc)
101
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
102
	 */
103
	@Override
104
	public void init(IWorkbench workbench) {
105
	}
106

  
107
	/* (non-Javadoc)
108
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
109
	 */
110
	@Override
111
	public boolean isValid() {
112
		return true;
113
	}
114

  
115
	/* (non-Javadoc)
116 86
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
117 87
	 */
118 88
	@Override
119 89
	public boolean performOk() {
120
		try {
121
			super.performOk();
122
			preferences.save();
123
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
124
			Explorer.refresh();
125
		} catch (IOException e) {
126
			System.err.println(NLS.bind(
127
					Messages.FAILED_TO_SAVE_PREFERENCES, e));
128
		}
90
		super.performOk();
91
		Explorer.refresh();
129 92
		return true;
130 93
	}
131 94
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/AdvancePreferencePage.java (revision 325)
30 30
import org.eclipse.jface.preference.BooleanFieldEditor;
31 31
import org.eclipse.jface.preference.ComboFieldEditor;
32 32
import org.eclipse.jface.preference.DirectoryFieldEditor;
33
import org.eclipse.jface.preference.FieldEditorPreferencePage;
34 33
import org.eclipse.swt.SWT;
35 34
import org.eclipse.swt.layout.GridData;
36 35
import org.eclipse.swt.layout.RowLayout;
37 36
import org.eclipse.swt.widgets.Group;
38 37
import org.eclipse.ui.IWorkbench;
39
import org.eclipse.ui.IWorkbenchPreferencePage;
40 38
import org.eclipse.ui.PlatformUI;
41 39
import org.eclipse.ui.handlers.IHandlerService;
42 40
import org.eclipse.ui.preferences.ScopedPreferenceStore;
43
import org.txm.Toolbox;
44 41
import org.txm.core.preferences.TBXPreferences;
45
import org.txm.core.preferences.TXMPreferences;
46
import org.txm.rcp.Application;
47 42
import org.txm.rcp.Messages;
48 43
import org.txm.rcp.views.fileexplorer.MacroExplorer;
49 44

  
......
51 46
/**
52 47
 * The Class AdvancePreferencePage.
53 48
 */
54
public class AdvancePreferencePage extends FieldEditorPreferencePage implements
55
		IWorkbenchPreferencePage {
49
public class AdvancePreferencePage extends TXMPreferencePage {
56 50
	
57
	/**
58
	 * The constant ID. 
59
	 */
60
	public static final String ID = "org.txm.rcp.preferences.AdvancePreferencePage"; //$NON-NLS-1$
61

  
62
	/** The Constant INSTALL_DIR. */
63
	
64
	/** The Constant TXMHOME. */
65
	
66
	/** The Constant LOG_LEVEL. */
67
	
68
	/** The Constant ADD_TECH_LOGS. */
69
	
70
	/** The Constant SHOW_SEVERE_DIALOG. */
71
	public static final String SHOW_SEVERE_DIALOG = "show_severe_dialog"; 
72

  
73
	/** The Constant LOG_CONSOLE. */
74
	/** The Constant LOG_FILE. */
75

  
76
	/** The Constant EXPERT_USER. */
77
	/** The Constant UPDATE_LEVEL. */
78
	public static final String UPDATE_LEVEL = "update_level"; //$NON-NLS-1$
79
	
80
	/** The Constant LOG_STACKTRACE */
81
	
82
	/** The preferences. */
83
	private ScopedPreferenceStore preferences;
84

  
85 51
	/** The install dir. */
86 52
	private DirectoryFieldEditor installDirField;
87 53
	
......
115 81
	 * Instantiates a new advance preference page.
116 82
	 */
117 83
	public AdvancePreferencePage() {
118
		super(GRID);
119
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE, Application.PLUGIN_ID);
120
		//System.out.println("prefs store: "+preferences);
121
		
122
		setPreferenceStore(preferences);
123
		//setDescription(Messages.AdvancePreferencePage_0);
84
		super();
124 85
	}
125 86

  
126 87
	/* (non-Javadoc)
......
173 134
				Messages.AdvancePreferencePage_13, updateGroup);
174 135
		addField(logConsoleField);
175 136
		
176
		severeDialogField = new BooleanFieldEditor(SHOW_SEVERE_DIALOG,
137
		severeDialogField = new BooleanFieldEditor(RCPPreferences.SHOW_SEVERE_DIALOG,
177 138
				"Show a dialog when a severe error occurs", updateGroup);
178 139
		addField(severeDialogField);
179 140

  
......
186 147
		choices2[1][0] = choices2[1][1] = "BETA"; //$NON-NLS-1$
187 148
		choices2[2][0] = choices2[2][1] = "ALPHA"; //$NON-NLS-1$
188 149
		choices2[3][0] = choices2[3][1] = "DEV"; //$NON-NLS-1$
189
		updateLevelField = new ComboFieldEditor(UPDATE_LEVEL,
150
		updateLevelField = new ComboFieldEditor(RCPPreferences.UPDATE_LEVEL,
190 151
				Messages.AdvancePreferencePage_7,choices2, getFieldEditorParent());
191 152
		addField(updateLevelField);
192 153
		
......
196 157
	}
197 158

  
198 159
	/* (non-Javadoc)
199
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
200
	 */
201
	@Override
202
	public void init(IWorkbench workbench) {
203
		
204
	}
205

  
206
	/* (non-Javadoc)
207
	 * @see org.eclipse.jface.preference.PreferencePage#isValid()
208
	 */
209
	@Override
210
	public boolean isValid() {
211
		return true;
212
	}
213

  
214
	/* (non-Javadoc)
215 160
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
216 161
	 */
217 162
	@Override
218 163
	public boolean performOk() {
219 164
		try {
220
			String oldHome = preferences.getString(TBXPreferences.USER_TXM_HOME);
221
			super.performOk();
222
			preferences.save();
223
			String newHome = preferences.getString(TBXPreferences.USER_TXM_HOME);
165
			MacroExplorer.refresh();
224 166
			
225
//			org.txm.Toolbox
226
//					.updateProperties(org.txm.rcp.ApplicationWorkbenchAdvisor
227
//							.getProperties());
228
			Toolbox.preferencesUpdated();
229
			
230
			// the macro directory changed
231
			// System.out.println("old="+oldHome+" new="+newHome);
232
			if (oldHome != null && !oldHome.equals(newHome)) {
233
				MacroExplorer.refresh();
234
			}
235
			
236 167
			// update repositories
237 168
			IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
238 169
			service.executeCommand("org.txm.rcp.p2.plugins.FixUpdateHandler", null); //$NON-NLS-1$
......
247 178
		}
248 179
		return true;
249 180
	}
181

  
182
	@Override
183
	public void init(IWorkbench workbench) {
184
		this.setPreferenceStore(new TXMPreferenceStore(TBXPreferences.PREFERENCES_NODE));
185
	}
250 186
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ScriptPreferencePage.java (revision 325)
27 27
//
28 28
package org.txm.rcp.preferences;
29 29

  
30
import org.eclipse.core.runtime.preferences.ConfigurationScope;
31 30
import org.eclipse.jface.preference.BooleanFieldEditor;
32
import org.eclipse.jface.preference.DirectoryFieldEditor;
33
import org.eclipse.jface.preference.FieldEditorPreferencePage;
34 31
import org.eclipse.jface.preference.IntegerFieldEditor;
35
import org.eclipse.ui.IWorkbench;
36
import org.eclipse.ui.IWorkbenchPreferencePage;
37
import org.eclipse.ui.preferences.ScopedPreferenceStore;
38
import org.txm.rcp.Application;
39 32
import org.txm.rcp.Messages;
40
import org.txm.rcp.TxmPreferences;
41 33
// TODO: Auto-generated Javadoc
42 34
/**
43 35
 * The Class ScriptPreferencePage.
44 36
 */
45
public class ScriptPreferencePage extends FieldEditorPreferencePage implements
46
		IWorkbenchPreferencePage {
37
public class ScriptPreferencePage extends RCPPreferencesPage {
47 38

  
48
	/** The Constant SCRIPT_ROOT_DIR. */
49
	public static final String SCRIPT_ROOT_DIR = "script_root_dir"; //$NON-NLS-1$
50
	
51
	/** The Constant SCRIPT_CURRENT_DIR. */
52
	public static final String SCRIPT_CURRENT_DIR = "script_current_dir"; //$NON-NLS-1$
53
	
54
	/** The Constant NO_SESSION. */
55
	public static final String NO_SESSION = "script_nosession"; //$NON-NLS-1$
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff