@Override public void cancel() { if (isInitialised()) { setChanged(false); } }
@Override public void applyChanges() { if (isInitialised()) { HashSet<Preferences> set = new HashSet<>(); for (Property property : bindingContext.getPropertySet().getProperties()) { String key = property.getDescriptor().getAttribute("key").toString(); String value = property.getValueAsText(); Preferences preferences = getPreferences(property.getDescriptor()); preferences.put(key, value); set.add(preferences); SystemUtils.LOG.fine(String.format("Preferences value change: %s = %s", key, preferences.get(key, null))); } for (Preferences preferences : set) { try { preferences.flush(); } catch (BackingStoreException e) { SnapApp.getDefault().handleError("Failed to store user preferences.", e); } } setChanged(false); } }