Time for action: choosing from a list
Although free text may be appropriate for some types of preference, choosing from a set of values may be more appropriate for other types. A ComboFieldEditor
instance can be used to present the user with a selection of time zones, from which the user can set their favorite ZoneId
. The combo drop-down is built from an array of pairs of strings; the first string in each pair is the display label, while the second value in each pair is the string identifier that will be persisted in the preferences store.
- In the
ClockPreferencePage
methodcreateFieldEditors
, add the following code to populate aComboFieldEditor
with the list ofZoneId
elements:protected void createFieldEditors() {// ... String[][] data = ZoneId.getAvailableZoneIds() ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.