public class Preferences extends Object
Config
file.
This is a low-level API. Read/write of preferences in a user branch should be done through
AccountsUpdate
or AccountConfig
.
The config file has separate sections for general, diff and edit preferences:
[general] showSiteHeader = false [diff] hideTopMenu = true [edit] lineLength = 80
The parameter names match the names that are used in the preferences REST API.
If the preference is omitted in the config file, then the default value for the preference is used.
Defaults for preferences that apply for all accounts can be configured in the refs/users/default
branch in the All-Users
repository. The config for the default
preferences must be provided to this class so that it can read default values from it.
The preferences are lazily parsed.
Modifier and Type | Field and Description |
---|---|
static String |
PREFERENCES_CONFIG |
public static final String PREFERENCES_CONFIG
public GeneralPreferencesInfo getGeneralPreferences()
public DiffPreferencesInfo getDiffPreferences()
public EditPreferencesInfo getEditPreferences()
public void parse()
public org.eclipse.jgit.lib.Config saveGeneralPreferences(Optional<GeneralPreferencesInfo> generalPreferencesInput, Optional<DiffPreferencesInfo> diffPreferencesInput, Optional<EditPreferencesInfo> editPreferencesInput) throws org.eclipse.jgit.errors.ConfigInvalidException
org.eclipse.jgit.errors.ConfigInvalidException
public static GeneralPreferencesInfo readDefaultGeneralPreferences(AllUsersName allUsersName, org.eclipse.jgit.lib.Repository allUsersRepo) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static DiffPreferencesInfo readDefaultDiffPreferences(AllUsersName allUsersName, org.eclipse.jgit.lib.Repository allUsersRepo) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static EditPreferencesInfo readDefaultEditPreferences(AllUsersName allUsersName, org.eclipse.jgit.lib.Repository allUsersRepo) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static GeneralPreferencesInfo updateDefaultGeneralPreferences(MetaDataUpdate md, GeneralPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static DiffPreferencesInfo updateDefaultDiffPreferences(MetaDataUpdate md, DiffPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static EditPreferencesInfo updateDefaultEditPreferences(MetaDataUpdate md, EditPreferencesInfo input) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
public static void validateMy(List<MenuItem> my) throws BadRequestException
BadRequestException