OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 /** | 286 /** |
287 * @constructor | 287 * @constructor |
288 * @extends {WebInspector.SettingsTab} | 288 * @extends {WebInspector.SettingsTab} |
289 */ | 289 */ |
290 WebInspector.WorkspaceSettingsTab = function() | 290 WebInspector.WorkspaceSettingsTab = function() |
291 { | 291 { |
292 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor
kspace-tab-content"); | 292 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor
kspace-tab-content"); |
293 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); | 293 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); |
294 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); | 294 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate
dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); |
295 | 295 |
296 var folderExcludeSetting = WebInspector.isolatedFileSystemManager.workspaceF
olderExcludePatternSetting(); | 296 var folderExcludePatternInput = this._createFolderExcludePatternInput(); |
297 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi
eld(WebInspector.UIString("Folder exclude pattern"), folderExcludeSetting, false
, 0, "270px", WebInspector.SettingsUI.regexValidator); | |
298 folderExcludePatternInput.classList.add("folder-exclude-pattern"); | 297 folderExcludePatternInput.classList.add("folder-exclude-pattern"); |
299 this.containerElement.appendChild(folderExcludePatternInput); | 298 this.containerElement.appendChild(folderExcludePatternInput); |
300 | 299 |
301 this._fileSystemsListContainer = this.containerElement.createChild("div", ""
); | 300 this._fileSystemsListContainer = this.containerElement.createChild("div", ""
); |
302 | 301 |
303 this.containerElement.appendChild(createTextButton(WebInspector.UIString("Ad
d folder\u2026"), this._addFileSystemClicked.bind(this))); | 302 this.containerElement.appendChild(createTextButton(WebInspector.UIString("Ad
d folder\u2026"), this._addFileSystemClicked.bind(this))); |
304 | 303 |
305 /** @type {!Map<string, !Element>} */ | 304 /** @type {!Map<string, !Element>} */ |
306 this._elementByPath = new Map(); | 305 this._elementByPath = new Map(); |
307 | 306 |
308 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */ | 307 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */ |
309 this._mappingViewByPath = new Map(); | 308 this._mappingViewByPath = new Map(); |
310 | 309 |
311 var fileSystemPaths = WebInspector.isolatedFileSystemManager.fileSystemPaths
(); | 310 var fileSystemPaths = WebInspector.isolatedFileSystemManager.fileSystemPaths
(); |
312 for (var i = 0; i < fileSystemPaths.length; ++i) | 311 for (var i = 0; i < fileSystemPaths.length; ++i) |
313 this._addItem(/** @type {!WebInspector.IsolatedFileSystem} */ (WebInspec
tor.isolatedFileSystemManager.fileSystem(fileSystemPaths[i]))); | 312 this._addItem(/** @type {!WebInspector.IsolatedFileSystem} */ (WebInspec
tor.isolatedFileSystemManager.fileSystem(fileSystemPaths[i]))); |
314 } | 313 } |
315 | 314 |
316 WebInspector.WorkspaceSettingsTab.prototype = { | 315 WebInspector.WorkspaceSettingsTab.prototype = { |
317 /** | 316 /** |
| 317 * @return {!Element} |
| 318 */ |
| 319 _createFolderExcludePatternInput: function() |
| 320 { |
| 321 var p = createElement("p"); |
| 322 var labelElement = p.createChild("label"); |
| 323 labelElement.textContent = WebInspector.UIString("Folder exclude pattern
"); |
| 324 var inputElement = p.createChild("input"); |
| 325 inputElement.type = "text"; |
| 326 inputElement.style.width = "270px"; |
| 327 var folderExcludeSetting = WebInspector.isolatedFileSystemManager.worksp
aceFolderExcludePatternSetting(); |
| 328 var setValue = WebInspector.bindInput(inputElement, folderExcludeSetting
.set.bind(folderExcludeSetting), regexValidator, false); |
| 329 folderExcludeSetting.addChangeListener(() => setValue.call(null, folderE
xcludeSetting.get())); |
| 330 return p; |
| 331 |
| 332 /** |
| 333 * @param {string} value |
| 334 * @return {boolean} |
| 335 */ |
| 336 function regexValidator(value) |
| 337 { |
| 338 var regex; |
| 339 try { |
| 340 regex = new RegExp(value); |
| 341 } catch (e) { |
| 342 } |
| 343 return !!regex; |
| 344 } |
| 345 }, |
| 346 |
| 347 /** |
318 * @param {!WebInspector.IsolatedFileSystem} fileSystem | 348 * @param {!WebInspector.IsolatedFileSystem} fileSystem |
319 */ | 349 */ |
320 _addItem: function(fileSystem) | 350 _addItem: function(fileSystem) |
321 { | 351 { |
322 var element = this._renderFileSystem(fileSystem); | 352 var element = this._renderFileSystem(fileSystem); |
323 this._elementByPath.set(fileSystem.path(), element); | 353 this._elementByPath.set(fileSystem.path(), element); |
324 | 354 |
325 this._fileSystemsListContainer.appendChild(element); | 355 this._fileSystemsListContainer.appendChild(element); |
326 | 356 |
327 var mappingView = new WebInspector.EditFileSystemView(fileSystem.path())
; | 357 var mappingView = new WebInspector.EditFileSystemView(fileSystem.path())
; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 var settings = extension.descriptor()["settings"]; | 595 var settings = extension.descriptor()["settings"]; |
566 if (settings && settings.indexOf(setting.name) !== -1) { | 596 if (settings && settings.indexOf(setting.name) !== -1) { |
567 WebInspector._settingsController.showSettingsScreen(extension.de
scriptor()["name"]); | 597 WebInspector._settingsController.showSettingsScreen(extension.de
scriptor()["name"]); |
568 success = true; | 598 success = true; |
569 } | 599 } |
570 } | 600 } |
571 } | 601 } |
572 } | 602 } |
573 | 603 |
574 WebInspector._settingsController = new WebInspector.SettingsController(); | 604 WebInspector._settingsController = new WebInspector.SettingsController(); |
OLD | NEW |