Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix issue #5639: Delete all watch expressions #31

Merged
merged 4 commits into from

2 participants

Florent Fayolle Sebastian Zartner
Sebastian Zartner
Owner
  • 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
Owner

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
Sebastian Zartner
Owner

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
View
@@ -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)
42 extension/content/firebug/js/watchPanel.js
View
@@ -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;
+ }
});
// ********************************************************************************************* //
2  extension/locale/en-US/firebug.properties
View
@@ -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.
Something went wrong with that request. Please try again.