Revision 169

tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/messages/ChartsEngineCoreMessages.java (revision 169)
1 1
package org.txm.chartsengine.core.messages;
2 2

  
3
import java.lang.reflect.Field;
4

  
5 3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
6 5

  
7 6

  
8 7

  
......
15 14

  
16 15
	public static String ChartsEngine_LABEL_VALUE_SEPARATORS;
17 16

  
18
	
19
	//TODO: DEPRECATED MESSAGES KEYS ?
20
	public static String ChartsEngine_CANT_CREATE_CA_FILE_CHART;
21
	public static String ChartsEngine_CANT_CREATE_CA_SINGULAR_VALUES_FILE_CHART;
22
	public static String ChartsEngine_CANT_CREATE_PARTITION_DIMENSIONS_FILE_CHART;
23
	public static String ChartsEngine_CANT_CREATE_SPECIFICITIES_FILE_CHART;
24 17

  
25

  
26
	public static String ChartsEngine_PARTITION_DIMENSIONS_SORTED_BY_SIZE;
27
	public static String ChartsEngine_PARTITION_DIMENSIONS_DIMENSIONS_OF_PARTITION;
28
	public static String ChartsEngine_PARTITION_DIMENSIONS_CATEGORY;
29
	public static String ChartsEngine_PARTITION_DIMENSIONS_X_AXIS_LABEL;
30
	public static String ChartsEngine_PARTITION_DIMENSIONS_Y_AXIS_LABEL;
31

  
32
	public static String ChartsEngine_CA_FACTORIAL_MAP_TITLE;
33
	public static String ChartsEngine_CA_FACTORIAL_MAP_LEGEND_COLUMNS_LABEL;
34
	public static String ChartsEngine_CA_FACTORIAL_MAP_LEGEND_ROWS_LABEL;
35
	public static String ChartsEngine_CA_FACTORIAL_MAP_AXIS_LABEL_PREFIX;
36
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_ROWS_LABEL;
37
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_COLS_LABEL;
38
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_COORDINATES;
39

  
40
	public static String ChartsEngine_CA_SINGULAR_VALUES_CANT_CREATE_CHART;
41
	public static String ChartsEngine_CA_SINGULAR_VALUES_TITLE;
42
	public static String ChartsEngine_CA_SINGULAR_VALUES_X_AXIS_LABEL;
43
	public static String ChartsEngine_CA_SINGULAR_VALUES_X_LABELS_PREFIX;
44
	public static String ChartsEngine_CA_SINGULAR_VALUES_Y_AXIS_LABEL;
45
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_Y_LABEL;
46
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_PERCENT;
47
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_SUM;
48

  
49
	public static String ChartsEngine_PROGRESSION_X_AXIS_LABEL;
50
	public static String ChartsEngine_PROGRESSION_Y_AXIS_CUMULATIVE_LABEL;
51
	public static String ChartsEngine_PROGRESSION_Y_AXIS_NOT_CUMULATIVE_LABEL;
52

  
53
	public static String ChartsEngine_SPECIFICITIES_X_AXIS_LABEL;
54
	public static String ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL;
55
	public static String ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL;
56

  
57 18
	static {
58 19
		// initialize resource bundle
59
		initializeMessages(BUNDLE_NAME, ChartsEngineCoreMessages.class);
20
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, ChartsEngineCoreMessages.class);
60 21
	}
61
	
62
	//TODO: factorize this methods in a Utilities plugin
63
	public static void initializeMessages(final String baseName, final Class<?> clazz) {
64
		// initialize resource bundle
65
		NLS.initializeMessages(baseName, clazz);
66 22

  
67
		// reencode the fields
68
		final Field[] fieldArray = clazz.getDeclaredFields();
69
		final int len = fieldArray.length;
70
		for(int i = 0; i < len; i++) {
71
			final Field field = (Field) fieldArray[i];
72
			if(field.getType() == java.lang.String.class) {
73
				if(!field.isAccessible())
74
					field.setAccessible(true);
75
				try {
76
					final String rawValue = (String) field.get(null);
77
					field.set(null, new String(rawValue.getBytes("ISO-8859-1"), "UTF-8"));
78
				}
79
				catch(Exception e) {
80
				//	e.printStackTrace();
81
				}
82
			}
83
		}
84
	}
85

  
86 23
	private ChartsEngineCoreMessages() {
87 24
	}
88 25
}

Also available in: Unified diff