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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js

Issue 1422703003: [DevTools] Use ListWidget for rendering of EditFileSystemView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 /** 287 /**
288 * @constructor 288 * @constructor
289 * @extends {WebInspector.SettingsTab} 289 * @extends {WebInspector.SettingsTab}
290 */ 290 */
291 WebInspector.WorkspaceSettingsTab = function() 291 WebInspector.WorkspaceSettingsTab = function()
292 { 292 {
293 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content"); 293 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content");
294 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); 294 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
295 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); 295 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
296 296
297 this._commonSection = this._appendSection(WebInspector.UIString("Common"));
298 var folderExcludeSetting = WebInspector.isolatedFileSystemManager.workspaceF olderExcludePatternSetting(); 297 var folderExcludeSetting = WebInspector.isolatedFileSystemManager.workspaceF olderExcludePatternSetting();
299 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi eld(WebInspector.UIString("Folder exclude pattern"), folderExcludeSetting, false , 0, "270px", WebInspector.SettingsUI.regexValidator); 298 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi eld(WebInspector.UIString("Folder exclude pattern"), folderExcludeSetting, false , 0, "270px", WebInspector.SettingsUI.regexValidator);
300 this._commonSection.appendChild(folderExcludePatternInput); 299 this.containerElement.appendChild(folderExcludePatternInput);
301 300
302 this._fileSystemsSection = this._appendSection(WebInspector.UIString("Folder s")); 301 this._fileSystemsListContainer = this.containerElement.createChild("div", "s ettings-list-container");
303 this._fileSystemsListContainer = this._fileSystemsSection.createChild("p", " settings-list-container");
304 302
305 this._addFileSystemRowElement = this._fileSystemsSection.createChild("div"); 303 this.containerElement.appendChild(createTextButton(WebInspector.UIString("Ad d folder\u2026"), this._addFileSystemClicked.bind(this)));
306 this._addFileSystemRowElement.appendChild(createTextButton(WebInspector.UISt ring("Add folder\u2026"), this._addFileSystemClicked.bind(this)));
307 304
308 /** @type {!Map<string, !Element>} */ 305 /** @type {!Map<string, !Element>} */
309 this._elementByPath = new Map(); 306 this._elementByPath = new Map();
310 307
311 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */ 308 /** @type {!Map<string, !WebInspector.EditFileSystemView>} */
312 this._mappingViewByPath = new Map(); 309 this._mappingViewByPath = new Map();
313 310
314 var fileSystemPaths = WebInspector.isolatedFileSystemManager.fileSystemPaths (); 311 var fileSystemPaths = WebInspector.isolatedFileSystemManager.fileSystemPaths ();
315 for (var i = 0; i < fileSystemPaths.length; ++i) 312 for (var i = 0; i < fileSystemPaths.length; ++i)
316 this._addItem(/** @type {!WebInspector.IsolatedFileSystem} */ (WebInspec tor.isolatedFileSystemManager.fileSystem(fileSystemPaths[i]))); 313 this._addItem(/** @type {!WebInspector.IsolatedFileSystem} */ (WebInspec tor.isolatedFileSystemManager.fileSystem(fileSystemPaths[i])));
317 } 314 }
318 315
319 WebInspector.WorkspaceSettingsTab.prototype = { 316 WebInspector.WorkspaceSettingsTab.prototype = {
320 /** 317 /**
321 * @param {!WebInspector.IsolatedFileSystem} fileSystem 318 * @param {!WebInspector.IsolatedFileSystem} fileSystem
322 */ 319 */
323 _addItem: function(fileSystem) 320 _addItem: function(fileSystem)
324 { 321 {
325 var element = this._renderFileSystem(fileSystem); 322 var element = this._renderFileSystem(fileSystem);
326 this._elementByPath.set(fileSystem.path(), element); 323 this._elementByPath.set(fileSystem.path(), element);
327 324
328 this._fileSystemsListContainer.appendChild(element); 325 this._fileSystemsListContainer.appendChild(element);
329 326
330 var mappingView = new WebInspector.EditFileSystemView(fileSystem.path()) ; 327 var mappingView = new WebInspector.EditFileSystemView(fileSystem.path()) ;
331 this._mappingViewByPath.set(fileSystem.path(), mappingView); 328 this._mappingViewByPath.set(fileSystem.path(), mappingView);
329 mappingView.element.classList.add("file-system-mapping-view");
332 mappingView.show(element); 330 mappingView.show(element);
333 }, 331 },
334 332
335 /** 333 /**
336 * @param {!WebInspector.IsolatedFileSystem} fileSystem 334 * @param {!WebInspector.IsolatedFileSystem} fileSystem
337 * @return {!Element} 335 * @return {!Element}
338 */ 336 */
339 _renderFileSystem: function(fileSystem) 337 _renderFileSystem: function(fileSystem)
340 { 338 {
341 var element = createElementWithClass("div", "file-system-container");
342 var fileSystemPath = fileSystem.path(); 339 var fileSystemPath = fileSystem.path();
343 var textElement = element.createChild("div", "file-system-header");
344 var pathElement = textElement.createChild("div", "file-system-path");
345 pathElement.title = fileSystemPath;
346
347 const maxTotalPathLength = 75;
348 const maxFolderNameLength = 40;
349
350 var lastIndexOfSlash = fileSystemPath.lastIndexOf(WebInspector.isWin() ? "\\" : "/"); 340 var lastIndexOfSlash = fileSystemPath.lastIndexOf(WebInspector.isWin() ? "\\" : "/");
351 var folderName = fileSystemPath.substr(lastIndexOfSlash + 1); 341 var folderName = fileSystemPath.substr(lastIndexOfSlash + 1);
352 var folderPath = fileSystemPath.substr(0, lastIndexOfSlash + 1);
353 folderPath = folderPath.trimMiddle(maxTotalPathLength - Math.min(maxFold erNameLength, folderName.length));
354 folderName = folderName.trimMiddle(maxFolderNameLength);
355 342
356 pathElement.createChild("span").textContent = WebInspector.UIString("Fol der: "); 343 var element = createElementWithClass("div", "file-system-container");
344 var header = element.createChild("div", "file-system-header");
357 345
358 var folderPathElement = pathElement.createChild("span"); 346 header.createChild("div", "file-system-name").textContent = folderName;
359 folderPathElement.textContent = folderPath; 347 var path = header.createChild("div", "file-system-path");
348 path.textContent = fileSystemPath;
349 path.title = fileSystemPath;
360 350
361 var nameElement = pathElement.createChild("span", "file-system-path-name "); 351 var toolbar = new WebInspector.Toolbar();
362 nameElement.textContent = folderName; 352 var button = new WebInspector.ToolbarButton(WebInspector.UIString("Remov e"), "delete-toolbar-item");
363 353 button.addEventListener("click", this._removeFileSystemClicked.bind(this , fileSystem));
364 textElement.appendChild(createTextButton(WebInspector.UIString("Remove") , this._removeFileSystemClicked.bind(this, fileSystem))); 354 toolbar.appendToolbarItem(button);
355 header.appendChild(toolbar.element);
356 //createTextButton(WebInspector.UIString("Remove"), this._removeFileSyst emClicked.bind(this, fileSystem), "file-system-remove"));
365 357
366 return element; 358 return element;
367 }, 359 },
368 360
369 /** 361 /**
370 * @param {!WebInspector.IsolatedFileSystem} fileSystem 362 * @param {!WebInspector.IsolatedFileSystem} fileSystem
371 */ 363 */
372 _removeFileSystemClicked: function(fileSystem) 364 _removeFileSystemClicked: function(fileSystem)
373 { 365 {
374 WebInspector.isolatedFileSystemManager.removeFileSystem(fileSystem.path( )); 366 WebInspector.isolatedFileSystemManager.removeFileSystem(fileSystem.path( ));
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 var columnId = columns[i]; 1059 var columnId = columns[i];
1068 var editElement = this._addInputElements.get(columnId); 1060 var editElement = this._addInputElements.get(columnId);
1069 this._setEditElementValue(editElement, ""); 1061 this._setEditElementValue(editElement, "");
1070 } 1062 }
1071 }, 1063 },
1072 1064
1073 __proto__: WebInspector.SettingsList.prototype 1065 __proto__: WebInspector.SettingsList.prototype
1074 } 1066 }
1075 1067
1076 WebInspector._settingsController = new WebInspector.SettingsController(); 1068 WebInspector._settingsController = new WebInspector.SettingsController();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698