/** Save an object to global plugin's preference store. */ public static void toPreferenceStore(String globalPreferenceKey, Object object) { final IPreferenceStore prefStore = WorkbenchCorePlugin.getDefault().getPreferenceStore(); try { prefStore.setValue(globalPreferenceKey, toString(object)); } catch (IOException e) { Utils.logError(e, false); } }
/** * Read an object from the global plugin's preference store. May return <code>null</code> if an * error occurred. */ public static <T> T fromPreferenceStore(Class<T> clazz, String globalPreferenceKey) { final IPreferenceStore prefStore = WorkbenchCorePlugin.getDefault().getPreferenceStore(); final String xml = prefStore.getString(globalPreferenceKey); if (!StringUtils.isEmpty(xml)) { try { return fromString(clazz, xml); } catch (IOException e) { Utils.logError(e, false); } } return null; }