Revision 2450

tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java (revision 2450)
76 76
	 * Sorts the engines according to the engines order preference.
77 77
	 */
78 78
	public void sortEngines() {
79
		String[] orderedEnginesNames = ((ChartsEnginePreferences) ChartsEnginePreferences.getInstance()).getEnginesOrder();
80 79
		
80
		// FIXME: SJ: need to manage ordering
81
		// String[] orderedEnginesNames = ((ChartsEnginePreferences) ChartsEnginePreferences.getInstance()).getEnginesOrder();
82
		
81 83
		// existing preference
82
		if (orderedEnginesNames != null) {
83
			ChartsEngine[] engines = new ChartsEngine[this.size()];
84
			ChartsEngine.chartsEngines.clear();
85
			
86
			for (ChartsEngine engine : this.values()) {
87
				// ChartsEngine.chartsEngines.add(engine);
88
				int index = ArrayUtils.indexOf(orderedEnginesNames, engine.getName());
89
				if (index >= 0) {
90
					engines[index] = engine;
91
				}
92
				else {
93
					Log.warning(NLS.bind("Chart engine {0} not found in engines ordered list: {1}.", engine.getName(), Arrays.toString(orderedEnginesNames)));
94
				}
95
			}
96
			for (int i = 0; i < engines.length; i++) {
97
				ChartsEngine.chartsEngines.add(engines[i]);
98
			}
99
		}
100
		// non existing preference
101
		else {
102
			ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, this.createEnginesOrder());
103
		}
84
		// if (orderedEnginesNames != null) {
85
		// ChartsEngine[] engines = new ChartsEngine[this.size()];
86
		// ChartsEngine.chartsEngines.clear();
87
		//
88
		// for (ChartsEngine engine : this.values()) {
89
		// // ChartsEngine.chartsEngines.add(engine);
90
		// int index = ArrayUtils.indexOf(orderedEnginesNames, engine.getName());
91
		// if (index >= 0) {
92
		// engines[index] = engine;
93
		// }
94
		// else {
95
		// Log.warning(NLS.bind("Chart engine {0} not found in engines ordered list: {1}.", engine.getName(), Arrays.toString(orderedEnginesNames)));
96
		// }
97
		// }
98
		// for (int i = 0; i < engines.length; i++) {
99
		// ChartsEngine.chartsEngines.add(engines[i]);
100
		// }
101
		// }
102
		// // non existing preference
103
		// else {
104
		ChartsEnginePreferences.getInstance().put(ChartsEnginePreferences.CHARTS_ENGINES_ORDER, this.createEnginesOrder());
105
		// }
104 106
	}
105 107
	
106 108
	

Also available in: Unified diff