Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #31 from fflorent/issue5639

Now it looks great. Thanks!

Sebastian
  • Loading branch information...
commit 49fb21063f1f08a9141de8ec88ad0d82c1ddcd4a 2 parents 10bcbdd + e4a900c
Sebastian Zartner authored August 27, 2012
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.

0 notes on commit 49fb210

Please sign in to comment.
Something went wrong with that request. Please try again.