Révision 1014

tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java (revision 1014)
34 34
	public static final String CHART_CUMULATIVE = "cumulative_chart"; //$NON-NLS-1$
35 35
	
36 36
	
37
	/**
38
	 * 
39
	 */
40
	public ProgressionPreferences() {
41
		// TODO Auto-generated constructor stub
37
//	/**
38
//	 * 
39
//	 */
40
//	public ProgressionPreferences() {
41
//		super();
42
////		TXMPreferences.instances.put(this.getClass(), this);
43
//	}
44

  
45

  
46
	public static TXMPreferences getInstance()	{
47
		return TXMPreferences.instances.get(ProgressionPreferences.class);
42 48
	}
43

  
49
	
50
	
44 51
	@Override
45 52
	public void initializeDefaultPreferences() {
46
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
53
		Preferences preferences = DefaultScope.INSTANCE.getNode(this.preferencesNode);
47 54
		preferences.putBoolean(CHART_CUMULATIVE, true);
48 55
		preferences.putBoolean(REPEAT_SAME_VALUES, false);
49 56
		preferences.putDouble(BANDE_MULTIPLIER, 1.0d);
57

  
50 58
		
59
		System.err.println("**************** ProgressionPreferences.initializeDefaultPreferences(): bande multiplier = " + ProgressionPreferences.getInstance().getDouble(BANDE_MULTIPLIER));
60

  
61
		
51 62
		// shared charts rendering preferences
52 63
		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
53 64
	}
tmp/org.txm.referencer.core/src/org/txm/referencer/core/preferences/ReferencerPreferences.java (revision 1014)
16 16

  
17 17
	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(ReferencerPreferences.class).getSymbolicName();
18 18

  
19
	public static final String PREFERENCES_PREFIX = "referencer_"; //$NON-NLS-1$
20
	
21
	
22
	public static final String SORT_BY_FREQUENCIES = PREFERENCES_PREFIX + "sort_by_frequencies"; //$NON-NLS-1$
23
	public static final String QUERY = PREFERENCES_PREFIX + "query"; //$NON-NLS-1$
24
	public static final String UNIT_PROPERTY = PREFERENCES_PREFIX + "unit_property"; //$NON-NLS-1$
25
	public static final String PATTERN = PREFERENCES_PREFIX + "pattern"; //$NON-NLS-1$
19
	public static final String SORT_BY_FREQUENCIES = "sort_by_frequencies"; //$NON-NLS-1$
20
	public static final String PATTERN = "pattern"; //$NON-NLS-1$
26 21

  
27 22
	@Override
28 23
	public void initializeDefaultPreferences() {
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1014)
11 11
import java.util.Collections;
12 12
import java.util.HashMap;
13 13
import java.util.Iterator;
14
import java.util.Map;
14 15
import java.util.Set;
15 16

  
16 17
import org.eclipse.core.runtime.Platform;
......
20 21
import org.eclipse.core.runtime.preferences.IPreferencesService;
21 22
import org.eclipse.core.runtime.preferences.IScopeContext;
22 23
import org.eclipse.core.runtime.preferences.InstanceScope;
24
import org.osgi.framework.FrameworkUtil;
23 25
import org.osgi.service.prefs.BackingStoreException;
24
import org.osgi.service.prefs.Preferences;
25 26
import org.txm.core.results.TXMParameters;
26 27
import org.txm.core.results.TXMResult;
27 28
import org.txm.utils.logger.Log;
......
54 55
public abstract class TXMPreferences extends AbstractPreferenceInitializer {
55 56

  
56 57

  
58

  
57 59
	// FIXME: here we must use a ProjectScope when we'll use IProject for TXM corpora 
58 60
	public static IScopeContext scope = InstanceScope.INSTANCE;
59 61

  
......
160 162
	 */
161 163
	public static final String N_LINES_PER_PAGE = "n_lines_per_page"; //$NON-NLS-1$
162 164

  
165

  
166
	// FIXME: tests ********************************************************************************
167
	public double getDouble(String key)	{
168
		return getDouble(key, this.preferencesNode);
169
	}
170

  
171
	public boolean getBoolean(String key)	{
172
		return getBoolean(key, this.preferencesNode);
173
	}
174

  
175
	public int getInt(String key)	{
176
		return getInt(key, this.preferencesNode);
177
	}
178

  
179
	public long getLong(String key)	{
180
		return getLong(key, this.preferencesNode);
181
	}
163 182
	
183
	public String getString(String key)	{
184
		return getString(key, this.preferencesNode);
185
	}
164 186

  
165 187
	/**
188
	 * @return the preferencesNode
189
	 */
190
	public String getPreferencesNode() {
191
		return preferencesNode;
192
	}
193

  
194

  
195
	
196
	public TXMPreferences() {
197
		super();
198
		TXMPreferences.instances.put(this.getClass(), this);
199
		this.preferencesNode = FrameworkUtil.getBundle(this.getClass()).getSymbolicName();
200
		Log.info("TXMPreferences.TXMPreferences(): preferences node = " + this.preferencesNode);
201
	}
202

  
203
//	public TXMPreferences() {
204
//		this(null);
205
//	}
206
//
207
	
208
	protected String preferencesNode;
209
	public static Map<Class, TXMPreferences> instances = new HashMap<>();
210

  
211
	// FIXME: tests end ********************************************************************************
212
	
213
	
214
	/**
166 215
	 * Stores a pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
167 216
	 * 
168 217
	 * @param key
......
368 417

  
369 418

  
370 419

  
371

  
372 420
	/**
373 421
	 * Try to cast and create a typed object from the String value of the key.
374 422
	 * @param commandParameters
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 1014)
46 46
 */
47 47
public class ProgressionPreferencePage extends TXMPreferencePage {
48 48

  
49

  
50
	
51 49
	/**
52 50
	 * Creates the field editors. Field editors are abstractions of the common
53 51
	 * GUI blocks needed to manipulate various types of preferences. Each field
......
62 60
		
63 61
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_CUMULATIVE, ProgressionUIMessages.ProgressionPreferencePage_3, chartsTab));
64 62
		this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_SAME_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab));
65
				
63

  
66 64
		DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab);
67 65
		this.addField(bandemultiplierfield);
68 66
		// FIXME: valid range
......
77 75

  
78 76
	@Override
79 77
	public void init(IWorkbench workbench) {
80
		this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE));
78
		System.out.println("ProgressionPreferencePage.init()" + ProgressionPreferences.CHART_CUMULATIVE);
79
		
80
		//this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE));
81
		System.out.println("ProgressionPreferences.getInstance() " + ProgressionPreferences.PREFERENCES_NODE);
82

  
83
		this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.getInstance().getPreferencesNode()));
84
		
81 85
		//FIXME: description
82 86
		//setDescription("Progression");
83 87
		this.setTitle(ProgressionCoreMessages.RESULT_TYPE);

Formats disponibles : Unified diff