| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.TabbedEditorContainerDelegate} | 7 * @implements {WebInspector.TabbedEditorContainerDelegate} |
| 8 * @implements {WebInspector.Searchable} | 8 * @implements {WebInspector.Searchable} |
| 9 * @implements {WebInspector.Replaceable} | 9 * @implements {WebInspector.Replaceable} |
| 10 * @extends {WebInspector.VBox} | 10 * @extends {WebInspector.VBox} |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 */ | 765 */ |
| 766 function fileNamePrefix(name) | 766 function fileNamePrefix(name) |
| 767 { | 767 { |
| 768 var lastDotIndex = name.lastIndexOf("."); | 768 var lastDotIndex = name.lastIndexOf("."); |
| 769 var namePrefix = name.substr(0, lastDotIndex !== -1 ? lastDotIndex : nam
e.length); | 769 var namePrefix = name.substr(0, lastDotIndex !== -1 ? lastDotIndex : nam
e.length); |
| 770 return namePrefix.toLowerCase(); | 770 return namePrefix.toLowerCase(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 var uiSourceCodes = currentUISourceCode.project().uiSourceCodes(); | 773 var uiSourceCodes = currentUISourceCode.project().uiSourceCodes(); |
| 774 var candidates = []; | 774 var candidates = []; |
| 775 var path = currentUISourceCode.parentPath(); | 775 var url = currentUISourceCode.parentURL(); |
| 776 var name = currentUISourceCode.name(); | 776 var name = currentUISourceCode.name(); |
| 777 var namePrefix = fileNamePrefix(name); | 777 var namePrefix = fileNamePrefix(name); |
| 778 for (var i = 0; i < uiSourceCodes.length; ++i) { | 778 for (var i = 0; i < uiSourceCodes.length; ++i) { |
| 779 var uiSourceCode = uiSourceCodes[i]; | 779 var uiSourceCode = uiSourceCodes[i]; |
| 780 if (path !== uiSourceCode.parentPath()) | 780 if (url !== uiSourceCode.parentURL()) |
| 781 continue; | 781 continue; |
| 782 if (fileNamePrefix(uiSourceCode.name()) === namePrefix) | 782 if (fileNamePrefix(uiSourceCode.name()) === namePrefix) |
| 783 candidates.push(uiSourceCode.name()); | 783 candidates.push(uiSourceCode.name()); |
| 784 } | 784 } |
| 785 candidates.sort(String.naturalOrderComparator); | 785 candidates.sort(String.naturalOrderComparator); |
| 786 var index = mod(candidates.indexOf(name) + 1, candidates.length); | 786 var index = mod(candidates.indexOf(name) + 1, candidates.length); |
| 787 var fullPath = (path ? path + "/" : "") + candidates[index]; | 787 var fullURL = (url ? url + "/" : "") + candidates[index]; |
| 788 var nextUISourceCode = currentUISourceCode.project().uiSourceCode(fullPath); | 788 var nextUISourceCode = currentUISourceCode.project().uiSourceCodeForURL(full
URL); |
| 789 return nextUISourceCode !== currentUISourceCode ? nextUISourceCode : null; | 789 return nextUISourceCode !== currentUISourceCode ? nextUISourceCode : null; |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 WebInspector.SourcesView.SwitchFileActionDelegate.prototype = { | 793 WebInspector.SourcesView.SwitchFileActionDelegate.prototype = { |
| 794 /** | 794 /** |
| 795 * @override | 795 * @override |
| 796 * @param {!WebInspector.Context} context | 796 * @param {!WebInspector.Context} context |
| 797 * @param {string} actionId | 797 * @param {string} actionId |
| 798 * @return {boolean} | 798 * @return {boolean} |
| 799 */ | 799 */ |
| 800 handleAction: function(context, actionId) | 800 handleAction: function(context, actionId) |
| 801 { | 801 { |
| 802 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); | 802 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); |
| 803 var currentUISourceCode = sourcesView.currentUISourceCode(); | 803 var currentUISourceCode = sourcesView.currentUISourceCode(); |
| 804 if (!currentUISourceCode) | 804 if (!currentUISourceCode) |
| 805 return false; | 805 return false; |
| 806 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate
._nextFile(currentUISourceCode); | 806 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate
._nextFile(currentUISourceCode); |
| 807 if (!nextUISourceCode) | 807 if (!nextUISourceCode) |
| 808 return false; | 808 return false; |
| 809 sourcesView.showSourceLocation(nextUISourceCode); | 809 sourcesView.showSourceLocation(nextUISourceCode); |
| 810 return true; | 810 return true; |
| 811 } | 811 } |
| 812 } | 812 } |
| OLD | NEW |