Commit 7d2cbcf1 authored by luoe's avatar luoe Committed by Commit bot

DevTools: add command menu entries for adding new snippet, workspace folder

BUG=718185

Review-Url: https://codereview.chromium.org/2859533004
Cr-Commit-Position: refs/heads/master@{#469496}
parent 58d8871f
...@@ -277,3 +277,27 @@ Sources.SnippetsNavigatorView = class extends Sources.NavigatorView { ...@@ -277,3 +277,27 @@ Sources.SnippetsNavigatorView = class extends Sources.NavigatorView {
this._handleRemoveSnippet(uiSourceCode); this._handleRemoveSnippet(uiSourceCode);
} }
}; };
/**
* @implements {UI.ActionDelegate}
*/
Sources.SourcesNavigatorView.CreatingActionDelegate = class {
/**
* @override
* @param {!UI.Context} context
* @param {string} actionId
* @return {boolean}
*/
handleAction(context, actionId) {
switch (actionId) {
case 'sources.create-snippet':
var uiSourceCode = Snippets.scriptSnippetModel.createScriptSnippet('');
Common.Revealer.reveal(uiSourceCode);
return true;
case 'sources.add-folder-to-workspace':
Workspace.isolatedFileSystemManager.addFileSystem();
return true;
}
return false;
}
};
...@@ -495,6 +495,20 @@ ...@@ -495,6 +495,20 @@
"className": "Sources.SourcesView.CloseAllActionDelegate", "className": "Sources.SourcesView.CloseAllActionDelegate",
"title": "Close All" "title": "Close All"
}, },
{
"type": "@UI.ActionDelegate",
"category": "Sources",
"actionId": "sources.create-snippet",
"className": "Sources.SourcesNavigatorView.CreatingActionDelegate",
"title": "Create new snippet"
},
{
"type": "@UI.ActionDelegate",
"category": "Sources",
"actionId": "sources.add-folder-to-workspace",
"className": "Sources.SourcesNavigatorView.CreatingActionDelegate",
"title": "Add folder to workspace"
},
{ {
"type": "@UI.ViewLocationResolver", "type": "@UI.ViewLocationResolver",
"name": "navigator-view", "name": "navigator-view",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment