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

Unified Diff: Source/devtools/front_end/documentation/DocumentationView.js

Issue 466743002: DevTools: Show doc context menu items for matching methods on all objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Final changes Created 6 years, 4 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 | « Source/devtools/front_end/documentation/DocumentationURLProvider.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/documentation/DocumentationView.js
diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js
index b3a440902d32712909c36ec74fdc36366db13c0f..ae7c8a432f194c7fdb9fca02670cc6819e34b966 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -12,9 +12,9 @@ WebInspector.DocumentationView = function()
}
/**
- * @param {string} searchTerm
+ * @param {string} url
*/
-WebInspector.DocumentationView.showSearchTerm = function(searchTerm)
+WebInspector.DocumentationView.showDocumentationURL = function(url)
{
if (!WebInspector.DocumentationView._view)
WebInspector.DocumentationView._view = new WebInspector.DocumentationView();
@@ -50,9 +50,16 @@ WebInspector.DocumentationView.ContextMenuProvider.prototype = {
return;
var selectedText = textEditor.copyRange(selection);
var urlProvider = new WebInspector.DocumentationURLProvider();
- var itemPath = urlProvider.itemPath(selectedText);
- if (!itemPath)
+ var possibleProperties = urlProvider.itemDescriptors(selectedText);
+ if (!possibleProperties.length)
return;
- contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Show documentation" : "Show Documentation"), WebInspector.DocumentationView.showSearchTerm.bind(null, selectedText));
+ if (possibleProperties.length === 1) {
+ var formatString = WebInspector.useLowerCaseMenuTitles() ? "Show documentation for %s.%s" : "Show Documentation for %s.%s";
+ contextMenu.appendItem(WebInspector.UIString(formatString, possibleProperties[0].name, selectedText), WebInspector.DocumentationView.showDocumentationURL.bind(null, possibleProperties[0].url));
+ return;
+ }
+ var subMenuItem = contextMenu.appendSubMenuItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Show documentation for..." : "Show Documentation for..."));
+ for (var i = 0; i < possibleProperties.length; ++i)
+ subMenuItem.appendItem(String.sprintf("%s.%s", possibleProperties[i].name, selectedText), WebInspector.DocumentationView.showDocumentationURL.bind(null, possibleProperties[i].url));
}
-}
+}
« no previous file with comments | « Source/devtools/front_end/documentation/DocumentationURLProvider.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698