* @param value
*/
public static boolean updatePreference(IWidgetInstance widgetInstance, String name, String value){
IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
boolean found=false;
IPreference preference = widgetInstance.getPreference(name);
if (preference != null)
{
if(value==null || value.equalsIgnoreCase("null")){
widgetInstance.getPreferences().remove(preference);
}
else{
preference.setDvalue(value);
}
found=true;
}
if(!found){
if (value != null){
preference = persistenceManager.newInstance(IPreference.class);
preference.setDkey(name);
preference.setDvalue(value);
widgetInstance.getPreferences().add(preference);
}
}
persistenceManager.save(widgetInstance);
return found;