Replaces the preferences in the profile with the given preferences.

@param newPreferences the new preferences to populate the profile with
432988
public void setPreferences(OperaPreferences newPreferences) {
    if (!(newPreferences instanceof OperaFilePreferences)) {
      OperaFilePreferences convertedPreferences = new OperaFilePreferences(preferenceFile);
      convertedPreferences.merge(newPreferences);
      preferences = convertedPreferences;
    } else {
      preferences = newPreferences;
    }
  }
1041753
private void initializeShowListDialogPreference() {
        Preference preference = findPreference(getString(R.string.show_list_dialog_preference_key));
        preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {

            @Override
            public boolean onPreferenceClick(final Preference preference) {
                initializeListDialog();
                listDialog.setShowAnimation(createRectangularRevealAnimation(preference));
                listDialog.setDismissAnimation(createRectangularRevealAnimation(preference));
                listDialog.setCancelAnimation(createRectangularRevealAnimation(preference));
                listDialog.show();
                return true;
            }

        });
    }
101523
public synchronized void changeEndpoints(Endpoints endpoints) {
        context().getPreferences().putBytes("custom_endpoints", endpoints.toByteArray());
        actorApi.changeEndpoints(endpoints);
    }
198300
func NewPreferences() (*Preferences, error) {
	prefs := &Preferences{
		Core: Core{
			RegistryURI:        registryURI,
			ManifestURI:        manifestURI,
			GatekeeperAddress:  gatekeeperAddress,
			Context:            true,
			EnableHints:        true,
			EnableProgress:     true,
			EnableCheckUpdates: true,
			EnableColors:       true,
		},
	}

	filePath, _ := RcPath()
	_, err := os.Stat(filePath)
	if os.IsNotExist(err) {
		return prefs, nil
	}

	if err != nil {
		return prefs, err
	}

	err = ini.MapTo(prefs, filePath)
	return prefs, err
}
259540
function preferencesInitialize() {
          return this.initializedPromise = defaultPreferences.then(function (defaults) {
            Object.defineProperty(this, 'defaults', {
              value: Object.freeze(defaults),
              writable: false,
              enumerable: true,
              configurable: false
            });
            this.prefs = cloneObj(defaults);
            return this._readFromStorage(defaults);
          }.bind(this)).then(function (prefObj) {
            this.isInitializedPromiseResolved = true;
            if (prefObj) {
              this.prefs = prefObj;
            }
          }.bind(this));
        }
1369970
public void clearPref() {
        try {
            ((ClcJavaPreferenceStorage) modules.getPreferences()).getPref().clear();
        } catch (BackingStoreException e) {
            logger.error("Cannot clear preferences", e);
        }
    }
1083455
function preferencesReset() {
    return this.initializedPromise.then(function() {
      this.prefs = Object.create(DEFAULT_PREFERENCES);
      return this._writeToStorage(DEFAULT_PREFERENCES);
    }.bind(this));
  }
1066432
private void initializeDynamicPreferenceButton() {
        Button dynamicPreferenceButton = findViewById(R.id.dynamic_preference_button);
        dynamicPreferenceButton.setOnClickListener(createDynamicPreferenceButtonListener());
    }
54976
public function save_user_preview_options($newoptions) {
        foreach ($this->get_user_pref_fields() as $field) {
            if (isset($newoptions->$field)) {
                set_user_preference(self::OPTIONPREFIX . $field, $newoptions->$field);
            }
        }
    }
