| 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 /** |
| 8 * @unrestricted | 8 * @unrestricted |
| 9 */ | 9 */ |
| 10 WebInspector.OpenResourceDialog = class extends WebInspector.FilteredUISourceCod
eListDelegate { | 10 Sources.OpenResourceDialog = class extends Sources.FilteredUISourceCodeListDeleg
ate { |
| 11 /** | 11 /** |
| 12 * @param {!WebInspector.SourcesView} sourcesView | 12 * @param {!Sources.SourcesView} sourcesView |
| 13 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores | 13 * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores |
| 14 * @param {!Array<string>} history | 14 * @param {!Array<string>} history |
| 15 */ | 15 */ |
| 16 constructor(sourcesView, defaultScores, history) { | 16 constructor(sourcesView, defaultScores, history) { |
| 17 super(defaultScores, history); | 17 super(defaultScores, history); |
| 18 this._sourcesView = sourcesView; | 18 this._sourcesView = sourcesView; |
| 19 this.populate(); | 19 this.populate(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * @param {!WebInspector.SourcesView} sourcesView | 23 * @param {!Sources.SourcesView} sourcesView |
| 24 * @param {string} query | 24 * @param {string} query |
| 25 * @param {!Map.<!WebInspector.UISourceCode, number>} defaultScores | 25 * @param {!Map.<!Workspace.UISourceCode, number>} defaultScores |
| 26 * @param {!Array<string>} history | 26 * @param {!Array<string>} history |
| 27 */ | 27 */ |
| 28 static show(sourcesView, query, defaultScores, history) { | 28 static show(sourcesView, query, defaultScores, history) { |
| 29 WebInspector.OpenResourceDialog._instanceForTest = | 29 Sources.OpenResourceDialog._instanceForTest = |
| 30 new WebInspector.OpenResourceDialog(sourcesView, defaultScores, history)
; | 30 new Sources.OpenResourceDialog(sourcesView, defaultScores, history); |
| 31 var filteredItemSelectionDialog = | 31 var filteredItemSelectionDialog = |
| 32 new WebInspector.FilteredListWidget(WebInspector.OpenResourceDialog._ins
tanceForTest); | 32 new UI.FilteredListWidget(Sources.OpenResourceDialog._instanceForTest); |
| 33 filteredItemSelectionDialog.showAsDialog(); | 33 filteredItemSelectionDialog.showAsDialog(); |
| 34 filteredItemSelectionDialog.setQuery(query); | 34 filteredItemSelectionDialog.setQuery(query); |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @override | 38 * @override |
| 39 * @param {?WebInspector.UISourceCode} uiSourceCode | 39 * @param {?Workspace.UISourceCode} uiSourceCode |
| 40 * @param {number=} lineNumber | 40 * @param {number=} lineNumber |
| 41 * @param {number=} columnNumber | 41 * @param {number=} columnNumber |
| 42 */ | 42 */ |
| 43 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { | 43 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { |
| 44 if (!uiSourceCode) | 44 if (!uiSourceCode) |
| 45 uiSourceCode = this._sourcesView.currentUISourceCode(); | 45 uiSourceCode = this._sourcesView.currentUISourceCode(); |
| 46 if (!uiSourceCode) | 46 if (!uiSourceCode) |
| 47 return; | 47 return; |
| 48 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber)
; | 48 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNumber)
; |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * @override | 52 * @override |
| 53 * @param {string} query | 53 * @param {string} query |
| 54 * @return {boolean} | 54 * @return {boolean} |
| 55 */ | 55 */ |
| 56 shouldShowMatchingItems(query) { | 56 shouldShowMatchingItems(query) { |
| 57 return !query.startsWith(':'); | 57 return !query.startsWith(':'); |
| 58 } | 58 } |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * @override | 61 * @override |
| 62 * @param {!WebInspector.Project} project | 62 * @param {!Workspace.Project} project |
| 63 * @return {boolean} | 63 * @return {boolean} |
| 64 */ | 64 */ |
| 65 filterProject(project) { | 65 filterProject(project) { |
| 66 return !WebInspector.Project.isServiceProject(project); | 66 return !Workspace.Project.isServiceProject(project); |
| 67 } | 67 } |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * @override | 70 * @override |
| 71 * @return {boolean} | 71 * @return {boolean} |
| 72 */ | 72 */ |
| 73 renderAsTwoRows() { | 73 renderAsTwoRows() { |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * @unrestricted | 80 * @unrestricted |
| 81 */ | 81 */ |
| 82 WebInspector.SelectUISourceCodeForProjectTypesDialog = class extends WebInspecto
r.FilteredUISourceCodeListDelegate { | 82 Sources.SelectUISourceCodeForProjectTypesDialog = class extends Sources.Filtered
UISourceCodeListDelegate { |
| 83 /** | 83 /** |
| 84 * @param {!Array.<string>} types | 84 * @param {!Array.<string>} types |
| 85 * @param {function(?WebInspector.UISourceCode)} callback | 85 * @param {function(?Workspace.UISourceCode)} callback |
| 86 */ | 86 */ |
| 87 constructor(types, callback) { | 87 constructor(types, callback) { |
| 88 super(); | 88 super(); |
| 89 this._types = types; | 89 this._types = types; |
| 90 this._callback = callback; | 90 this._callback = callback; |
| 91 this.populate(); | 91 this.populate(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * @param {string} name | 95 * @param {string} name |
| 96 * @param {!Array.<string>} types | 96 * @param {!Array.<string>} types |
| 97 * @param {function(?WebInspector.UISourceCode)} callback | 97 * @param {function(?Workspace.UISourceCode)} callback |
| 98 */ | 98 */ |
| 99 static show(name, types, callback) { | 99 static show(name, types, callback) { |
| 100 var filteredItemSelectionDialog = | 100 var filteredItemSelectionDialog = |
| 101 new WebInspector.FilteredListWidget(new WebInspector.SelectUISourceCodeF
orProjectTypesDialog(types, callback)); | 101 new UI.FilteredListWidget(new Sources.SelectUISourceCodeForProjectTypesD
ialog(types, callback)); |
| 102 filteredItemSelectionDialog.showAsDialog(); | 102 filteredItemSelectionDialog.showAsDialog(); |
| 103 filteredItemSelectionDialog.setQuery(name); | 103 filteredItemSelectionDialog.setQuery(name); |
| 104 } | 104 } |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * @override | 107 * @override |
| 108 * @param {?WebInspector.UISourceCode} uiSourceCode | 108 * @param {?Workspace.UISourceCode} uiSourceCode |
| 109 * @param {number=} lineNumber | 109 * @param {number=} lineNumber |
| 110 * @param {number=} columnNumber | 110 * @param {number=} columnNumber |
| 111 */ | 111 */ |
| 112 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { | 112 uiSourceCodeSelected(uiSourceCode, lineNumber, columnNumber) { |
| 113 this._callback(uiSourceCode); | 113 this._callback(uiSourceCode); |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * @override | 117 * @override |
| 118 * @param {!WebInspector.Project} project | 118 * @param {!Workspace.Project} project |
| 119 * @return {boolean} | 119 * @return {boolean} |
| 120 */ | 120 */ |
| 121 filterProject(project) { | 121 filterProject(project) { |
| 122 return this._types.indexOf(project.type()) !== -1; | 122 return this._types.indexOf(project.type()) !== -1; |
| 123 } | 123 } |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * @override | 126 * @override |
| 127 * @return {boolean} | 127 * @return {boolean} |
| 128 */ | 128 */ |
| 129 renderAsTwoRows() { | 129 renderAsTwoRows() { |
| 130 return true; | 130 return true; |
| 131 } | 131 } |
| 132 }; | 132 }; |
| OLD | NEW |