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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/TabbedEditorContainer.js

Issue 2486073005: DevTools: [Persistence] update source editor tab icons on binding change (Closed)
Patch Set: update tab icons and title Created 4 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
« no previous file with comments | « no previous file | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 this._previouslyViewedFilesSetting = setting; 72 this._previouslyViewedFilesSetting = setting;
73 this._history = WebInspector.TabbedEditorContainer.History.fromObject(this._ previouslyViewedFilesSetting.get()); 73 this._history = WebInspector.TabbedEditorContainer.History.fromObject(this._ previouslyViewedFilesSetting.get());
74 } 74 }
75 75
76 /** 76 /**
77 * @param {!WebInspector.Event} event 77 * @param {!WebInspector.Event} event
78 */ 78 */
79 _onBindingCreated(event) { 79 _onBindingCreated(event) {
80 var binding = /** @type {!WebInspector.PersistenceBinding} */ (event.data); 80 var binding = /** @type {!WebInspector.PersistenceBinding} */ (event.data);
81 this._updateFileTitle(binding.network);
82
81 var networkTabId = this._tabIds.get(binding.network); 83 var networkTabId = this._tabIds.get(binding.network);
82 var fileSystemTabId = this._tabIds.get(binding.fileSystem); 84 var fileSystemTabId = this._tabIds.get(binding.fileSystem);
83
84 if (networkTabId)
85 this._tabbedPane.changeTabTitle(
86 networkTabId, this._titleForFile(binding.fileSystem), this._tooltipFor File(binding.fileSystem));
87 if (!fileSystemTabId) 85 if (!fileSystemTabId)
88 return; 86 return;
89 87
90 var wasSelectedInFileSystem = this._currentFile === binding.fileSystem; 88 var wasSelectedInFileSystem = this._currentFile === binding.fileSystem;
91 var currentSelectionRange = this._history.selectionRange(binding.fileSystem. url()); 89 var currentSelectionRange = this._history.selectionRange(binding.fileSystem. url());
92 var currentScrollLineNumber = this._history.scrollLineNumber(binding.fileSys tem.url()); 90 var currentScrollLineNumber = this._history.scrollLineNumber(binding.fileSys tem.url());
93 91
94 var tabIndex = this._tabbedPane.tabIndex(fileSystemTabId); 92 var tabIndex = this._tabbedPane.tabIndex(fileSystemTabId);
95 var tabsToClose = [fileSystemTabId]; 93 var tabsToClose = [fileSystemTabId];
96 if (networkTabId) 94 if (networkTabId)
97 tabsToClose.push(networkTabId); 95 tabsToClose.push(networkTabId);
98 this._closeTabs(tabsToClose, true); 96 this._closeTabs(tabsToClose, true);
99 networkTabId = this._appendFileTab(binding.network, false, tabIndex); 97 networkTabId = this._appendFileTab(binding.network, false, tabIndex);
100 this._updateHistory(); 98 this._updateHistory();
101 99
102 if (wasSelectedInFileSystem) 100 if (wasSelectedInFileSystem)
103 this._tabbedPane.selectTab(networkTabId, false); 101 this._tabbedPane.selectTab(networkTabId, false);
104 102
105 var networkTabView = /** @type {!WebInspector.Widget} */ (this._tabbedPane.t abView(networkTabId)); 103 var networkTabView = /** @type {!WebInspector.Widget} */ (this._tabbedPane.t abView(networkTabId));
106 this._restoreEditorProperties(networkTabView, currentSelectionRange, current ScrollLineNumber); 104 this._restoreEditorProperties(networkTabView, currentSelectionRange, current ScrollLineNumber);
107 } 105 }
108 106
109 /** 107 /**
110 * @param {!WebInspector.Event} event 108 * @param {!WebInspector.Event} event
111 */ 109 */
112 _onBindingRemoved(event) { 110 _onBindingRemoved(event) {
113 var binding = /** @type {!WebInspector.PersistenceBinding} */ (event.data); 111 var binding = /** @type {!WebInspector.PersistenceBinding} */ (event.data);
112 this._updateFileTitle(binding.network);
113
114 var networkTabId = this._tabIds.get(binding.network); 114 var networkTabId = this._tabIds.get(binding.network);
115 if (!networkTabId) 115 if (!networkTabId)
116 return; 116 return;
117
117 var tabIndex = this._tabbedPane.tabIndex(networkTabId); 118 var tabIndex = this._tabbedPane.tabIndex(networkTabId);
118 var wasSelected = this._currentFile === binding.network; 119 var wasSelected = this._currentFile === binding.network;
119 var fileSystemTabId = this._appendFileTab(binding.fileSystem, false, tabInde x); 120 var fileSystemTabId = this._appendFileTab(binding.fileSystem, false, tabInde x);
120 this._updateHistory(); 121 this._updateHistory();
121 122
122 if (wasSelected) 123 if (wasSelected)
123 this._tabbedPane.selectTab(fileSystemTabId, false); 124 this._tabbedPane.selectTab(fileSystemTabId, false);
124 125
125 var fileSystemTabView = /** @type {!WebInspector.Widget} */ (this._tabbedPan e.tabView(fileSystemTabId)); 126 var fileSystemTabView = /** @type {!WebInspector.Widget} */ (this._tabbedPan e.tabView(fileSystemTabId));
126 var savedSelectionRange = this._history.selectionRange(binding.network.url() ); 127 var savedSelectionRange = this._history.selectionRange(binding.network.url() );
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 819
819 /** 820 /**
820 * @override 821 * @override
821 * @param {string} tabId 822 * @param {string} tabId
822 * @param {!WebInspector.ContextMenu} contextMenu 823 * @param {!WebInspector.ContextMenu} contextMenu
823 */ 824 */
824 onContextMenu(tabId, contextMenu) { 825 onContextMenu(tabId, contextMenu) {
825 this._editorContainer._onContextMenu(tabId, contextMenu); 826 this._editorContainer._onContextMenu(tabId, contextMenu);
826 } 827 }
827 }; 828 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698