Chromium Code Reviews| 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..1b3b660727cdab3c3313ed2428e4cdaf247aa7a8 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(String.sprintf(formatString, possibleProperties[0].name, selectedText), WebInspector.DocumentationView.showDocumentationURL.bind(null, possibleProperties[0].url)); |
|
apavlov
2014/08/12 16:12:09
Since we are dealing with localizable strings ("Sh
|
| + 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)); |
| } |
| -} |
| +} |