Title: [121433] trunk/Source/WebCore
Revision
121433
Author
[email protected]
Date
2012-06-28 08:43:36 -0700 (Thu, 28 Jun 2012)

Log Message

Web Inspector: Provide context menu 'Delete all watch expressions.'
https://bugs.webkit.org/show_bug.cgi?id=89735

Patch by Rahul Tiwari <[email protected]> on 2012-06-28
Reviewed by Yury Semikhatsky.

Added context menu delete and delete all watch expressions.

No new tests required as its a minor UI related change.

* English.lproj/localizedStrings.js:
* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSection.prototype.updateExpression):
(WebInspector.WatchExpressionsSection.prototype._deleteAllExpressions):
(WebInspector.WatchExpressionsSection.prototype.findAddedTreeElement):
(WebInspector.WatchExpressionTreeElement.prototype.update):
(WebInspector.WatchExpressionTreeElement.prototype._contextMenu):
(WebInspector.WatchExpressionTreeElement.prototype._deleteAllButtonClicked):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121432 => 121433)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 15:33:11 UTC (rev 121432)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 15:43:36 UTC (rev 121433)
@@ -1,3 +1,23 @@
+2012-06-28  Rahul Tiwari  <[email protected]>
+
+        Web Inspector: Provide context menu 'Delete all watch expressions.'
+        https://bugs.webkit.org/show_bug.cgi?id=89735
+
+        Reviewed by Yury Semikhatsky.
+
+        Added context menu delete and delete all watch expressions.
+
+        No new tests required as its a minor UI related change.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/WatchExpressionsSidebarPane.js:
+        (WebInspector.WatchExpressionsSection.prototype.updateExpression):
+        (WebInspector.WatchExpressionsSection.prototype._deleteAllExpressions):
+        (WebInspector.WatchExpressionsSection.prototype.findAddedTreeElement):
+        (WebInspector.WatchExpressionTreeElement.prototype.update):
+        (WebInspector.WatchExpressionTreeElement.prototype._contextMenu):
+        (WebInspector.WatchExpressionTreeElement.prototype._deleteAllButtonClicked):
+
 2012-06-28  Christophe Dumez  <[email protected]>
 
         m_cssVariablesEnabled member is not initialized in Page Settings

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (121432 => 121433)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-06-28 15:33:11 UTC (rev 121432)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-06-28 15:43:36 UTC (rev 121433)
@@ -157,6 +157,8 @@
 localizedStrings["Delete Node"] = "Delete Node";
 localizedStrings["Delete node"] = "Delete node";
 localizedStrings["Delete watch _expression_."] = "Delete watch _expression_.";
+localizedStrings["Delete watch _expression_"] = "Delete watch _expression_";
+localizedStrings["Delete all watch expressions"] = "Delete all watch expressions";
 localizedStrings["Delete"] = "Delete";
 localizedStrings["Details"] = "Details";
 localizedStrings["Dimensions"] = "Dimensions";

Modified: trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js (121432 => 121433)


--- trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js	2012-06-28 15:33:11 UTC (rev 121432)
+++ trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js	2012-06-28 15:43:36 UTC (rev 121433)
@@ -247,20 +247,30 @@
 
     updateExpression: function(element, value)
     {
-        if (value === null)
-            delete this.watchExpressions[element.property.watchIndex];
+        if (value === null) {
+            var index = element.property.watchIndex;
+            this.watchExpressions.splice(index, 1);
+        }
         else
             this.watchExpressions[element.property.watchIndex] = value;
         this.saveExpressions();
         this.update();
     },
+    
+    _deleteAllExpressions: function()
+    {
+        this.watchExpressions = [];
+        this.saveExpressions();
+        this.update();
+    },
 
     findAddedTreeElement: function()
     {
         var children = this.propertiesTreeOutline.children;
-        for (var i = 0; i < children.length; ++i)
+        for (var i = 0; i < children.length; ++i) {
             if (children[i].property.name === WebInspector.WatchExpressionsSection.NewWatchExpression)
                 return children[i];
+        }
     },
 
     saveExpressions: function()
@@ -348,8 +358,23 @@
         deleteButton.addStyleClass("enabled-button");
         deleteButton.addStyleClass("delete-button");
         deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+        this.listItemElement.addEventListener("contextmenu", this._contextMenu.bind(this), false);
         this.listItemElement.insertBefore(deleteButton, this.listItemElement.firstChild);
     },
+    
+    _contextMenu: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu();
+        contextMenu.appendItem(WebInspector.UIString("Delete watch _expression_"), this._deleteButtonClicked.bind(this));
+        if (this.treeOutline.section.watchExpressions.length > 1)
+            contextMenu.appendItem(WebInspector.UIString("Delete all watch expressions"), this._deleteAllButtonClicked.bind(this));
+        contextMenu.show(event);
+    },
+    
+    _deleteAllButtonClicked: function()
+    {
+        this.treeOutline.section._deleteAllExpressions();
+    },
 
     _deleteButtonClicked: function()
     {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to