OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
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 * 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 | 454 |
455 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets) | 455 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets) |
456 this._runSnippetButton.element.removeStyleClass("hidden"); | 456 this._runSnippetButton.element.removeStyleClass("hidden"); |
457 else | 457 else |
458 this._runSnippetButton.element.addStyleClass("hidden"); | 458 this._runSnippetButton.element.addStyleClass("hidden"); |
459 | 459 |
460 return sourceFrame; | 460 return sourceFrame; |
461 }, | 461 }, |
462 | 462 |
463 /** | 463 /** |
464 * @param {WebInspector.TextEditorPositionHandle} from | |
465 * @param {WebInspector.TextEditorPositionHandle} to | |
466 */ | |
467 _onJumpToPosition: function(uiSourceCode, from, to) | |
468 { | |
469 if (this._searchQuery) | |
vsevik
2013/09/04 09:46:22
Please extract all jump specific logic to a separa
lushnikov
2014/01/02 14:06:09
Done.
| |
470 return; | |
471 var fromEntry = from ? new WebInspector.ScriptsPanelJumpHistoryEntry(thi s, uiSourceCode, from) : null; | |
472 var toEntry = to ? new WebInspector.ScriptsPanelJumpHistoryEntry(this, u iSourceCode, to) : null; | |
473 WebInspector.jumpHistoryManager.jumpToPosition(fromEntry, toEntry); | |
474 }, | |
475 | |
476 /** | |
464 * @param {WebInspector.UISourceCode} uiSourceCode | 477 * @param {WebInspector.UISourceCode} uiSourceCode |
465 * @return {WebInspector.SourceFrame} | 478 * @return {WebInspector.SourceFrame} |
466 */ | 479 */ |
467 _createSourceFrame: function(uiSourceCode) | 480 _createSourceFrame: function(uiSourceCode) |
468 { | 481 { |
469 var sourceFrame; | 482 var sourceFrame; |
470 switch (uiSourceCode.contentType()) { | 483 switch (uiSourceCode.contentType()) { |
471 case WebInspector.resourceTypes.Script: | 484 case WebInspector.resourceTypes.Script: |
472 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC ode); | 485 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC ode); |
473 break; | 486 break; |
474 case WebInspector.resourceTypes.Document: | 487 case WebInspector.resourceTypes.Document: |
475 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC ode); | 488 sourceFrame = new WebInspector.JavaScriptSourceFrame(this, uiSourceC ode); |
476 break; | 489 break; |
477 case WebInspector.resourceTypes.Stylesheet: | 490 case WebInspector.resourceTypes.Stylesheet: |
478 default: | 491 default: |
479 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); | 492 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); |
480 break; | 493 break; |
481 } | 494 } |
482 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); | 495 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); |
496 sourceFrame.setJumpToPositionDelegate(this._onJumpToPosition.bind(this, uiSourceCode)); | |
483 return sourceFrame; | 497 return sourceFrame; |
484 }, | 498 }, |
485 | 499 |
486 /** | 500 /** |
487 * @param {WebInspector.UISourceCode} uiSourceCode | 501 * @param {WebInspector.UISourceCode} uiSourceCode |
488 * @return {WebInspector.SourceFrame} | 502 * @return {WebInspector.SourceFrame} |
489 */ | 503 */ |
490 _getOrCreateSourceFrame: function(uiSourceCode) | 504 _getOrCreateSourceFrame: function(uiSourceCode) |
491 { | 505 { |
492 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode); | 506 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 }, | 573 }, |
560 | 574 |
561 _editorClosed: function(event) | 575 _editorClosed: function(event) |
562 { | 576 { |
563 this._navigatorController.hideNavigatorOverlay(); | 577 this._navigatorController.hideNavigatorOverlay(); |
564 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data) ; | 578 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data) ; |
565 | 579 |
566 if (this._currentUISourceCode === uiSourceCode) | 580 if (this._currentUISourceCode === uiSourceCode) |
567 delete this._currentUISourceCode; | 581 delete this._currentUISourceCode; |
568 | 582 |
583 function historyFilter(projectId, path, entry) | |
584 { | |
585 if (!(entry instanceof WebInspector.ScriptsPanelJumpHistoryEntry)) | |
586 return false; | |
587 return entry._path === path && entry._projectId === projectId; | |
588 } | |
589 WebInspector.jumpHistoryManager.filterHistoryEntries(historyFilter.bind( this, uiSourceCode.project().id(), uiSourceCode.path())); | |
569 // ScriptsNavigator does not need to update on EditorClosed. | 590 // ScriptsNavigator does not need to update on EditorClosed. |
570 this._updateScriptViewStatusBarItems(); | 591 this._updateScriptViewStatusBarItems(); |
571 WebInspector.searchController.resetSearch(); | 592 WebInspector.searchController.resetSearch(); |
572 }, | 593 }, |
573 | 594 |
574 _editorSelected: function(event) | 595 _editorSelected: function(event) |
575 { | 596 { |
576 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data) ; | 597 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ (event.data) ; |
577 var sourceFrame = this._showFile(uiSourceCode); | 598 var sourceFrame = this._showFile(uiSourceCode); |
578 this._navigatorController.hideNavigatorOverlay(); | 599 this._navigatorController.hideNavigatorOverlay(); |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1440 } else { | 1461 } else { |
1441 this._editorFooterElement.addStyleClass("hidden"); | 1462 this._editorFooterElement.addStyleClass("hidden"); |
1442 this._editorFooterElement.removeChildren(); | 1463 this._editorFooterElement.removeChildren(); |
1443 this._editorContentsElement.style.bottom = 0; | 1464 this._editorContentsElement.style.bottom = 0; |
1444 } | 1465 } |
1445 this.doResize(); | 1466 this.doResize(); |
1446 }, | 1467 }, |
1447 | 1468 |
1448 __proto__: WebInspector.Panel.prototype | 1469 __proto__: WebInspector.Panel.prototype |
1449 } | 1470 } |
1471 | |
1472 /** | |
1473 * @constructor | |
1474 * @implements {WebInspector.JumpHistoryEntry} | |
1475 * @param {WebInspector.ScriptsPanel} scriptsPanel | |
1476 * @param {WebInspector.UISourceCode} uiSourceCode | |
1477 * @param {WebInspector.TextEditorPositionHandle} position | |
1478 */ | |
1479 WebInspector.ScriptsPanelJumpHistoryEntry = function(scriptsPanel, uiSourceCode, position) | |
1480 { | |
1481 this._scriptsPanel = scriptsPanel; | |
1482 this._projectId = uiSourceCode.project().id(); | |
1483 this._path = uiSourceCode.path(); | |
1484 this._position = position; | |
1485 } | |
1486 | |
1487 WebInspector.ScriptsPanelJumpHistoryEntry.prototype = { | |
1488 /** | |
1489 * @return {boolean} | |
1490 */ | |
1491 valid: function() | |
1492 { | |
1493 return !!this._position.resolve(); | |
1494 }, | |
1495 | |
1496 /** | |
1497 * @param {WebInspector.JumpHistoryEntry} entry | |
1498 */ | |
1499 merge: function(entry) | |
1500 { | |
1501 if (!(entry instanceof WebInspector.ScriptsPanelJumpHistoryEntry)) | |
1502 return; | |
1503 if (entry._projectId === this._projectId && entry._path === this._path) | |
1504 this._position = entry._position; | |
1505 }, | |
1506 | |
1507 /** | |
1508 * @return {boolean} | |
1509 */ | |
1510 reveal: function() | |
1511 { | |
1512 if (!this._scriptsPanel.isShowing()) | |
1513 WebInspector.inspectorView.setCurrentPanel(this._scriptsPanel); | |
1514 var position = this._position.resolve(); | |
1515 var uiSourceCode = WebInspector.workspace.project(this._projectId).uiSou rceCode(this._path); | |
1516 this._scriptsPanel._showSourceLocation(uiSourceCode, position.lineNumber , position.columnNumber); | |
1517 return true; | |
1518 }, | |
1519 | |
1520 /** | |
1521 * @param {WebInspector.JumpHistoryEntry} entry | |
1522 */ | |
1523 equal: function(entry) | |
1524 { | |
1525 if (!(entry instanceof WebInspector.ScriptsPanelJumpHistoryEntry)) | |
1526 return false; | |
1527 return entry._projectId === this._projectId && entry._path === this._pat h && entry._position.equal(this._position); | |
1528 } | |
1529 } | |
OLD | NEW |