docs: public static void saveUserPreferences(IProject project, final UserPreferences userPrefs) throws CoreException {
  
          FileOutput userPrefsOutput = new FileOutput() {
              @Override
              public void writeFile(OutputStream os) throws IOException {
                  userPrefs.write(os);
              }
  
              @Override
              public String getTaskDescription() {
                  return "writing user preferences";
              }
          };
  
          if (project != null) {
              // Make the new user preferences current for the project
              project.setSessionProperty(SESSION_PROPERTY_USERPREFS, userPrefs);
              IFile userPrefsFile = getUserPreferencesFile(project);
              ensureReadWrite(userPrefsFile);
              IO.writeFile(userPrefsFile, userPrefsOutput, null);
              if (project.getFile(DEPRECATED_PREFS_PATH).equals(userPrefsFile)) {
                  String message = "Found old style FindBugs preferences for project '" + project.getName()
                          + "'. This preferences are not at the default location: '" + DEFAULT_PREFS_PATH + "'." + " Please move '"
                          + DEPRECATED_PREFS_PATH + "' to '" + DEFAULT_PREFS_PATH + "'.";
                  getDefault().logWarning(message);
              }
          } else {
              // write the workspace preferences to the eclipse preference store
              ByteArrayOutputStream bos = new ByteArrayOutputStream(10000);
              try {
                  userPrefs.write(bos);
              } catch (IOException e) {
                  getDefault().logException(e, "Failed to write user preferences");
                  return;
              }
              Properties props = new Properties();
              try {
                  props.load(new ByteArrayInputStream(bos.toByteArray()));
              } catch (IOException e) {
                  getDefault().logException(e, "Failed to save user preferences");
                  return;
              }
              IPreferenceStore store = getDefault().getPreferenceStore();
              // Reset any existing custom group entries
              resetStore(store, UserPreferences.KEY_PLUGIN);
              resetStore(store, UserPreferences.KEY_EXCLUDE_BUGS);
              resetStore(store, UserPreferences.KEY_EXCLUDE_FILTER);
              resetStore(store, UserPreferences.KEY_INCLUDE_FILTER);
              for (Entry<Object, Object> entry : props.entrySet()) {
                  store.putValue((String) entry.getKey(), (String) entry.getValue());
              }
              if(store instanceof IPersistentPreferenceStore){
                  IPersistentPreferenceStore store2 = (IPersistentPreferenceStore) store;
                  try {
                      store2.save();
                  } catch (IOException e) {
                      getDefault().logException(e, "Failed to save user preferences");
                  }
              }
          }
      }