Chromium Code Reviews| Index: Source/devtools/front_end/ui/TabbedPane.js |
| diff --git a/Source/devtools/front_end/ui/TabbedPane.js b/Source/devtools/front_end/ui/TabbedPane.js |
| index 7d9130721c8d7d91021e48967c7303a86a4d3511..ec7471ba71cd2463eb9cf68b8316292752cd1d66 100644 |
| --- a/Source/devtools/front_end/ui/TabbedPane.js |
| +++ b/Source/devtools/front_end/ui/TabbedPane.js |
| @@ -315,6 +315,28 @@ WebInspector.TabbedPane.prototype = { |
| /** |
| * @param {string} id |
| + * @return {!Array.<string>} |
| + */ |
| + tabsToTheRight: function(id) |
|
alph
2015/01/15 17:35:17
_tabsToTheRight
lushnikov
2015/01/18 18:17:41
Done.
|
| + { |
| + var tabs = this._tabs.slice(); |
|
alph
2015/01/15 17:35:17
why do you need slice?
lushnikov
2015/01/18 18:17:41
It came due to copy-pasting of other methods; remo
|
| + var index = -1; |
| + for (var i = 0; i < tabs.length; ++i) { |
| + if (tabs[i].id === id) { |
| + index = i; |
| + break; |
| + } |
| + } |
| + if (index === -1) |
| + return []; |
| + var result = []; |
|
alph
2015/01/15 17:35:17
nit:
return tabs.slice(index + 1).map(function(tab
lushnikov
2015/01/18 18:17:41
Done.
|
| + for (var i = index + 1; i < tabs.length; ++i) |
| + result.push(tabs[i].id); |
| + return result; |
| + }, |
| + |
| + /** |
| + * @param {string} id |
| * @param {boolean=} userGesture |
| * @return {boolean} |
| */ |
| @@ -1071,9 +1093,18 @@ WebInspector.TabbedPaneTab.prototype = { |
| this._closeTabs(this._tabbedPane.allTabs()); |
| } |
| + /** |
| + * @this {WebInspector.TabbedPaneTab} |
| + */ |
| + function closeToTheRight() |
| + { |
| + this._closeTabs(this._tabbedPane.tabsToTheRight(this.id)); |
| + } |
| + |
| var contextMenu = new WebInspector.ContextMenu(event); |
| contextMenu.appendItem(WebInspector.UIString.capitalize("Close"), close.bind(this)); |
| contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^others"), closeOthers.bind(this)); |
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^tabs ^to ^the ^right"), closeToTheRight.bind(this)); |
|
alph
2015/01/15 17:35:17
Prepositions and articles should not be capitalize
lushnikov
2015/01/18 18:17:41
Done.
|
| contextMenu.appendItem(WebInspector.UIString.capitalize("Close ^all"), closeAll.bind(this)); |
| contextMenu.show(); |
| }, |