-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
…references to the new apis.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ define(function main(require, exports, module) { | |
ExtensionUtils = require("utils/ExtensionUtils"), | ||
StringUtils = require("utils/StringUtils"); | ||
|
||
var prefs; | ||
var params = new UrlParams(); | ||
var config = { | ||
experimental: false, // enable experimental features | ||
|
@@ -125,8 +124,8 @@ define(function main(require, exports, module) { | |
if (LiveDevelopment.status >= LiveDevelopment.STATUS_CONNECTING) { | ||
LiveDevelopment.close(); | ||
} else { | ||
if (!params.get("skipLiveDevelopmentInfo") && !prefs.getValue("afterFirstLaunch")) { | ||
prefs.setValue("afterFirstLaunch", "true"); | ||
if (!params.get("skipLiveDevelopmentInfo") && !PreferencesManager.get("afterFirstLaunch")) { | ||
PreferencesManager.setValueAndSave("afterFirstLaunch", "true"); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dangoor
Contributor
|
||
Dialogs.showModalDialog( | ||
DefaultDialogs.DIALOG_ID_INFO, | ||
Strings.LIVE_DEVELOPMENT_INFO_TITLE, | ||
|
@@ -213,7 +212,7 @@ define(function main(require, exports, module) { | |
} else { | ||
LiveDevelopment.hideHighlight(); | ||
} | ||
prefs.setValue("highlight", config.highlight); | ||
PreferencesManager.setValueAndSave("highlight", config.highlight); | ||
} | ||
|
||
/** Setup window references to useful LiveDevelopment modules */ | ||
|
@@ -256,9 +255,20 @@ define(function main(require, exports, module) { | |
}); | ||
|
||
// init prefs | ||
prefs = PreferencesManager.getPreferenceStorage(module, {highlight: true}); | ||
PreferencesManager.definePreference("highlight", "boolean", true); | ||
This comment has been minimized.
Sorry, something went wrong.
dangoor
Contributor
|
||
|
||
config.highlight = prefs.getValue("highlight"); | ||
/** | ||
* @private | ||
* | ||
* Manage the conversion from old-style localStorage prefs to the new file-based ones. | ||
*/ | ||
function _convertPreferences() { | ||
PreferencesManager.convertPreferences(module, {"highlight": "user"}); | ||
} | ||
|
||
_convertPreferences(); | ||
|
||
config.highlight = PreferencesManager.get("highlight"); | ||
|
||
// init commands | ||
CommandManager.register(Strings.CMD_LIVE_FILE_PREVIEW, Commands.FILE_LIVE_FILE_PREVIEW, _handleGoLiveCommand); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,11 +214,10 @@ define(function (require, exports, module) { | |
// the samples folder on first launch), open it automatically. (We explicitly check for the | ||
// samples folder in case this is the first time we're launching Brackets after upgrading from | ||
// an old version that might not have set the "afterFirstLaunch" pref.) | ||
var prefs = PreferencesManager.getPreferenceStorage(module), | ||
deferred = new $.Deferred(); | ||
var deferred = new $.Deferred(); | ||
|
||
if (!params.get("skipSampleProjectLoad") && !prefs.getValue("afterFirstLaunch")) { | ||
prefs.setValue("afterFirstLaunch", "true"); | ||
if (!params.get("skipSampleProjectLoad") && !PreferencesManager.getViewState("afterFirstLaunch")) { | ||
This comment has been minimized.
Sorry, something went wrong.
dangoor
Contributor
|
||
PreferencesManager.setViewState("afterFirstLaunch", "true"); | ||
if (ProjectManager.isWelcomeProjectPath(initialProjectPath)) { | ||
FileSystem.resolve(initialProjectPath + "index.html", function (err, file) { | ||
if (!err) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,12 +111,6 @@ define(function (require, exports, module) { | |
*/ | ||
var _currentDocument = null; | ||
|
||
/** | ||
* @private | ||
* @type {PreferenceStorage} | ||
*/ | ||
var _prefs = {}; | ||
|
||
/** | ||
* Returns the Document that is currently open in the editor UI. May be null. | ||
* When this changes, DocumentManager dispatches a "currentDocumentChange" event. The current | ||
|
@@ -844,7 +838,7 @@ define(function (require, exports, module) { | |
}); | ||
|
||
// append file root to make file list unique for each project | ||
_prefs.setValue("files_" + projectRoot.fullPath, files); | ||
PreferencesManager.setViewState("files_" + projectRoot.fullPath, files); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
RaymondLim
Author
Contributor
|
||
} | ||
|
||
/** | ||
|
@@ -854,7 +848,7 @@ define(function (require, exports, module) { | |
function _projectOpen(e) { | ||
// file root is appended for each project | ||
var projectRoot = ProjectManager.getProjectRoot(), | ||
files = _prefs.getValue("files_" + projectRoot.fullPath); | ||
files = PreferencesManager.getViewState("files_" + projectRoot.fullPath); | ||
|
||
console.assert(Object.keys(_openDocuments).length === 0); // no files leftover from prev proj | ||
|
||
|
@@ -1028,9 +1022,6 @@ define(function (require, exports, module) { | |
exports.notifyPathNameChanged = notifyPathNameChanged; | ||
exports.notifyPathDeleted = notifyPathDeleted; | ||
|
||
// Setup preferences | ||
_prefs = PreferencesManager.getPreferenceStorage(module); | ||
|
||
// Performance measurements | ||
PerfUtils.createPerfMeasurement("DOCUMENT_MANAGER_GET_DOCUMENT_FOR_PATH", "DocumentManager.getDocumentForPath()"); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,12 +44,6 @@ define(function (require, exports, module) { | |
automaticSort: false | ||
}; | ||
|
||
/** | ||
* @private | ||
* @type {PreferenceStorage} | ||
*/ | ||
var _prefs = {}; | ||
|
||
/** | ||
* @private | ||
* @type {Array.<Sort>} | ||
|
@@ -116,7 +110,7 @@ define(function (require, exports, module) { | |
*/ | ||
function setAutomatic(enable) { | ||
_automaticSort = enable; | ||
_prefs.setValue("automaticSort", _automaticSort); | ||
PreferencesManager.setValueAndSave("automaticSort", _automaticSort); | ||
CommandManager.get(Commands.SORT_WORKINGSET_AUTO).setChecked(_automaticSort); | ||
|
||
if (enable) { | ||
|
@@ -164,7 +158,7 @@ define(function (require, exports, module) { | |
|
||
CommandManager.get(Commands.SORT_WORKINGSET_AUTO).setEnabled(!!newSort.getEvents()); | ||
_currentSort = newSort; | ||
_prefs.setValue("currentSort", _currentSort.getCommandID()); | ||
PreferencesManager.setValueAndSave("currentSort", _currentSort.getCommandID()); | ||
} | ||
} | ||
|
||
|
@@ -321,13 +315,25 @@ define(function (require, exports, module) { | |
CommandManager.register(Strings.CMD_SORT_WORKINGSET_AUTO, Commands.SORT_WORKINGSET_AUTO, _handleAutomaticSort); | ||
|
||
|
||
// Initialize PreferenceStorage | ||
_prefs = PreferencesManager.getPreferenceStorage(module, defaultPrefs); | ||
// Initialize default values for sorting preferences | ||
PreferencesManager.definePreference("currentSort", "string", Commands.SORT_WORKINGSET_BY_ADDED); | ||
This comment has been minimized.
Sorry, something went wrong.
dangoor
Contributor
|
||
PreferencesManager.definePreference("automaticSort", "boolean", false); | ||
|
||
/** | ||
* @private | ||
* | ||
* Manage the conversion from old-style localStorage prefs to the new file-based ones. | ||
*/ | ||
function _convertPreferences() { | ||
PreferencesManager.convertPreferences(module, {"currentSort": "user", "automaticSort": "user"}); | ||
} | ||
|
||
_convertPreferences(); | ||
|
||
// Initialize items dependent on extensions/workingSet | ||
AppInit.appReady(function () { | ||
var curSort = get(_prefs.getValue("currentSort")), | ||
autoSort = _prefs.getValue("automaticSort"); | ||
var curSort = get(PreferencesManager.get("currentSort")), | ||
autoSort = PreferencesManager.get("automaticSort"); | ||
|
||
if (curSort) { | ||
_setCurrentSort(curSort); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,11 +65,6 @@ define(function (require, exports, module) { | |
/** @const Maximum number of matches to collect for Replace All; any additional matches are not listed in the panel & are not replaced */ | ||
var REPLACE_ALL_MAX = 300; | ||
|
||
var _prefs = PreferencesManager.getPreferenceStorage(module, { | ||
caseSensitive: false, | ||
regexp: false | ||
}); | ||
|
||
/** @type {!Panel} Panel that shows results of replaceAll action */ | ||
var replaceAllPanel = null; | ||
|
||
|
@@ -89,6 +84,8 @@ define(function (require, exports, module) { | |
/** @type {!function():void} API from FindInFiles for closing its conflicting search bar, if open */ | ||
var closeFindInFilesBar; | ||
|
||
PreferencesManager.definePreference("caseSensitive", "boolean", false); | ||
PreferencesManager.definePreference("regexp", "boolean", false); | ||
|
||
function SearchState() { | ||
this.searchStartPos = null; | ||
|
@@ -110,12 +107,12 @@ define(function (require, exports, module) { | |
} | ||
|
||
function _updateSearchBarFromPrefs() { | ||
$("#find-case-sensitive").toggleClass("active", _prefs.getValue("caseSensitive")); | ||
$("#find-regexp").toggleClass("active", _prefs.getValue("regexp")); | ||
$("#find-case-sensitive").toggleClass("active", PreferencesManager.get("caseSensitive")); | ||
$("#find-regexp").toggleClass("active", PreferencesManager.get("regexp")); | ||
} | ||
function _updatePrefsFromSearchBar() { | ||
_prefs.setValue("caseSensitive", $("#find-case-sensitive").is(".active")); | ||
_prefs.setValue("regexp", $("#find-regexp").is(".active")); | ||
PreferencesManager.setValueAndSave("caseSensitive", $("#find-case-sensitive").is(".active")); | ||
PreferencesManager.setValueAndSave("regexp", $("#find-regexp").is(".active")); | ||
} | ||
|
||
function parseQuery(query) { | ||
|
@@ -668,6 +665,17 @@ define(function (require, exports, module) { | |
} | ||
} | ||
|
||
/** | ||
* @private | ||
* | ||
* Manage the conversion from old-style localStorage prefs to the new file-based ones. | ||
*/ | ||
function _convertPreferences() { | ||
PreferencesManager.convertPreferences(module, {"caseSensitive": "user", "regexp": "user"}); | ||
This comment has been minimized.
Sorry, something went wrong.
dangoor
Contributor
|
||
} | ||
|
||
_convertPreferences(); | ||
|
||
// Initialize items dependent on HTML DOM | ||
AppInit.htmlReady(function () { | ||
var panelHtml = Mustache.render(searchReplacePanelTemplate, Strings); | ||
|
This should be saved in the separate view state PreferencesSystem, not in the main prefs. As written here, the user's brackets.json file (in app data) will have an
afterFirstLaunch
key in it, which is just noise because no user will want to hand edit that.