public static void readHistoryItems(String comboName, Combo combo) { String itemsStr = Activator.getDefault().getPreferenceStore().getString("history.items.list." + comboName); combo.removeAll(); if (itemsStr != null) { for (StringTokenizer st = new StringTokenizer(itemsStr, ","); st.hasMoreElements(); ) { combo.add(st.nextToken()); } } }
public static void saveHistoryItems(String comboName, Combo combo) { StringBuilder itemsStr = new StringBuilder(); String items[] = combo.getItems(); for (int i = 0, n = items.length; i < n; i++) { String itemStr = items[i]; itemsStr.append(itemStr); if (i < (n - 1)) { itemsStr.append(","); } } Activator.getDefault() .getPreferenceStore() .setValue("history.items.list." + comboName, itemsStr.toString()); }