Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

fix issue #5639: Delete all watch expressions #31

Merged
merged 4 commits into from over 1 year ago

2 participants

Florent Fayolle Sebastian Zartner
Sebastian Zartner
Collaborator
  • The i in iDeleteWatch is a bit vexing. It should better be deleteWatchIndex.
  • Better add IDs to the items inside domPanel.js instead of checking the item.label
  • The ID for the menu entry can be deleteAllWatches.
  • The menu entry should also be shown when clicking into the empty space of the Watch side panel. In that case it should still be added above "Refresh" and you will also need to add a separator before it.

Sebastian

Florent Fayolle
Collaborator

Hi Sebastian,

I have included your remarks.
The separator between "Delete All Watches" and "Refresh" is automatically added when clicking on an empty space.

Sebastian Zartner SebastianZ merged commit 49fb210 into from August 27, 2012
Sebastian Zartner SebastianZ closed this August 27, 2012
Sebastian Zartner
Collaborator

I made yet one more little improvement in eb7fe8d, which causes the option only to be shown when there are actually some watch expressions defined.

Sebastian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  extension/content/firebug/dom/domPanel.js
@@ -1577,6 +1577,7 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
1577 1577
                 items.push(
1578 1578
                     {
1579 1579
                         label: isWatch ? "DeleteWatch" : "DeleteProperty",
  1580
+                        id: "DeleteProperty",
1580 1581
                         tooltiptext: isWatch ? "watch.tip.Delete_Watch" :
1581 1582
                             "dom.tip.Delete_Property",
1582 1583
                         command: Obj.bindFixed(this.deleteProperty, this, row)
42  extension/content/firebug/js/watchPanel.js
@@ -270,6 +270,19 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
270 270
         }, this));
271 271
     },
272 272
 
  273
+    // deletes all the watches
  274
+    deleteAllWatches: function()
  275
+    {
  276
+        if (FBTrace.DBG_WATCH)
  277
+            FBTrace.sysout("Firebug.WatchPanel.deleteAllWatches");
  278
+        this.watches = [];
  279
+        this.rebuild(true);
  280
+        this.context.setTimeout(Obj.bindFixed(function()
  281
+        {
  282
+            this.showToolbox(null);
  283
+        }, this));
  284
+    },
  285
+
273 286
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 287
 
275 288
     showToolbox: function(row)
@@ -358,6 +371,7 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
358 371
         if (!path || !path.length)
359 372
             return;
360 373
 
  374
+
361 375
         // Ignore top level variables in the Watch panel.
362 376
         if (panel.name == "watches" && path.length == 1)
363 377
             return;
@@ -369,6 +383,34 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
369 383
            command: Obj.bindFixed(this.addWatch, this, path.join(""))
370 384
         });
371 385
     },
  386
+
  387
+    getContextMenuItems: function(object, target)
  388
+    {
  389
+        var items = Firebug.DOMBasePanel.prototype.getContextMenuItems.apply(this, arguments);
  390
+
  391
+        // find the index of "DeleteWatch" in the items: 
  392
+        var deleteWatchIndex = items.map(function(item)
  393
+        {
  394
+            return item.id;
  395
+        }).indexOf("DeleteProperty");
  396
+
  397
+        // if DeleteWatch was found, we insert DeleteAllWatches after it
  398
+        // otherwise, we insert the item at the beginning of the menu
  399
+        var deleteAllWatchesIndex = (deleteWatchIndex >= 0) ? deleteWatchIndex + 1 : 0;
  400
+
  401
+        if (FBTrace.DBG_WATCH)
  402
+            FBTrace.sysout("insert DeleteAllWatches at: "+ deleteAllWatchesIndex);
  403
+
  404
+        // insert DeleteAllWatches after DeleteWatch
  405
+        items.splice(deleteAllWatchesIndex, 0, {
  406
+            id: "deleteAllWatches",
  407
+            label: "DeleteAllWatches",
  408
+            tooltiptext: "watch.tip.Delete_All_Watches",
  409
+            command: Obj.bindFixed(this.deleteAllWatches, this)
  410
+        });
  411
+
  412
+        return items;
  413
+    }
372 414
 });
373 415
 
374 416
 // ********************************************************************************************* //
2  extension/locale/en-US/firebug.properties
@@ -469,7 +469,9 @@ watch.tip.Edit_Watch=Edit the watch expression's value
469 469
 DeleteProperty=Delete Property
470 470
 dom.tip.Delete_Property=Delete the property
471 471
 DeleteWatch=Delete Watch
  472
+DeleteAllWatches=Delete All Watches
472 473
 watch.tip.Delete_Watch=Delete the watch expression
  474
+watch.tip.Delete_All_Watches=Delete all the watch expressions
473 475
 
474 476
 # LOCALIZATION NOTE (SetBreakpoint, script.tip.Set_Breakpoint): Context menu item of the Script panel.
475 477
 # Toggles setting of a breakpoint at the current line of a script inside the Script panel.
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.