Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: Source/devtools/front_end/FileSystemMapping.js

Issue 212223003: DevTools: Introduce WebInspector.RegExpSetting. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 "/.*~$" 65 "/.*~$"
66 ]; 66 ];
67 var defaultExcludedFolders = defaultCommonExcludedFolders; 67 var defaultExcludedFolders = defaultCommonExcludedFolders;
68 if (WebInspector.isWin()) 68 if (WebInspector.isWin())
69 defaultExcludedFolders = defaultExcludedFolders.concat(defaultWinExclude dFolders); 69 defaultExcludedFolders = defaultExcludedFolders.concat(defaultWinExclude dFolders);
70 else if (WebInspector.isMac()) 70 else if (WebInspector.isMac())
71 defaultExcludedFolders = defaultExcludedFolders.concat(defaultMacExclude dFolders); 71 defaultExcludedFolders = defaultExcludedFolders.concat(defaultMacExclude dFolders);
72 else 72 else
73 defaultExcludedFolders = defaultExcludedFolders.concat(defaultLinuxExclu dedFolders); 73 defaultExcludedFolders = defaultExcludedFolders.concat(defaultLinuxExclu dedFolders);
74 var defaultExcludedFoldersPattern = defaultExcludedFolders.join("|"); 74 var defaultExcludedFoldersPattern = defaultExcludedFolders.join("|");
75 WebInspector.settings.workspaceFolderExcludePattern = WebInspector.settings. createSetting("workspaceFolderExcludePattern", defaultExcludedFoldersPattern); 75 WebInspector.settings.workspaceFolderExcludePattern = WebInspector.settings. createRegExpSetting("workspaceFolderExcludePattern", defaultExcludedFoldersPatte rn, WebInspector.isWin() ? "i" : "");
76 /** @type {!Object.<string, !Array.<!WebInspector.FileSystemMapping.Entry>>} */ 76 /** @type {!Object.<string, !Array.<!WebInspector.FileSystemMapping.Entry>>} */
77 this._fileSystemMappings = {}; 77 this._fileSystemMappings = {};
78 /** @type {!Object.<string, !Array.<!WebInspector.FileSystemMapping.Excluded FolderEntry>>} */ 78 /** @type {!Object.<string, !Array.<!WebInspector.FileSystemMapping.Excluded FolderEntry>>} */
79 this._excludedFolders = {}; 79 this._excludedFolders = {};
80 this._loadFromSettings(); 80 this._loadFromSettings();
81 } 81 }
82 82
83 WebInspector.FileSystemMapping.Events = { 83 WebInspector.FileSystemMapping.Events = {
84 FileMappingAdded: "FileMappingAdded", 84 FileMappingAdded: "FileMappingAdded",
85 FileMappingRemoved: "FileMappingRemoved", 85 FileMappingRemoved: "FileMappingRemoved",
(...skipping 28 matching lines...) Expand all
114 this._excludedFolders[fileSystemPath] = []; 114 this._excludedFolders[fileSystemPath] = [];
115 var excludedFolders = this._excludedFolders[fileSystemPath]; 115 var excludedFolders = this._excludedFolders[fileSystemPath];
116 116
117 for (var i = 0; i < savedExcludedFoldersForPath.length; ++i) { 117 for (var i = 0; i < savedExcludedFoldersForPath.length; ++i) {
118 var savedEntry = savedExcludedFoldersForPath[i]; 118 var savedEntry = savedExcludedFoldersForPath[i];
119 var entry = new WebInspector.FileSystemMapping.ExcludedFolderEnt ry(savedEntry.fileSystemPath, savedEntry.path); 119 var entry = new WebInspector.FileSystemMapping.ExcludedFolderEnt ry(savedEntry.fileSystemPath, savedEntry.path);
120 excludedFolders.push(entry); 120 excludedFolders.push(entry);
121 } 121 }
122 } 122 }
123 123
124 var workspaceFolderExcludePattern = WebInspector.settings.workspaceFolde rExcludePattern.get()
125 try {
126 var flags = WebInspector.isWin() ? "i" : "";
127 this._workspaceFolderExcludeRegex = workspaceFolderExcludePattern ? new RegExp(workspaceFolderExcludePattern, flags) : null;
128 } catch (e) {
129 }
130
131 this._rebuildIndexes(); 124 this._rebuildIndexes();
132 }, 125 },
133 126
134 _saveToSettings: function() 127 _saveToSettings: function()
135 { 128 {
136 var savedMapping = this._fileSystemMappings; 129 var savedMapping = this._fileSystemMappings;
137 this._fileSystemMappingSetting.set(savedMapping); 130 this._fileSystemMappingSetting.set(savedMapping);
138 131
139 var savedExcludedFolders = this._excludedFolders; 132 var savedExcludedFolders = this._excludedFolders;
140 this._excludedFoldersSetting.set(savedExcludedFolders); 133 this._excludedFoldersSetting.set(savedExcludedFolders);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 * @return {boolean} 315 * @return {boolean}
323 */ 316 */
324 isFileExcluded: function(fileSystemPath, folderPath) 317 isFileExcluded: function(fileSystemPath, folderPath)
325 { 318 {
326 var excludedFolders = this._excludedFolders[fileSystemPath] || []; 319 var excludedFolders = this._excludedFolders[fileSystemPath] || [];
327 for (var i = 0; i < excludedFolders.length; ++i) { 320 for (var i = 0; i < excludedFolders.length; ++i) {
328 var entry = excludedFolders[i]; 321 var entry = excludedFolders[i];
329 if (entry.path === folderPath) 322 if (entry.path === folderPath)
330 return true; 323 return true;
331 } 324 }
332 return this._workspaceFolderExcludeRegex && this._workspaceFolderExclude Regex.test(folderPath); 325 var regex = WebInspector.settings.workspaceFolderExcludePattern.asRegExp ();
326 return regex && regex.test(folderPath);
333 }, 327 },
334 328
335 /** 329 /**
336 * @param {string} fileSystemPath 330 * @param {string} fileSystemPath
337 * @return {!Array.<!WebInspector.FileSystemMapping.ExcludedFolderEntry>} 331 * @return {!Array.<!WebInspector.FileSystemMapping.ExcludedFolderEntry>}
338 */ 332 */
339 excludedFolders: function(fileSystemPath) 333 excludedFolders: function(fileSystemPath)
340 { 334 {
341 var excludedFolders = this._excludedFolders[fileSystemPath]; 335 var excludedFolders = this._excludedFolders[fileSystemPath];
342 return excludedFolders ? excludedFolders.slice() : []; 336 return excludedFolders ? excludedFolders.slice() : [];
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 /** 435 /**
442 * @constructor 436 * @constructor
443 * @param {string} fileSystemPath 437 * @param {string} fileSystemPath
444 * @param {string} path 438 * @param {string} path
445 */ 439 */
446 WebInspector.FileSystemMapping.ExcludedFolderEntry = function(fileSystemPath, pa th) 440 WebInspector.FileSystemMapping.ExcludedFolderEntry = function(fileSystemPath, pa th)
447 { 441 {
448 this.fileSystemPath = fileSystemPath; 442 this.fileSystemPath = fileSystemPath;
449 this.path = path; 443 this.path = path;
450 } 444 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698