Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 Sources.OpenFileQuickOpen = class extends Sources.FilteredUISourceCodeListProvid er { |
| 8 * @unrestricted | |
| 9 */ | |
| 10 Sources.OpenResourceDialog = class extends Sources.FilteredUISourceCodeListProvi der { | |
| 11 /** | 8 /** |
| 12 * @param {!Sources.SourcesView} sourcesView | 9 * @override |
| 13 * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores | |
| 14 */ | 10 */ |
| 15 constructor(sourcesView, defaultScores) { | 11 attach() { |
| 16 super(defaultScores); | 12 this.setDefaultScores(Sources.SourcesView.defaultUISourceCodeScores()); |
|
einbinder
2017/03/08 22:39:57
I removed the caching of providers in QuickOpen.js
| |
| 17 this._sourcesView = sourcesView; | 13 super.attach(); |
| 18 } | 14 } |
| 19 | 15 |
| 20 /** | 16 /** |
| 21 * @param {!Sources.SourcesView} sourcesView | |
| 22 * @param {string} query | |
| 23 * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores | |
| 24 * @param {!Array<string>} history | |
| 25 */ | |
| 26 static show(sourcesView, query, defaultScores, history) { | |
| 27 var dialog = new Sources.OpenResourceDialog(sourcesView, defaultScores); | |
| 28 if (InspectorFrontendHost.isUnderTest()) | |
| 29 Sources.OpenResourceDialog._instanceForTest = dialog; | |
| 30 var filteredItemSelectionDialog = new QuickOpen.FilteredListWidget(dialog, h istory); | |
| 31 filteredItemSelectionDialog.showAsDialog(); | |
| 32 filteredItemSelectionDialog.setQuery(query); | |
| 33 } | |
| 34 | |
| 35 /** | |
| 36 * @override | 17 * @override |
| 37 * @param {?Workspace.UISourceCode} uiSourceCode | 18 * @param {?Workspace.UISourceCode} uiSourceCode |
| 38 * @param {number=} lineNumber | 19 * @param {number=} lineNumber |
| 39 * @param {number=} columnNumber | 20 * @param {number=} columnNumber |
| 40 */ | 21 */ |
| 41 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { | 22 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { |
| 42 Host.userMetrics.actionTaken(Host.UserMetrics.Action.SelectFileFromFilePicke r); | 23 Host.userMetrics.actionTaken(Host.UserMetrics.Action.SelectFileFromFilePicke r); |
| 43 | 24 |
| 44 if (!uiSourceCode) | 25 if (!uiSourceCode) |
| 45 uiSourceCode = this._sourcesView.currentUISourceCode(); | |
| 46 if (!uiSourceCode) | |
| 47 return; | 26 return; |
| 48 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber) ; | 27 Common.Revealer.reveal(uiSourceCode.uiLocation((lineNumber || 0), columnNumb er)); |
| 49 } | 28 } |
| 50 | 29 |
| 51 /** | 30 /** |
| 52 * @override | |
| 53 * @param {string} query | |
| 54 * @return {boolean} | |
| 55 */ | |
| 56 shouldShowMatchingItems(query) { | |
| 57 return !query.startsWith(':'); | |
| 58 } | |
| 59 | |
| 60 /** | |
| 61 * @override | 31 * @override |
| 62 * @param {!Workspace.Project} project | 32 * @param {!Workspace.Project} project |
| 63 * @return {boolean} | 33 * @return {boolean} |
| 64 */ | 34 */ |
| 65 filterProject(project) { | 35 filterProject(project) { |
| 66 return !project.isServiceProject(); | 36 return !project.isServiceProject(); |
| 67 } | 37 } |
| 68 | 38 |
| 69 /** | 39 /** |
| 70 * @override | 40 * @override |
| 71 * @return {boolean} | 41 * @return {boolean} |
| 72 */ | 42 */ |
| 73 renderAsTwoRows() { | 43 renderAsTwoRows() { |
| 74 return true; | 44 return true; |
| 75 } | 45 } |
| 76 }; | 46 }; |
| 77 | 47 |
| 78 | |
| 79 /** | |
| 80 * @unrestricted | |
| 81 */ | |
| 82 Sources.SelectUISourceCodeForProjectTypesDialog = class extends Sources.Filtered UISourceCodeListProvider { | 48 Sources.SelectUISourceCodeForProjectTypesDialog = class extends Sources.Filtered UISourceCodeListProvider { |
| 83 /** | 49 /** |
| 84 * @param {!Array.<string>} types | 50 * @param {!Array.<string>} types |
| 85 * @param {function(?Workspace.UISourceCode)} callback | 51 * @param {function(?Workspace.UISourceCode)} callback |
| 86 */ | 52 */ |
| 87 constructor(types, callback) { | 53 constructor(types, callback) { |
| 88 super(); | 54 super(); |
| 89 this._types = types; | 55 this._types = types; |
| 90 this._callback = callback; | 56 this._callback = callback; |
| 91 } | 57 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 122 } | 88 } |
| 123 | 89 |
| 124 /** | 90 /** |
| 125 * @override | 91 * @override |
| 126 * @return {boolean} | 92 * @return {boolean} |
| 127 */ | 93 */ |
| 128 renderAsTwoRows() { | 94 renderAsTwoRows() { |
| 129 return true; | 95 return true; |
| 130 } | 96 } |
| 131 }; | 97 }; |
| OLD | NEW |