Web Inspector: Option for selecting/deselecting all breakpoints in breakpoint pane
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2012 11:27:56 +0000 (11:27 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2012 11:27:56 +0000 (11:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87644

Patch by Sam D <dsam2912@gmail.com> on 2012-06-06
Reviewed by Pavel Feldman.

Added an option to enable/disable all breakpoints in Breakpoint pane.

* Source/WebCore/English.lproj/localizedStrings.js:
* Source/WebCore/inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype.enableAllBreakpoints):
(WebInspector.BreakpointManager.prototype.disableAllBreakpoints):
* Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointContextMenu.enabledBreakpointCount):
(WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointContextMenu):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119583 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/BreakpointManager.js
Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js

index 4a12a20..f4dd8c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-06-06  Sam D  <dsam2912@gmail.com>
+
+        Web Inspector: Option for selecting/deselecting all breakpoints in breakpoint pane
+        https://bugs.webkit.org/show_bug.cgi?id=87644
+
+        Reviewed by Pavel Feldman.
+
+        Added an option to enable/disable all breakpoints in Breakpoint pane.
+
+        * Source/WebCore/English.lproj/localizedStrings.js:
+        * Source/WebCore/inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype.enableAllBreakpoints):
+        (WebInspector.BreakpointManager.prototype.disableAllBreakpoints):
+        * Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js:
+        (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointContextMenu.enabledBreakpointCount):
+        (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointContextMenu):
+
 2012-06-05  Danilo Cesar Lemes de Paula  <danilo.cesar@collabora.co.uk>
 
         [GTK] show the feature list in alphabetical order
index 41cd8dc..25f1b2f 100644 (file)
@@ -624,10 +624,12 @@ localizedStrings["Web Inspector - "] = "Web Inspector - ";
 localizedStrings["Open using %s"] = "Open using %s";
 localizedStrings["Open Using %s"] = "Open Using %s";
 localizedStrings["Show objects' hidden properties"] = "Show objects' hidden properties";
-localizedStrings["Remove All JavaScript Breakpoints"] = "Remove All JavaScript Breakpoints";
-localizedStrings["Remove all JavaScript breakpoints"] = "Remove all JavaScript breakpoints";
+localizedStrings["Remove All Breakpoints"] = "Remove All Breakpoints";
+localizedStrings["Remove all breakpoints"] = "Remove all breakpoints";
 localizedStrings["Remove All DOM Breakpoints"] = "Remove All DOM Breakpoints";
 localizedStrings["Remove all DOM breakpoints"] = "Remove all DOM breakpoints";
+localizedStrings["Enable All Breakpoints"] = "Enable All Breakpoints";
+localizedStrings["Enable all breakpoints"] = "Enable all breakpoints";
 localizedStrings["Enable source maps"] = "Enable source maps";
 localizedStrings["Experiments"] = "Experiments";
 localizedStrings["WARNING:"] = "WARNING:";
index c425727..54230af 100644 (file)
@@ -138,6 +138,18 @@ WebInspector.BreakpointManager.prototype = {
         return result;
     },
 
+    /**
+     * @param {boolean} toggleState
+     */
+    toggleAllBreakpoints: function(toggleState)
+    {
+        for (var i = 0; i < this._breakpoints.length; ++i) {
+            var breakpoint = this._breakpoints[i];
+            if (breakpoint.enabled() != toggleState)
+                breakpoint.setEnabled(toggleState);
+        }
+    },
+
     removeAllBreakpoints: function()
     {
         var breakpoints = this._breakpoints.slice();
index 9266a6b..e47b431 100644 (file)
@@ -168,12 +168,34 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
     {
         var contextMenu = new WebInspector.ContextMenu();
         contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
-        var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all JavaScript breakpoints" : "Remove All JavaScript Breakpoints");
+        var removeAllTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Remove all breakpoints" : "Remove All Breakpoints");
         contextMenu.appendItem(removeAllTitle, this._breakpointManager.removeAllBreakpoints.bind(this._breakpointManager));
         
         var breakpointActive = WebInspector.debuggerModel.breakpointsActive();
         var breakpointActiveTitle = WebInspector.UIString(breakpointActive ? "Deactivate All Breakpoints" : "Activate All Breakpoints");
         contextMenu.appendItem(breakpointActiveTitle, WebInspector.debuggerModel.setBreakpointsActive.bind(WebInspector.debuggerModel, !breakpointActive));
+
+        function enabledBreakpointCount(breakpoints)
+        {
+            var count = 0;
+            for (var i = 0; i < breakpoints.length; ++i) {
+                if (breakpoints[i].checkbox.checked)
+                    count++;
+            }
+            return count;
+        }
+        var breakpoints = this._items.values();
+        if (breakpoints.length > 1) {
+            var enableBreakpointCount = enabledBreakpointCount(breakpoints);
+            var enableTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Enable all breakpoints" : "Enable All Breakpoints");
+            var disableTitle = WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Disable all breakpoints" : "Disable All Breakpoints");
+
+            contextMenu.appendSeparator();
+
+            contextMenu.appendItem(enableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager, true), !(enableBreakpointCount != breakpoints.length));
+            contextMenu.appendItem(disableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager, false), !(enableBreakpointCount > 1));
+        }
+
         contextMenu.show(event);
     },