Skip to content

Commit

Permalink
DevTools: Close all sources command
Browse files Browse the repository at this point in the history
Add close all to command search for the sources pane.

BUG=619913

Review-Url: https://codereview.chromium.org/2080893002
Cr-Commit-Position: refs/heads/master@{#402307}
  • Loading branch information
JoelEinbinder authored and Commit bot committed Jun 27, 2016
1 parent 2bf8793 commit 1d09555
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
25 changes: 25 additions & 0 deletions front_end/sources/SourcesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,3 +786,28 @@ WebInspector.SourcesView.SwitchFileActionDelegate.prototype = {
return true;
}
}

/**
* @constructor
* @implements {WebInspector.ActionDelegate}
*/
WebInspector.SourcesView.CloseAllActionDelegate = function()
{
}

WebInspector.SourcesView.CloseAllActionDelegate.prototype = {
/**
* @override
* @param {!WebInspector.Context} context
* @param {string} actionId
* @return {boolean}
*/
handleAction: function(context, actionId)
{
var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView);
if (!sourcesView)
return false;
sourcesView._editorContainer.closeAllFiles();
return true;
}
}
5 changes: 5 additions & 0 deletions front_end/sources/TabbedEditorContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ WebInspector.TabbedEditorContainer.prototype = {
this._closeTabs([tabId]);
},

closeAllFiles: function()
{
this._closeTabs(this._tabbedPane.allTabs());
},

/**
* @return {!Array.<!WebInspector.UISourceCode>}
*/
Expand Down
7 changes: 7 additions & 0 deletions front_end/sources/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@
"persistence": "closeable",
"order": 1000,
"className": "WebInspector.SourcesPanel.WrapperView"
},
{
"type": "@WebInspector.ActionDelegate",
"category": "Sources",
"actionId": "sources.close-all",
"className": "WebInspector.SourcesView.CloseAllActionDelegate",
"title": "Close All"
}
],
"dependencies": [
Expand Down

0 comments on commit 1d09555

Please sign in to comment.