1031316
public void resetOperaPrefs(String newPrefs) {
    // Always delete and copy over a test profile except for when running
    // the first test which doesn't have a profile to copy over
    if (!firstTestRun || new File(newPrefs).exists()) {
      if (!profileUtils.isMainProfile(smallPreferencesPath) &&
          !profileUtils.isMainProfile(largePreferencesPath) &&
          !profileUtils.isMainProfile(cachePreferencesPath)) {
        // Quit and wait for opera to quit properly
        quitOpera();

        // Due to problems with quitting the Opera desktop application on Windows we introduce this
        // workaround.  This should be fixed in some other way that would allow us to determine in a
        // reliable way if Opera quit already.
        if (Platform.getCurrent().is(Platform.WINDOWS)) {
          try {
            Thread.sleep(2000);
          } catch (InterruptedException e) {
            // fall through
          }
        }

        // Cleanup old profile
        if (!profileUtils.deleteProfile()) {
          logger.severe("Could not delete profile");
        }

        // Copy the profile for the test. This method will return false in case the copying fails or
        // if there is no profile to be copied, so we should check that first here.
        if (!new File(newPrefs).exists()) {
          logger.finer("The '" + newPrefs + "' directory doesn't exist, omitting profile copying.");
        } else if (!profileUtils.copyProfile(newPrefs)) {
          logger.severe("Failed to copy profile from '" + newPrefs);
        } else {
          logger.finer("Profile from '" + newPrefs + "' copied OK");
        }

        // Relaunch Opera and the webdriver service connection
        startOpera();
      } else {
        logger.warning("Running tests in main user profile");
      }
    }

    // No longer the first test run
    firstTestRun = false;
  }
518150
private void initializePreferenceButton() {
        Button preferenceButton = findViewById(R.id.preference_button);
        preferenceButton.setOnClickListener(createPreferenceButtonListener());
    }
47818
@Override
	protected void initializeDefaultPreferences(IPreferenceStore store)
	{
		store.setDefault(ICodeGenConstants.GENERATE_CHAR_SEQUENCES_AS_STRINGS, ICodeGenConstants.GENERATE_CHAR_SEQUENCES_AS_STRING_DEFAULT);
		store.setDefault(ICodeGenConstants.DISABLE_CLONING, ICodeGenConstants.DISABLE_CLONING_DEFAULT);
		store.setDefault(ICodeGenConstants.GENERATE_CONCURRENCY_MECHANISMS, ICodeGenConstants.GENERATE_CONCURRENCY_MECHANISMS_DEFAULT);
		store.setDefault(ICodeGenConstants.CLASSES_TO_SKIP, ICodeGenConstants.CLASSES_TO_SKIP_DEFAULT);
		store.setDefault(ICodeGenConstants.JAVA_PACKAGE, ICodeGenConstants.JAVA_PACKAGE_DEFAULT);
		store.setDefault(ICodeGenConstants.GENERATE_VDM_LOCATIONS_INFO, ICodeGenConstants.GENERATE_VDM_LOCATIONS_INFO_DEFAULT);
		store.setDefault(ICodeGenConstants.GENERATE_JML, ICodeGenConstants.GENERATE_JML_DEFAULT);
		store.setDefault(ICodeGenConstants.JML_USE_INVARIANT_FOR, ICodeGenConstants.JML_USE_INVARIANT_FOR_DEFAULT);
	}
1348101
def set_preferences(self, **kwargs):
        
        json_data = "json={}".format(json.dumps(kwargs))
        headers = {'content-type': 'application/x-www-form-urlencoded'}
        return self._post('command/setPreferences', data=json_data,
                          headers=headers)
1247434
def users_set_preferences(self, user_id, data, **kwargs):
        """"""
        return self.__call_api_post('users.setPreferences', userId=user_id, data=data, kwargs=kwargs)
931344
public void configureFormatterPreferences(Binder binder) {
		binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class);
	}
792871
function updatePreference(id, preference) {
    var callback = preConditions.getCallback(arguments[arguments.length - 1]);

    showWarning();

    // Add the id to the preferece object
    preference.id = id;

    return preferencesModule.update(preference, callback);
  }
1369437
@Initiate(priority = AutumnActionPriority.HIGH_PRIORITY)
    public void initiatePreferences() {
        for (final Entry<String, String> preference : preferencesToInitiate) {
            final String name = preference.key;
            final Preferences preferences = getPreferences(preference.value);
            namesToFiles.put(name, preferences);
            final Preference<?> preferenceWrapper = this.preferences.get(name);
            initiatePreference(name, preferenceWrapper, preferences);
            addLmlActions(name, preferenceWrapper);
        }
        preferencesToInitiate.clear();
    }