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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 2716683006: DevTools: add entry points for command menu (Closed)
Patch Set: ac Created 3 years, 8 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
Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
index 1736ddc220bfff57deb3b6a4b1320226d6b179fc..13db19a9cb4232de4c69aa65085ea0ed43863765 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
@@ -26,12 +26,8 @@ Sources.SourcesView = class extends UI.VBox {
/** @type {!Map.<!Workspace.UISourceCode, !UI.Widget>} */
this._sourceViewByUISourceCode = new Map();
- var tabbedEditorPlaceholderText =
- Host.isMac() ? Common.UIString('Hit \u2318+P to open a file') : Common.UIString('Hit Ctrl+P to open a file');
- if (Runtime.experiments.isEnabled('persistence2'))
- tabbedEditorPlaceholderText += '\n\n' + Common.UIString('Drop in a folder to add to workspace');
this._editorContainer = new Sources.TabbedEditorContainer(
- this, Common.settings.createLocalSetting('previouslyViewedFiles', []), tabbedEditorPlaceholderText);
+ this, Common.settings.createLocalSetting('previouslyViewedFiles', []), this._placeholderElement());
this._editorContainer.show(this._searchableView.element);
this._editorContainer.addEventListener(
Sources.TabbedEditorContainer.Events.EditorSelected, this._editorSelected, this);
@@ -95,6 +91,28 @@ Sources.SourcesView = class extends UI.VBox {
}
/**
+ * @return {!Element}
+ */
+ _placeholderElement() {
+ var shortcuts = [
+ {actionId: 'quickOpen.show', description: Common.UIString('Open file')},
+ {actionId: 'commandMenu.show', description: Common.UIString('Run command')}
+ ];
+
+ var element = createElementWithClass('span', 'tabbed-pane-placeholder');
+ for (var shortcut of shortcuts) {
+ var shortcutKeyText = UI.shortcutRegistry.shortcutTitleForAction(shortcut.actionId);
+ var row = element.createChild('div', 'tabbed-pane-placeholder-row');
+ row.createChild('div', 'tabbed-pane-placeholder-key').textContent = shortcutKeyText;
+ row.createChild('div', 'tabbed-pane-placeholder-value').textContent = shortcut.description;
+ }
+ if (Runtime.experiments.isEnabled('persistence2'))
+ element.createChild('div').textContent = Common.UIString('Drop in a folder to add to workspace');
+
+ return element;
+ }
+
+ /**
* @return {!Map.<!Workspace.UISourceCode, number>}
*/
static defaultUISourceCodeScores() {

Powered by Google App Engine
This is Rietveld 408576698