OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Sources.FileBasedSearchResultsPane = class extends Sources.SearchResultsPane { | 7 Sources.FileBasedSearchResultsPane = class extends Sources.SearchResultsPane { |
8 /** | 8 /** |
9 * @param {!Workspace.ProjectSearchConfig} searchConfig | 9 * @param {!Workspace.ProjectSearchConfig} searchConfig |
10 */ | 10 */ |
11 constructor(searchConfig) { | 11 constructor(searchConfig) { |
12 super(searchConfig); | 12 super(searchConfig); |
13 | 13 |
14 this._searchResults = []; | 14 this._searchResults = []; |
15 this._treeOutline = new TreeOutlineInShadow(); | 15 this._treeOutline = new UI.TreeOutlineInShadow(); |
16 this._treeOutline.registerRequiredCSS('sources/fileBasedSearchResultsPane.cs
s'); | 16 this._treeOutline.registerRequiredCSS('sources/fileBasedSearchResultsPane.cs
s'); |
17 this.element.appendChild(this._treeOutline.element); | 17 this.element.appendChild(this._treeOutline.element); |
18 | 18 |
19 this._matchesExpandedCount = 0; | 19 this._matchesExpandedCount = 0; |
20 } | 20 } |
21 | 21 |
22 /** | 22 /** |
23 * @override | 23 * @override |
24 * @param {!Sources.FileBasedSearchResult} searchResult | 24 * @param {!Sources.FileBasedSearchResult} searchResult |
25 */ | 25 */ |
(...skipping 17 matching lines...) Expand all Loading... |
43 this._matchesExpandedCount += searchResult.searchMatches.length; | 43 this._matchesExpandedCount += searchResult.searchMatches.length; |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 Sources.FileBasedSearchResultsPane.matchesExpandedByDefaultCount = 20; | 47 Sources.FileBasedSearchResultsPane.matchesExpandedByDefaultCount = 20; |
48 Sources.FileBasedSearchResultsPane.fileMatchesShownAtOnce = 20; | 48 Sources.FileBasedSearchResultsPane.fileMatchesShownAtOnce = 20; |
49 | 49 |
50 /** | 50 /** |
51 * @unrestricted | 51 * @unrestricted |
52 */ | 52 */ |
53 Sources.FileBasedSearchResultsPane.FileTreeElement = class extends TreeElement { | 53 Sources.FileBasedSearchResultsPane.FileTreeElement = class extends UI.TreeElemen
t { |
54 /** | 54 /** |
55 * @param {!Workspace.ProjectSearchConfig} searchConfig | 55 * @param {!Workspace.ProjectSearchConfig} searchConfig |
56 * @param {!Sources.FileBasedSearchResult} searchResult | 56 * @param {!Sources.FileBasedSearchResult} searchResult |
57 */ | 57 */ |
58 constructor(searchConfig, searchResult) { | 58 constructor(searchConfig, searchResult) { |
59 super('', true); | 59 super('', true); |
60 this._searchConfig = searchConfig; | 60 this._searchConfig = searchConfig; |
61 this._searchResult = searchResult; | 61 this._searchResult = searchResult; |
62 | 62 |
63 this.toggleOnClick = true; | 63 this.toggleOnClick = true; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 var numberString = numberToStringWithSpacesPadding(lineNumber + 1, 4); | 142 var numberString = numberToStringWithSpacesPadding(lineNumber + 1, 4); |
143 var lineNumberSpan = createElement('span'); | 143 var lineNumberSpan = createElement('span'); |
144 lineNumberSpan.classList.add('search-match-line-number'); | 144 lineNumberSpan.classList.add('search-match-line-number'); |
145 lineNumberSpan.textContent = numberString; | 145 lineNumberSpan.textContent = numberString; |
146 anchor.appendChild(lineNumberSpan); | 146 anchor.appendChild(lineNumberSpan); |
147 | 147 |
148 var contentSpan = this._createContentSpan(lineContent, matchRanges); | 148 var contentSpan = this._createContentSpan(lineContent, matchRanges); |
149 anchor.appendChild(contentSpan); | 149 anchor.appendChild(contentSpan); |
150 | 150 |
151 var searchMatchElement = new TreeElement(); | 151 var searchMatchElement = new UI.TreeElement(); |
152 searchMatchElement.selectable = false; | 152 searchMatchElement.selectable = false; |
153 this.appendChild(searchMatchElement); | 153 this.appendChild(searchMatchElement); |
154 searchMatchElement.listItemElement.className = 'search-match source-code'; | 154 searchMatchElement.listItemElement.className = 'search-match source-code'; |
155 searchMatchElement.listItemElement.appendChild(anchor); | 155 searchMatchElement.listItemElement.appendChild(anchor); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 /** | 159 /** |
160 * @param {number} startMatchIndex | 160 * @param {number} startMatchIndex |
161 */ | 161 */ |
162 _appendShowMoreMatchesElement(startMatchIndex) { | 162 _appendShowMoreMatchesElement(startMatchIndex) { |
163 var matchesLeftCount = this._searchResult.searchMatches.length - startMatchI
ndex; | 163 var matchesLeftCount = this._searchResult.searchMatches.length - startMatchI
ndex; |
164 var showMoreMatchesText = Common.UIString('Show all matches (%d more).', mat
chesLeftCount); | 164 var showMoreMatchesText = Common.UIString('Show all matches (%d more).', mat
chesLeftCount); |
165 this._showMoreMatchesTreeElement = new TreeElement(showMoreMatchesText); | 165 this._showMoreMatchesTreeElement = new UI.TreeElement(showMoreMatchesText); |
166 this.appendChild(this._showMoreMatchesTreeElement); | 166 this.appendChild(this._showMoreMatchesTreeElement); |
167 this._showMoreMatchesTreeElement.listItemElement.classList.add('show-more-ma
tches'); | 167 this._showMoreMatchesTreeElement.listItemElement.classList.add('show-more-ma
tches'); |
168 this._showMoreMatchesTreeElement.onselect = this._showMoreMatchesElementSele
cted.bind(this, startMatchIndex); | 168 this._showMoreMatchesTreeElement.onselect = this._showMoreMatchesElementSele
cted.bind(this, startMatchIndex); |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * @param {!Workspace.UISourceCode} uiSourceCode | 172 * @param {!Workspace.UISourceCode} uiSourceCode |
173 * @param {number} lineNumber | 173 * @param {number} lineNumber |
174 * @param {number} columnNumber | 174 * @param {number} columnNumber |
175 * @return {!Element} | 175 * @return {!Element} |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 /** | 208 /** |
209 * @param {number} startMatchIndex | 209 * @param {number} startMatchIndex |
210 * @return {boolean} | 210 * @return {boolean} |
211 */ | 211 */ |
212 _showMoreMatchesElementSelected(startMatchIndex) { | 212 _showMoreMatchesElementSelected(startMatchIndex) { |
213 this.removeChild(this._showMoreMatchesTreeElement); | 213 this.removeChild(this._showMoreMatchesTreeElement); |
214 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatches.
length); | 214 this._appendSearchMatches(startMatchIndex, this._searchResult.searchMatches.
length); |
215 return false; | 215 return false; |
216 } | 216 } |
217 }; | 217 }; |
OLD | NEW |