Changeset 112414 in webkit
- Timestamp:
- Mar 28, 2012 11:13:47 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112413 r112414 1 2012-03-28 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Add context menu for snippets control. 4 https://bugs.webkit.org/show_bug.cgi?id=82475 5 6 Reviewed by Pavel Feldman. 7 8 This is a preliminary implementation of snippets control using context menu. 9 We might want to add a more discoverable one before taking snippets out of experiments. 10 11 * English.lproj/localizedStrings.js: 12 * inspector/front-end/ScriptsNavigator.js: 13 (WebInspector.ScriptsNavigator.prototype._showScriptFoldersSettingChanged): 14 (WebInspector.ScriptsNavigator.prototype._createSnippetsTree): 15 (WebInspector.ScriptsNavigator.prototype._handleSnippetContextMenuEvent): 16 (WebInspector.ScriptsNavigator.prototype._showSnippetContextMenu): 17 (WebInspector.ScriptsNavigator.prototype._handleEvaluateSnippet): 18 (WebInspector.ScriptsNavigator.prototype._handleRenameSnippet): 19 (WebInspector.ScriptsNavigator.prototype._handleRemoveSnippet): 20 (WebInspector.ScriptsNavigator.prototype._handleCreateSnippet): 21 (WebInspector.NavigatorScriptTreeElement.prototype.get navigator): 22 (WebInspector.NavigatorScriptTreeElement.prototype.onattach): 23 (WebInspector.NavigatorScriptTreeElement.prototype.onenter): 24 (WebInspector.NavigatorScriptTreeElement.prototype._handleContextMenuEvent): 25 1 26 2012-03-28 Vsevolod Vlasov <vsevik@chromium.org> 2 27 -
trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js
r112413 r112414 226 226 this.dispatchEventToListeners(WebInspector.ScriptsPanel.FileSelector.Events.FileSelected, uiSourceCode); 227 227 }, 228 228 229 229 /** 230 230 * @param {WebInspector.UISourceCode} uiSourceCode … … 246 246 this._scriptTreeElementsByUISourceCode.remove(uiSourceCode); 247 247 }, 248 248 249 249 _showScriptFoldersSettingChanged: function() 250 250 { … … 255 255 for (var i = 0; i < uiSourceCodes.length; ++i) 256 256 this.addUISourceCode(uiSourceCodes[i]); 257 257 258 258 if (this._lastSelectedUISourceCode) 259 259 this.revealUISourceCode(this._lastSelectedUISourceCode); 260 260 }, 261 261 262 262 _createSnippetsTree: function() 263 263 { … … 266 266 snippetsView.element.addStyleClass("fill"); 267 267 snippetsView.element.addStyleClass("navigator-container"); 268 snippetsView.element.addEventListener("contextmenu", this._handleSnippetContextMenuEvent.bind(this), false); 268 269 var snippetsOutlineElement = document.createElement("div"); 269 270 snippetsOutlineElement.addStyleClass("outline-disclosure"); … … 277 278 }, 278 279 280 /** 281 * @param {Event} event 282 */ 283 _handleSnippetContextMenuEvent: function(event) 284 { 285 this._showSnippetContextMenu(event); 286 }, 287 288 /** 289 * @param {Event} event 290 * @param {WebInspector.UISourceCode=} uiSourceCode 291 */ 292 _showSnippetContextMenu: function(event, uiSourceCode) 293 { 294 var contextMenu = new WebInspector.ContextMenu(); 295 if (uiSourceCode) { 296 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Evaluate snippet" : "Evaluate Snippet"), this._handleEvaluateSnippet.bind(this, uiSourceCode)); 297 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Rename snippet" : "Rename Snippet"), this._handleRenameSnippet.bind(this, uiSourceCode)); 298 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove snippet" : "Remove Snippet"), this._handleRemoveSnippet.bind(this, uiSourceCode)); 299 contextMenu.appendSeparator(); 300 } 301 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Create snippet" : "Create Snippet"), this._handleCreateSnippet.bind(this)); 302 contextMenu.show(event); 303 }, 304 305 /** 306 * @param {WebInspector.UISourceCode} uiSourceCode 307 * @param {Event} event 308 */ 309 _handleEvaluateSnippet: function(uiSourceCode, event) 310 { 311 // FIXME: To be implemented. 312 }, 313 314 /** 315 * @param {WebInspector.UISourceCode} uiSourceCode 316 * @param {Event} event 317 */ 318 _handleRenameSnippet: function(uiSourceCode, event) 319 { 320 // FIXME: To be implemented. 321 }, 322 323 /** 324 * @param {WebInspector.UISourceCode} uiSourceCode 325 * @param {Event} event 326 */ 327 _handleRemoveSnippet: function(uiSourceCode, event) 328 { 329 // FIXME: To be implemented. 330 }, 331 332 /** 333 * @param {Event} event 334 */ 335 _handleCreateSnippet: function(event) 336 { 337 // FIXME: To be implemented. 338 }, 279 339 280 340 reset: function() … … 427 487 return result; 428 488 }, 429 489 430 490 searchStarted: function() 431 491 { … … 582 642 WebInspector.NavigatorScriptTreeElement.prototype = { 583 643 /** 644 * @type {WebInspector.ScriptsNavigator} 645 */ 646 get navigator() 647 { 648 return this._navigator; 649 }, 650 651 /** 584 652 * @type {WebInspector.UISourceCode} 585 653 */ … … 589 657 }, 590 658 659 onattach: function() 660 { 661 WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this); 662 if (this._uiSourceCode.isSnippet) 663 this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), false); 664 }, 665 591 666 /** 592 667 * @param {Event} event … … 600 675 { 601 676 this._navigator.scriptSelected(this.uiSourceCode); 677 }, 678 679 /** 680 * @param {Event} event 681 */ 682 _handleContextMenuEvent: function(event) 683 { 684 this.navigator._showSnippetContextMenu(event, this.uiSourceCode); 602 685 } 603 686 }
Note: See TracChangeset
for help on using the changeset viewer.