| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 var historyData = this._consoleHistorySetting.get(); | 161 var historyData = this._consoleHistorySetting.get(); |
| 162 this._prompt.history().setHistoryData(historyData); | 162 this._prompt.history().setHistoryData(historyData); |
| 163 this._consoleHistoryAutocompleteChanged(); | 163 this._consoleHistoryAutocompleteChanged(); |
| 164 | 164 |
| 165 this._updateFilterStatus(); | 165 this._updateFilterStatus(); |
| 166 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); | 166 this._timestampsSetting.addChangeListener(this._consoleTimestampsSettingChan
ged, this); |
| 167 | 167 |
| 168 this._registerWithMessageSink(); | 168 this._registerWithMessageSink(); |
| 169 SDK.targetManager.observeTargets(this); | 169 SDK.targetManager.observeTargets(this); |
| 170 | 170 |
| 171 this._initConsoleMessages(); | |
| 172 | |
| 173 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont
extChanged, this); | 171 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont
extChanged, this); |
| 174 | 172 |
| 175 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto
mOnMouseDown.bind(this), false); | 173 this._messagesElement.addEventListener('mousedown', this._updateStickToBotto
mOnMouseDown.bind(this), false); |
| 176 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO
nMouseUp.bind(this), false); | 174 this._messagesElement.addEventListener('mouseup', this._updateStickToBottomO
nMouseUp.bind(this), false); |
| 177 this._messagesElement.addEventListener('mouseleave', this._updateStickToBott
omOnMouseUp.bind(this), false); | 175 this._messagesElement.addEventListener('mouseleave', this._updateStickToBott
omOnMouseUp.bind(this), false); |
| 178 this._messagesElement.addEventListener('wheel', this._updateStickToBottomOnW
heel.bind(this), false); | 176 this._messagesElement.addEventListener('wheel', this._updateStickToBottomOnW
heel.bind(this), false); |
| 179 } | 177 } |
| 180 | 178 |
| 181 /** | 179 /** |
| 182 * @return {!Console.ConsoleView} | 180 * @return {!Console.ConsoleView} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 203 | 201 |
| 204 _clearHistory() { | 202 _clearHistory() { |
| 205 this._consoleHistorySetting.set([]); | 203 this._consoleHistorySetting.set([]); |
| 206 this._prompt.history().setHistoryData([]); | 204 this._prompt.history().setHistoryData([]); |
| 207 } | 205 } |
| 208 | 206 |
| 209 _consoleHistoryAutocompleteChanged() { | 207 _consoleHistoryAutocompleteChanged() { |
| 210 this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSe
tting.get()); | 208 this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSe
tting.get()); |
| 211 } | 209 } |
| 212 | 210 |
| 213 _initConsoleMessages() { | 211 /** |
| 214 var mainTarget = SDK.targetManager.mainTarget(); | 212 * @param {!SDK.Target} target |
| 215 var resourceTreeModel = mainTarget && SDK.ResourceTreeModel.fromTarget(mainT
arget); | 213 */ |
| 216 var resourcesLoaded = !resourceTreeModel || resourceTreeModel.cachedResource
sLoaded(); | 214 _initConsoleMessages(target) { |
| 217 if (!mainTarget || !resourcesLoaded) { | 215 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(target); |
| 218 SDK.targetManager.addModelListener( | 216 if (resourceTreeModel && !resourceTreeModel.cachedResourcesLoaded()) { |
| 219 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.CachedResourcesLoa
ded, this._onResourceTreeModelLoaded, | 217 resourceTreeModel.addEventListener( |
| 220 this); | 218 SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this._onResourceTr
eeModelLoaded, this); |
| 221 return; | 219 return; |
| 222 } | 220 } |
| 223 this._fetchMultitargetMessages(); | 221 this._fetchMultitargetMessages(); |
| 224 } | 222 } |
| 225 | 223 |
| 226 /** | 224 /** |
| 227 * @param {!Common.Event} event | 225 * @param {!Common.Event} event |
| 228 */ | 226 */ |
| 229 _onResourceTreeModelLoaded(event) { | 227 _onResourceTreeModelLoaded(event) { |
| 230 var resourceTreeModel = /** @type {!SDK.ResourceTreeModel} */ (event.data); | 228 var resourceTreeModel = /** @type {!SDK.ResourceTreeModel} */ (event.data); |
| 231 if (resourceTreeModel.target() !== SDK.targetManager.mainTarget()) | 229 resourceTreeModel.removeEventListener( |
| 232 return; | 230 SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this._onResourceTree
ModelLoaded, this); |
| 233 SDK.targetManager.removeModelListener( | |
| 234 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.CachedResourcesLoade
d, this._onResourceTreeModelLoaded, | |
| 235 this); | |
| 236 this._fetchMultitargetMessages(); | 231 this._fetchMultitargetMessages(); |
| 237 } | 232 } |
| 238 | 233 |
| 239 _fetchMultitargetMessages() { | 234 _fetchMultitargetMessages() { |
| 240 SDK.multitargetConsoleModel.addEventListener(SDK.ConsoleModel.Events.Console
Cleared, this._consoleCleared, this); | 235 SDK.multitargetConsoleModel.addEventListener(SDK.ConsoleModel.Events.Console
Cleared, this._consoleCleared, this); |
| 241 SDK.multitargetConsoleModel.addEventListener( | 236 SDK.multitargetConsoleModel.addEventListener( |
| 242 SDK.ConsoleModel.Events.MessageAdded, this._onConsoleMessageAdded, this)
; | 237 SDK.ConsoleModel.Events.MessageAdded, this._onConsoleMessageAdded, this)
; |
| 243 SDK.multitargetConsoleModel.addEventListener( | 238 SDK.multitargetConsoleModel.addEventListener( |
| 244 SDK.ConsoleModel.Events.MessageUpdated, this._onConsoleMessageUpdated, t
his); | 239 SDK.ConsoleModel.Events.MessageUpdated, this._onConsoleMessageUpdated, t
his); |
| 245 SDK.multitargetConsoleModel.addEventListener( | 240 SDK.multitargetConsoleModel.addEventListener( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 */ | 275 */ |
| 281 minimumRowHeight() { | 276 minimumRowHeight() { |
| 282 return 16; | 277 return 16; |
| 283 } | 278 } |
| 284 | 279 |
| 285 /** | 280 /** |
| 286 * @override | 281 * @override |
| 287 * @param {!SDK.Target} target | 282 * @param {!SDK.Target} target |
| 288 */ | 283 */ |
| 289 targetAdded(target) { | 284 targetAdded(target) { |
| 285 if (target === SDK.targetManager.mainTarget()) |
| 286 this._initConsoleMessages(target); |
| 290 this._viewport.invalidate(); | 287 this._viewport.invalidate(); |
| 291 } | 288 } |
| 292 | 289 |
| 293 /** | 290 /** |
| 294 * @override | 291 * @override |
| 295 * @param {!SDK.Target} target | 292 * @param {!SDK.Target} target |
| 296 */ | 293 */ |
| 297 targetRemoved(target) { | 294 targetRemoved(target) { |
| 298 } | 295 } |
| 299 | 296 |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 return true; | 1326 return true; |
| 1330 } | 1327 } |
| 1331 return false; | 1328 return false; |
| 1332 } | 1329 } |
| 1333 }; | 1330 }; |
| 1334 | 1331 |
| 1335 /** | 1332 /** |
| 1336 * @typedef {{messageIndex: number, matchIndex: number}} | 1333 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1337 */ | 1334 */ |
| 1338 Console.ConsoleView.RegexMatchRange; | 1335 Console.ConsoleView.RegexMatchRange; |
| OLD | NEW |