Slide 39
Slide 39 text
39
Extensions - M. Baron - Page
mickael-baron.fr mickaelbaron
Tutoriel extension Preference : définition et création
public class PreferenceFieldEditorPageTwo extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
private static final String FONT_PROPERTIES = "pageTwo.font";
private static final String RADIO_PROPERTIES = "pageTwo.radio";
private static final String PATH_PROPERTIES = "pageTwo.path";
private static final String SCALE_PROPERTIES = "pageTwo.scale";
public PreferenceFieldEditorPageTwo() { super("Page Deux", GRID); }
protected void createFieldEditors() {
FontFieldEditor ffe = new FontFieldEditor(FONT_PROPERTIES, "Police",
getFieldEditorParent());
addField(ffe);
final String[][] strings = new String[][] {{ "Première Valeur", "tag1"}, ...};
RadioGroupFieldEditor rfe = new RadioGroupFieldEditor(RADIO_PROPERTIES,
"RadioGroup", 2, strings, getFieldEditorParent(), true);
addField(rfe);
PathEditor pe = new PathEditor(PATH_PROPERTIES, "Path:", "Choisir des chemins",
getFieldEditorParent());
addField(pe);
ScaleFieldEditor sfe = new ScaleFieldEditor(SCALE_PROPERTIES, "Echelle",
getFieldEditorParent(), 0, 100, 1, 10);
addField(sfe);
}
public void init(IWorkbench workbench) { }
}
Implémenter le code spécifique à la page de préférence
Il s’agit du même
code que celui
présenté dans le
précédent chapitre
(Composants
Aditionnels avec
JFace)
Cette méthode est appelée à
l’instanciation de cette classe