@@ -121441,9 +121441,6 @@ $3132870559d60e53$require$initFsLib($8adf1cfaed2eb5b1$exports);
121441121441/*global appshell */
121442121442/*unittests: Preferences Base */
121443121443
121444- // @INCLUDE_IN_API_DOCS
121445-
121446-
121447121444/**
121448121445 * Infrastructure for the preferences system.
121449121446 *
@@ -121550,6 +121547,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
121550121547 * Error type for problems parsing preference files.
121551121548 *
121552121549 * @constructor
121550+ * @private
121553121551 * @param {string} message Error message
121554121552 */
121555121553 function ParsingError(message) {
@@ -122441,7 +122439,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122441122439
122442122440 /**
122443122441 * Represents a single, known Preference.
122444- *
122442+ * @private
122445122443 * @constructor
122446122444 * @param {Object} properties Information about the Preference that is stored on this object
122447122445 */
@@ -122456,6 +122454,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122456122454 * Utility for PreferencesSystem & PrefixedPreferencesSystem -- attach EventDispatcher's on()/off()
122457122455 * implementation as private _on_internal()/_off_internal() methods, so the custom on()/off() APIs
122458122456 * these classes use can leverage EventDispatcher code internally. Also attach the regular public trigger().
122457+ * @private
122459122458 */
122460122459 function _addEventDispatcherImpl(proto) {
122461122460 var temp = {};
@@ -122468,7 +122467,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122468122467 /**
122469122468 * Provides a subset of the PreferencesSystem functionality with preference
122470122469 * access always occurring with the given prefix.
122471- *
122470+ * @private
122472122471 * @constructor
122473122472 * @param {PreferencesSystem} base The real PreferencesSystem that is backing this one
122474122473 * @param {string} prefix Prefix that is used for preferences lookup. Any separator characters should already be added.
@@ -122482,7 +122481,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122482122481 PrefixedPreferencesSystem.prototype = {
122483122482 /**
122484122483 * Defines a new (prefixed) preference.
122485- *
122484+ * @private
122486122485 * @param {string} id unprefixed identifier of the preference. Generally a dotted name.
122487122486 * @param {string} type Data type for the preference (generally, string, boolean, number)
122488122487 * @param {Object} initial Default value for the preference
@@ -122503,7 +122502,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122503122502
122504122503 /**
122505122504 * Get the prefixed preference object
122506- *
122505+ * @private
122507122506 * @param {string} id ID of the pref to retrieve.
122508122507 */
122509122508 getPreference: function (id) {
@@ -122512,7 +122511,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122512122511
122513122512 /**
122514122513 * Gets the prefixed preference
122515- *
122514+ * @private
122516122515 * @param {string} id Name of the preference for which the value should be retrieved
122517122516 * @param {Object=} context Optional context object to change the preference lookup
122518122517 */
@@ -122523,7 +122522,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122523122522
122524122523 /**
122525122524 * Gets the location in which the value of a prefixed preference has been set.
122526- *
122525+ * @private
122527122526 * @param {string} id Name of the preference for which the value should be retrieved
122528122527 * @param {Object=} context Optional context object to change the preference lookup
122529122528 * @return {{scope: string, layer: ?string, layerID: ?object}} Object describing where the preferences came from
@@ -122534,7 +122533,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122534122533
122535122534 /**
122536122535 * Sets the prefixed preference.
122537- *
122536+ * @private
122538122537 * @param {string} id - The identifier of the preference to set.
122539122538 * @param {Object} value - The new value for the preference.
122540122539 * @param {{location: ?Object, context: ?Object}=} options - Specific location to set the value or context for the operation.
@@ -122587,7 +122586,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122587122586 /**
122588122587 * Sets up a listener for events for this PrefixedPreferencesSystem. Only prefixed events
122589122588 * will notify. Optionally, you can set up a listener for a specific preference.
122590- *
122589+ * @private
122591122590 * @param {string} event Name of the event to listen for
122592122591 * @param {string|Function} preferenceID Name of a specific preference or the handler function
122593122592 * @param {?Function} handler Handler for the event
@@ -122610,7 +122609,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122610122609 /**
122611122610 * Turns off the event handlers for a given event, optionally for a specific preference
122612122611 * or a specific handler function.
122613- *
122612+ * @private
122614122613 * @param {string} event Name of the event for which to turn off listening
122615122614 * @param {string|Function} preferenceID Name of a specific preference or the handler function
122616122615 * @param {?Function} handler Specific handler which should stop being notified
@@ -122632,7 +122631,7 @@ define("preferences/PreferencesBase", function (require, exports, module) {
122632122631 /**
122633122632 * Saves the preferences. If a save is already in progress, a Promise is returned for
122634122633 * that save operation.
122635- *
122634+ * @private
122636122635 * @return {Promise} Resolved when the preferences are done saving.
122637122636 */
122638122637 save: function () {
@@ -123396,9 +123395,6 @@ define("preferences/PreferencesBase", function (require, exports, module) {
123396123395 *
123397123396 */
123398123397
123399- // @INCLUDE_IN_API_DOCS
123400-
123401-
123402123398/**
123403123399 * PreferencesDialogs
123404123400 *
@@ -123434,6 +123430,7 @@ define("preferences/PreferencesDialogs", function (require, exports, module) {
123434123430
123435123431 /**
123436123432 * Validate that text string is a valid base url which should map to a server folder
123433+ * @private
123437123434 * @param {string} url
123438123435 * @return {string} Empty string if valid, otherwise error string
123439123436 */
@@ -123545,6 +123542,8 @@ define("preferences/PreferencesDialogs", function (require, exports, module) {
123545123542 *
123546123543 */
123547123544
123545+ // @INCLUDE_IN_API_DOCS
123546+
123548123547/*global define, console */
123549123548/*unittests: Preferences Manager */
123550123549
@@ -123646,6 +123645,7 @@ define("preferences/PreferencesManager", function (require, exports, module) {
123646123645
123647123646 /**
123648123647 * Context to look up preferences in the current project.
123648+ *
123649123649 * @type {Object}
123650123650 */
123651123651 var CURRENT_PROJECT = {};
@@ -123746,6 +123746,7 @@ define("preferences/PreferencesManager", function (require, exports, module) {
123746123746
123747123747 /**
123748123748 * @private
123749+ *
123749123750 * This function is used internally to set the current language of the document.
123750123751 * Both at the moment of opening the file and when the language is manually
123751123752 * overriden.
@@ -123839,9 +123840,33 @@ define("preferences/PreferencesManager", function (require, exports, module) {
123839123840
123840123841 // Context names for preference lookups
123841123842 exports.CURRENT_PROJECT = CURRENT_PROJECT;
123843+
123844+ /**
123845+ * State project context
123846+ *
123847+ * @type {string}
123848+ */
123842123849 exports.STATE_PROJECT_CONTEXT = StateManager.PROJECT_CONTEXT;
123850+
123851+ /**
123852+ * State global context
123853+ *
123854+ * @type {string}
123855+ */
123843123856 exports.STATE_GLOBAL_CONTEXT = StateManager.GLOBAL_CONTEXT;
123857+
123858+ /**
123859+ * Project then global context
123860+ *
123861+ * @type {string}
123862+ */
123844123863 exports.STATE_PROJECT_THEN_GLOBAL_CONTEXT = StateManager.PROJECT_THEN_GLOBAL_CONTEXT;
123864+
123865+ /**
123866+ * Project scope
123867+ *
123868+ * @type {Object}
123869+ */
123845123870 exports.PROJECT_SCOPE = { location: { scope: "project" } };
123846123871
123847123872 exports.ready = PreferencesImpl.managerReady;
@@ -123900,9 +123925,27 @@ define("preferences/StateManager", function (require, exports, module) {
123900123925 EventDispatcher = require("utils/EventDispatcher"),
123901123926 ProjectManager = require("project/ProjectManager");
123902123927
123928+ /**
123929+ * Project specific context
123930+ * @const
123931+ * @type {string}
123932+ */
123903123933 const PROJECT_CONTEXT = "project";
123934+
123935+ /**
123936+ * Global context
123937+ * @const
123938+ * @type {string}
123939+ */
123904123940 const GLOBAL_CONTEXT = "global";
123941+
123942+ /**
123943+ * Project or global context
123944+ * @const
123945+ * @type {string}
123946+ */
123905123947 const PROJECT_THEN_GLOBAL_CONTEXT = "any";
123948+
123906123949 const PHSTORE_STATEMANAGER_PREFIX = "STATE_";
123907123950 const transformDotsInID = {};
123908123951
@@ -124052,6 +124095,12 @@ define("preferences/StateManager", function (require, exports, module) {
124052124095 return preference;
124053124096 }
124054124097
124098+ /**
124099+ * Get the preference instance for the given ID.
124100+ *
124101+ * @param {string} id
124102+ * @returns {{}}
124103+ */
124055124104 function getPreferenceInternal(id) {
124056124105 if(!definedPreferences[id]){
124057124106 throw new Error("getPreference " + id + " no such preference defined.");
@@ -124060,6 +124109,19 @@ define("preferences/StateManager", function (require, exports, module) {
124060124109 }
124061124110
124062124111 const knownExtensions = {};
124112+
124113+ /**
124114+ * create a state manager for an extension.
124115+ * ensure that the IDs are unique.
124116+ *
124117+ * @param {string} extensionID
124118+ * @returns {object} Object with methods to manage the extension's state and preferences.
124119+ * - `get(id, context)`: Get the value from the extension's state.
124120+ * - `set(id, value, context)`: Set the value in the extension's state.
124121+ * - `definePreference(id, type, initial, options)`: define a preference for the extension.
124122+ * - `getPreference(id)`: retrieve a defined preference.
124123+ * - `PROJECT_CONTEXT`, `GLOBAL_CONTEXT`, `PROJECT_THEN_GLOBAL_CONTEXT`: constant for context management.
124124+ */
124063124125 function createExtensionStateManager(extensionID) {
124064124126 let i=0;
124065124127 if(extensionID.includes(".")){
0 commit comments