package com.opcoach.training.e4.rental.ui.pref;

import java.util.Map;

import javax.inject.Inject;
import javax.inject.Named;

import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;

import com.opcoach.training.e4.rental.ui.Palette;
import com.opcoach.training.e4.rental.ui.RentalUIConstants;

/** This preference page manage the palette value */
public class RentalPalettePreferences extends FieldEditorPreferencePage implements RentalUIConstants

{
	@Inject @Named(RENTAL_UI_PREF_STORE)
	IPreferenceStore prefStore;
	
	
	public RentalPalettePreferences()
	{
		super(GRID);
		// Init of preference store delegated in init (pstore not initialized
		// else)
	}

	
	@Inject @Named(RentalUIConstants.PALETTE_MANAGER)
	private Map<String, Palette> palettes;


	@Override
	protected void createFieldEditors()
	{
		// Extract the double String array for name and color provider (value is
		// the key)
		//Map<String, Palette> palettes = RentalUIActivator.getPaletteManager();

		String[][] comboValues = new String[palettes.size()][2];
		int i = 0;
		for (Palette p : palettes.values())
		{
			comboValues[i][0] = p.getName(); // Displayed name
			comboValues[i][1] = p.getId(); // Returned value if selected
			i++;
		}

		addField(new ComboFieldEditor(PREF_PALETTE, "Palette couleur :", comboValues, getFieldEditorParent()));

	}

}

@@ -561,16 +561,18 @@
 ants%0A%0A%7B%0A
+%09%0A
 %09@Inject
@@ -583,295 +583,121 @@
 med(
-RENTAL_UI_PREF_STORE)%0A%09IPreferenceStore prefStore;%0A%09%0A%09%0A%09public RentalPalettePreferences()%0A%09%7B%0A%09%09super(GRID);%0A%09%09// Init of preference store delegated in init (pstore not initialized%0A%09%09// else)%0A%09%7D%0A%0A%09%0A%09@Inject @Named(RentalUIConstants.PALETTE_MANAGER)%0A%09private Map%3CString, Palette%3E palettes;
+PALETTE_MANAGER)%0A%09private Map%3CString, Palette%3E palettes;%0A%0A%09public RentalPalettePreferences()%0A%09%7B%0A%09%09super(GRID);%0A%09%7D
 %0A%0A%0A%09

Simplify the pref page ...