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