| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 }, | 485 }, |
| 486 | 486 |
| 487 dispose: function() | 487 dispose: function() |
| 488 { | 488 { |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 /** | 492 /** |
| 493 * @constructor | 493 * @constructor |
| 494 * @extends {WebInspector.SelectionDialogContentProvider} | 494 * @extends {WebInspector.SelectionDialogContentProvider} |
| 495 * @param {!WebInspector.View} view | |
| 496 * @param {!WebInspector.UISourceCode} uiSourceCode | 495 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 497 * @param {function(number, number)} selectItemCallback | 496 * @param {function(number, number)} selectItemCallback |
| 498 */ | 497 */ |
| 499 WebInspector.JavaScriptOutlineDialog = function(view, uiSourceCode, selectItemCa
llback) | 498 WebInspector.JavaScriptOutlineDialog = function(uiSourceCode, selectItemCallback
) |
| 500 { | 499 { |
| 501 WebInspector.SelectionDialogContentProvider.call(this); | 500 WebInspector.SelectionDialogContentProvider.call(this); |
| 502 | 501 |
| 503 this._functionItems = []; | 502 this._functionItems = []; |
| 504 this._view = view; | |
| 505 this._selectItemCallback = selectItemCallback; | 503 this._selectItemCallback = selectItemCallback; |
| 506 this._outlineWorker = new Worker("ScriptFormatterWorker.js"); | 504 this._outlineWorker = new Worker("ScriptFormatterWorker.js"); |
| 507 this._outlineWorker.onmessage = this._didBuildOutlineChunk.bind(this); | 505 this._outlineWorker.onmessage = this._didBuildOutlineChunk.bind(this); |
| 508 this._outlineWorker.postMessage({ method: "javaScriptOutline", params: { con
tent: uiSourceCode.workingCopy() } }); | 506 this._outlineWorker.postMessage({ method: "javaScriptOutline", params: { con
tent: uiSourceCode.workingCopy() } }); |
| 509 } | 507 } |
| 510 | 508 |
| 511 /** | 509 /** |
| 512 * @param {!WebInspector.View} view | 510 * @param {!WebInspector.View} view |
| 513 * @param {!WebInspector.UISourceCode} uiSourceCode | 511 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 514 * @param {function(number, number)} selectItemCallback | 512 * @param {function(number, number)} selectItemCallback |
| 515 */ | 513 */ |
| 516 WebInspector.JavaScriptOutlineDialog.show = function(view, uiSourceCode, selectI
temCallback) | 514 WebInspector.JavaScriptOutlineDialog.show = function(view, uiSourceCode, selectI
temCallback) |
| 517 { | 515 { |
| 518 if (WebInspector.Dialog.currentInstance()) | 516 if (WebInspector.Dialog.currentInstance()) |
| 519 return null; | 517 return null; |
| 520 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.JavaScriptOutlineDialog(view, uiSourceCode, selectItemCallba
ck)); | 518 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.JavaScriptOutlineDialog(uiSourceCode, selectItemCallback)); |
| 521 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); | 519 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); |
| 522 } | 520 } |
| 523 | 521 |
| 524 WebInspector.JavaScriptOutlineDialog.prototype = { | 522 WebInspector.JavaScriptOutlineDialog.prototype = { |
| 525 /** | 523 /** |
| 526 * @param {!MessageEvent} event | 524 * @param {!MessageEvent} event |
| 527 */ | 525 */ |
| 528 _didBuildOutlineChunk: function(event) | 526 _didBuildOutlineChunk: function(event) |
| 529 { | 527 { |
| 530 var data = /** @type {!WebInspector.JavaScriptOutlineDialog.MessageEvent
Data} */ (event.data); | 528 var data = /** @type {!WebInspector.JavaScriptOutlineDialog.MessageEvent
Data} */ (event.data); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 { | 759 { |
| 762 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events
.UISourceCodeAdded, this._uiSourceCodeAdded, this); | 760 WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events
.UISourceCodeAdded, this._uiSourceCodeAdded, this); |
| 763 }, | 761 }, |
| 764 | 762 |
| 765 __proto__: WebInspector.SelectionDialogContentProvider.prototype | 763 __proto__: WebInspector.SelectionDialogContentProvider.prototype |
| 766 } | 764 } |
| 767 | 765 |
| 768 /** | 766 /** |
| 769 * @constructor | 767 * @constructor |
| 770 * @extends {WebInspector.SelectUISourceCodeDialog} | 768 * @extends {WebInspector.SelectUISourceCodeDialog} |
| 771 * @param {!WebInspector.SourcesPanel} panel | 769 * @param {!WebInspector.SourcesEditor} sourcesEditor |
| 772 * @param {!Map.<!WebInspector.UISourceCode, number>=} defaultScores | 770 * @param {!Map.<!WebInspector.UISourceCode, number>=} defaultScores |
| 773 */ | 771 */ |
| 774 WebInspector.OpenResourceDialog = function(panel, defaultScores) | 772 WebInspector.OpenResourceDialog = function(sourcesEditor, defaultScores) |
| 775 { | 773 { |
| 776 WebInspector.SelectUISourceCodeDialog.call(this, defaultScores); | 774 WebInspector.SelectUISourceCodeDialog.call(this, defaultScores); |
| 777 this._panel = panel; | 775 this._sourcesEditor = sourcesEditor; |
| 778 } | 776 } |
| 779 | 777 |
| 780 WebInspector.OpenResourceDialog.prototype = { | 778 WebInspector.OpenResourceDialog.prototype = { |
| 781 | 779 |
| 782 /** | 780 /** |
| 783 * @param {?WebInspector.UISourceCode} uiSourceCode | 781 * @param {?WebInspector.UISourceCode} uiSourceCode |
| 784 * @param {number=} lineNumber | 782 * @param {number=} lineNumber |
| 785 * @param {number=} columnNumber | 783 * @param {number=} columnNumber |
| 786 */ | 784 */ |
| 787 uiSourceCodeSelected: function(uiSourceCode, lineNumber, columnNumber) | 785 uiSourceCodeSelected: function(uiSourceCode, lineNumber, columnNumber) |
| 788 { | 786 { |
| 789 if (!uiSourceCode) | 787 if (!uiSourceCode) |
| 790 uiSourceCode = this._panel.currentUISourceCode(); | 788 uiSourceCode = this._sourcesEditor.currentUISourceCode(); |
| 791 if (!uiSourceCode) | 789 if (!uiSourceCode) |
| 792 return; | 790 return; |
| 793 this._panel.showUISourceCode(uiSourceCode, lineNumber, columnNumber); | 791 this._sourcesEditor.showSourceLocation(uiSourceCode, lineNumber, columnN
umber); |
| 794 }, | 792 }, |
| 795 | 793 |
| 796 /** | 794 /** |
| 797 * @param {string} query | 795 * @param {string} query |
| 798 * @return {boolean} | 796 * @return {boolean} |
| 799 */ | 797 */ |
| 800 shouldShowMatchingItems: function(query) | 798 shouldShowMatchingItems: function(query) |
| 801 { | 799 { |
| 802 return !query.startsWith(":"); | 800 return !query.startsWith(":"); |
| 803 }, | 801 }, |
| 804 | 802 |
| 805 /** | 803 /** |
| 806 * @param {!WebInspector.Project} project | 804 * @param {!WebInspector.Project} project |
| 807 * @return {boolean} | 805 * @return {boolean} |
| 808 */ | 806 */ |
| 809 filterProject: function(project) | 807 filterProject: function(project) |
| 810 { | 808 { |
| 811 return !project.isServiceProject(); | 809 return !project.isServiceProject(); |
| 812 }, | 810 }, |
| 813 | 811 |
| 814 __proto__: WebInspector.SelectUISourceCodeDialog.prototype | 812 __proto__: WebInspector.SelectUISourceCodeDialog.prototype |
| 815 } | 813 } |
| 816 | 814 |
| 817 /** | 815 /** |
| 818 * @param {!WebInspector.SourcesPanel} panel | 816 * @param {!WebInspector.SourcesEditor} sourcesEditor |
| 819 * @param {!Element} relativeToElement | 817 * @param {!Element} relativeToElement |
| 820 * @param {string=} query | 818 * @param {string=} query |
| 821 * @param {!Map.<!WebInspector.UISourceCode, number>=} defaultScores | 819 * @param {!Map.<!WebInspector.UISourceCode, number>=} defaultScores |
| 822 */ | 820 */ |
| 823 WebInspector.OpenResourceDialog.show = function(panel, relativeToElement, query,
defaultScores) | 821 WebInspector.OpenResourceDialog.show = function(sourcesEditor, relativeToElement
, query, defaultScores) |
| 824 { | 822 { |
| 825 if (WebInspector.Dialog.currentInstance()) | 823 if (WebInspector.Dialog.currentInstance()) |
| 826 return; | 824 return; |
| 827 | 825 |
| 828 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.OpenResourceDialog(panel, defaultScores)); | 826 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.OpenResourceDialog(sourcesEditor, defaultScores)); |
| 829 filteredItemSelectionDialog.renderAsTwoRows(); | 827 filteredItemSelectionDialog.renderAsTwoRows(); |
| 830 if (query) | 828 if (query) |
| 831 filteredItemSelectionDialog.setQuery(query); | 829 filteredItemSelectionDialog.setQuery(query); |
| 832 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); | 830 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); |
| 833 } | 831 } |
| 834 | 832 |
| 835 /** | 833 /** |
| 836 * @constructor | 834 * @constructor |
| 837 * @extends {WebInspector.SelectUISourceCodeDialog} | 835 * @extends {WebInspector.SelectUISourceCodeDialog} |
| 838 * @param {string} type | 836 * @param {string} type |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type, callback)); | 879 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type, callback)); |
| 882 filteredItemSelectionDialog.setQuery(name); | 880 filteredItemSelectionDialog.setQuery(name); |
| 883 filteredItemSelectionDialog.renderAsTwoRows(); | 881 filteredItemSelectionDialog.renderAsTwoRows(); |
| 884 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); | 882 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); |
| 885 } | 883 } |
| 886 | 884 |
| 887 /** | 885 /** |
| 888 * @typedef {{index: number, total: number, chunk: !Array.<!{selectorText: strin
g, lineNumber: number, columnNumber: number}>}} | 886 * @typedef {{index: number, total: number, chunk: !Array.<!{selectorText: strin
g, lineNumber: number, columnNumber: number}>}} |
| 889 */ | 887 */ |
| 890 WebInspector.JavaScriptOutlineDialog.MessageEventData; | 888 WebInspector.JavaScriptOutlineDialog.MessageEventData; |
| OLD | NEW |