Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #31 from fflorent/issue5639

Now it looks great. Thanks!

Sebastian
  • Loading branch information...
commit 49fb21063f1f08a9141de8ec88ad0d82c1ddcd4a 2 parents 10bcbdd + e4a900c
@SebastianZ SebastianZ authored
View
1  extension/content/firebug/dom/domPanel.js
@@ -1577,6 +1577,7 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
items.push(
{
label: isWatch ? "DeleteWatch" : "DeleteProperty",
+ id: "DeleteProperty",
tooltiptext: isWatch ? "watch.tip.Delete_Watch" :
"dom.tip.Delete_Property",
command: Obj.bindFixed(this.deleteProperty, this, row)
View
42 extension/content/firebug/js/watchPanel.js
@@ -270,6 +270,19 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
}, this));
},
+ // deletes all the watches
+ deleteAllWatches: function()
+ {
+ if (FBTrace.DBG_WATCH)
+ FBTrace.sysout("Firebug.WatchPanel.deleteAllWatches");
+ this.watches = [];
+ this.rebuild(true);
+ this.context.setTimeout(Obj.bindFixed(function()
+ {
+ this.showToolbox(null);
+ }, this));
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
showToolbox: function(row)
@@ -358,6 +371,7 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
if (!path || !path.length)
return;
+
// Ignore top level variables in the Watch panel.
if (panel.name == "watches" && path.length == 1)
return;
@@ -369,6 +383,34 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
command: Obj.bindFixed(this.addWatch, this, path.join(""))
});
},
+
+ getContextMenuItems: function(object, target)
+ {
+ var items = Firebug.DOMBasePanel.prototype.getContextMenuItems.apply(this, arguments);
+
+ // find the index of "DeleteWatch" in the items:
+ var deleteWatchIndex = items.map(function(item)
+ {
+ return item.id;
+ }).indexOf("DeleteProperty");
+
+ // if DeleteWatch was found, we insert DeleteAllWatches after it
+ // otherwise, we insert the item at the beginning of the menu
+ var deleteAllWatchesIndex = (deleteWatchIndex >= 0) ? deleteWatchIndex + 1 : 0;
+
+ if (FBTrace.DBG_WATCH)
+ FBTrace.sysout("insert DeleteAllWatches at: "+ deleteAllWatchesIndex);
+
+ // insert DeleteAllWatches after DeleteWatch
+ items.splice(deleteAllWatchesIndex, 0, {
+ id: "deleteAllWatches",
+ label: "DeleteAllWatches",
+ tooltiptext: "watch.tip.Delete_All_Watches",
+ command: Obj.bindFixed(this.deleteAllWatches, this)
+ });
+
+ return items;
+ }
});
// ********************************************************************************************* //
View
2  extension/locale/en-US/firebug.properties
@@ -469,7 +469,9 @@ watch.tip.Edit_Watch=Edit the watch expression's value
DeleteProperty=Delete Property
dom.tip.Delete_Property=Delete the property
DeleteWatch=Delete Watch
+DeleteAllWatches=Delete All Watches
watch.tip.Delete_Watch=Delete the watch expression
+watch.tip.Delete_All_Watches=Delete all the watch expressions
# LOCALIZATION NOTE (SetBreakpoint, script.tip.Set_Breakpoint): Context menu item of the Script panel.
# Toggles setting of a breakpoint at the current line of a script inside the Script panel.
Please sign in to comment.
Something went wrong with that request. Please try again.