OLD | NEW |
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 this._currentFile = uiSourceCode; | 208 this._currentFile = uiSourceCode; |
209 | 209 |
210 var tabId = this._tabIds.get(uiSourceCode) || this._appendFileTab(uiSour
ceCode, userGesture); | 210 var tabId = this._tabIds.get(uiSourceCode) || this._appendFileTab(uiSour
ceCode, userGesture); |
211 | 211 |
212 this._tabbedPane.selectTab(tabId, userGesture); | 212 this._tabbedPane.selectTab(tabId, userGesture); |
213 if (userGesture) | 213 if (userGesture) |
214 this._editorSelectedByUserAction(); | 214 this._editorSelectedByUserAction(); |
215 | 215 |
216 var previousView = this._currentView; | 216 var previousView = this._currentView; |
217 this._currentView = this.visibleView; | 217 this._currentView = this.visibleView; |
| 218 WebInspector.context.setFlavor(WebInspector.UISourceCodeFrame, this._cur
rentView instanceof WebInspector.UISourceCodeFrame ? this._currentView : null); |
218 this._addViewListeners(); | 219 this._addViewListeners(); |
219 | 220 |
220 var eventData = { | 221 var eventData = { |
221 currentFile: this._currentFile, | 222 currentFile: this._currentFile, |
222 currentView: this._currentView, | 223 currentView: this._currentView, |
223 previousView: previousView, | 224 previousView: previousView, |
224 userGesture: userGesture | 225 userGesture: userGesture |
225 }; | 226 }; |
226 this.dispatchEventToListeners(WebInspector.TabbedEditorContainer.Events.
EditorSelected, eventData); | 227 this.dispatchEventToListeners(WebInspector.TabbedEditorContainer.Events.
EditorSelected, eventData); |
227 }, | 228 }, |
(...skipping 19 matching lines...) Expand all Loading... |
247 { | 248 { |
248 var uiSourceCode = this._files[id]; | 249 var uiSourceCode = this._files[id]; |
249 var shouldPrompt = uiSourceCode.isDirty() && uiSourceCode.project().canS
etFileContent(); | 250 var shouldPrompt = uiSourceCode.isDirty() && uiSourceCode.project().canS
etFileContent(); |
250 // FIXME: this should be replaced with common Save/Discard/Cancel dialog
. | 251 // FIXME: this should be replaced with common Save/Discard/Cancel dialog
. |
251 if (!shouldPrompt || confirm(WebInspector.UIString("Are you sure you wan
t to close unsaved file: %s?", uiSourceCode.name()))) { | 252 if (!shouldPrompt || confirm(WebInspector.UIString("Are you sure you wan
t to close unsaved file: %s?", uiSourceCode.name()))) { |
252 uiSourceCode.resetWorkingCopy(); | 253 uiSourceCode.resetWorkingCopy(); |
253 var previousView = this._currentView; | 254 var previousView = this._currentView; |
254 if (nextTabId) | 255 if (nextTabId) |
255 this._tabbedPane.selectTab(nextTabId, true); | 256 this._tabbedPane.selectTab(nextTabId, true); |
256 this._tabbedPane.closeTab(id, true); | 257 this._tabbedPane.closeTab(id, true); |
| 258 if (WebInspector.context.flavor(WebInspector.UISourceCodeFrame) ===
previousView) |
| 259 WebInspector.context.setFlavor(WebInspector.UISourceCodeFrame, n
ull); |
257 return true; | 260 return true; |
258 } | 261 } |
259 return false; | 262 return false; |
260 }, | 263 }, |
261 | 264 |
262 /** | 265 /** |
263 * @param {!Array.<string>} ids | 266 * @param {!Array.<string>} ids |
264 */ | 267 */ |
265 _closeTabs: function(ids) | 268 _closeTabs: function(ids) |
266 { | 269 { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 /** | 751 /** |
749 * @override | 752 * @override |
750 * @param {string} tabId | 753 * @param {string} tabId |
751 * @param {!WebInspector.ContextMenu} contextMenu | 754 * @param {!WebInspector.ContextMenu} contextMenu |
752 */ | 755 */ |
753 onContextMenu: function(tabId, contextMenu) | 756 onContextMenu: function(tabId, contextMenu) |
754 { | 757 { |
755 this._editorContainer._onContextMenu(tabId, contextMenu); | 758 this._editorContainer._onContextMenu(tabId, contextMenu); |
756 } | 759 } |
757 } | 760 } |
OLD | NEW |