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

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..382f35aef970a964309e6f9409ac8bded3b66d0e 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,36 @@ Sources.SourcesView = class extends UI.VBox {
}
/**
+ * @return {!Element}
+ */
+ _placeholderElement() {
+ var shortcuts = [
+ {
+ defaultShortcut: Common.UIString('Ctrl+P'),
pfeldman 2017/04/24 18:29:25 Since shortcuts are defined in quickopen and could
luoe 2017/04/25 23:19:52 Done.
+ macShortcut: Common.UIString('\u2318+P'),
+ description: Common.UIString('Open a file')
+ },
+ {
+ defaultShortcut: Common.UIString('Ctrl+Shift+P'),
+ macShortcut: Common.UIString('\u2318+Shift+P'),
+ description: Common.UIString('Run a command')
+ }
+ ];
+
+ var element = createElementWithClass('span', 'tabbed-pane-placeholder');
+ for (var shortcut of shortcuts) {
+ var shortcutKeyText = Host.isMac() ? shortcut.macShortcut : shortcut.defaultShortcut;
+ 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