Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1986)

Unified Diff: Source/devtools/front_end/ui/TabbedPane.js

Issue 849073006: DevTools: Implement "close tabs to the right" for Sources panel tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698