| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 dispose: function() | 476 dispose: function() |
| 477 { | 477 { |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 /** | 481 /** |
| 482 * @constructor | 482 * @constructor |
| 483 * @extends {WebInspector.SelectionDialogContentProvider} | 483 * @extends {WebInspector.SelectionDialogContentProvider} |
| 484 * @param {WebInspector.View} view | 484 * @param {WebInspector.View} view |
| 485 * @param {WebInspector.ContentProvider} contentProvider | 485 * @param {WebInspector.ContentProvider} contentProvider |
| 486 * @param {function(number, number)} selectItemCallback |
| 486 */ | 487 */ |
| 487 WebInspector.JavaScriptOutlineDialog = function(view, contentProvider) | 488 WebInspector.JavaScriptOutlineDialog = function(view, contentProvider, selectIte
mCallback) |
| 488 { | 489 { |
| 489 WebInspector.SelectionDialogContentProvider.call(this); | 490 WebInspector.SelectionDialogContentProvider.call(this); |
| 490 | 491 |
| 491 this._functionItems = []; | 492 this._functionItems = []; |
| 492 this._view = view; | 493 this._view = view; |
| 494 this._selectItemCallback = selectItemCallback; |
| 493 contentProvider.requestContent(this._contentAvailable.bind(this)); | 495 contentProvider.requestContent(this._contentAvailable.bind(this)); |
| 494 } | 496 } |
| 495 | 497 |
| 496 /** | 498 /** |
| 497 * @param {WebInspector.View} view | 499 * @param {WebInspector.View} view |
| 498 * @param {WebInspector.ContentProvider} contentProvider | 500 * @param {WebInspector.ContentProvider} contentProvider |
| 501 * @param {function(number, number)} selectItemCallback |
| 499 */ | 502 */ |
| 500 WebInspector.JavaScriptOutlineDialog.show = function(view, contentProvider) | 503 WebInspector.JavaScriptOutlineDialog.show = function(view, contentProvider, sele
ctItemCallback) |
| 501 { | 504 { |
| 502 if (WebInspector.Dialog.currentInstance()) | 505 if (WebInspector.Dialog.currentInstance()) |
| 503 return null; | 506 return null; |
| 504 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.JavaScriptOutlineDialog(view, contentProvider)); | 507 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.JavaScriptOutlineDialog(view, contentProvider, selectItemCal
lback)); |
| 505 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); | 508 WebInspector.Dialog.show(view.element, filteredItemSelectionDialog); |
| 506 } | 509 } |
| 507 | 510 |
| 508 WebInspector.JavaScriptOutlineDialog.prototype = { | 511 WebInspector.JavaScriptOutlineDialog.prototype = { |
| 509 /** | 512 /** |
| 510 * @param {?string} content | 513 * @param {?string} content |
| 511 */ | 514 */ |
| 512 _contentAvailable: function(content) | 515 _contentAvailable: function(content) |
| 513 { | 516 { |
| 514 this._outlineWorker = new Worker("ScriptFormatterWorker.js"); | 517 this._outlineWorker = new Worker("ScriptFormatterWorker.js"); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 }, | 576 }, |
| 574 | 577 |
| 575 /** | 578 /** |
| 576 * @param {number} itemIndex | 579 * @param {number} itemIndex |
| 577 * @param {string} promptValue | 580 * @param {string} promptValue |
| 578 */ | 581 */ |
| 579 selectItem: function(itemIndex, promptValue) | 582 selectItem: function(itemIndex, promptValue) |
| 580 { | 583 { |
| 581 var lineNumber = this._functionItems[itemIndex].line; | 584 var lineNumber = this._functionItems[itemIndex].line; |
| 582 if (!isNaN(lineNumber) && lineNumber >= 0) | 585 if (!isNaN(lineNumber) && lineNumber >= 0) |
| 583 this._view.highlightPosition(lineNumber, this._functionItems[itemInd
ex].column); | 586 this._selectItemCallback(lineNumber, this._functionItems[itemIndex].
column); |
| 584 this._view.focus(); | |
| 585 }, | 587 }, |
| 586 | 588 |
| 587 dispose: function() | 589 dispose: function() |
| 588 { | 590 { |
| 589 if (this._outlineWorker) { | 591 if (this._outlineWorker) { |
| 590 this._outlineWorker.terminate(); | 592 this._outlineWorker.terminate(); |
| 591 delete this._outlineWorker; | 593 delete this._outlineWorker; |
| 592 } | 594 } |
| 593 }, | 595 }, |
| 594 | 596 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 WebInspector.SelectUISourceCodeForProjectTypeDialog.show = function(name, type,
callback, relativeToElement) | 859 WebInspector.SelectUISourceCodeForProjectTypeDialog.show = function(name, type,
callback, relativeToElement) |
| 858 { | 860 { |
| 859 if (WebInspector.Dialog.currentInstance()) | 861 if (WebInspector.Dialog.currentInstance()) |
| 860 return; | 862 return; |
| 861 | 863 |
| 862 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type, callback)); | 864 var filteredItemSelectionDialog = new WebInspector.FilteredItemSelectionDial
og(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type, callback)); |
| 863 filteredItemSelectionDialog.setQuery(name); | 865 filteredItemSelectionDialog.setQuery(name); |
| 864 filteredItemSelectionDialog.renderAsTwoRows(); | 866 filteredItemSelectionDialog.renderAsTwoRows(); |
| 865 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); | 867 WebInspector.Dialog.show(relativeToElement, filteredItemSelectionDialog); |
| 866 } | 868 } |
| OLD | NEW |