Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #5639: Delete all watch expressions #31

Merged
merged 4 commits into from Aug 27, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions extension/content/firebug/dom/domPanel.js
Expand Up @@ -1577,6 +1577,7 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
items.push( items.push(
{ {
label: isWatch ? "DeleteWatch" : "DeleteProperty", label: isWatch ? "DeleteWatch" : "DeleteProperty",
id: "DeleteProperty",
tooltiptext: isWatch ? "watch.tip.Delete_Watch" : tooltiptext: isWatch ? "watch.tip.Delete_Watch" :
"dom.tip.Delete_Property", "dom.tip.Delete_Property",
command: Obj.bindFixed(this.deleteProperty, this, row) command: Obj.bindFixed(this.deleteProperty, this, row)
Expand Down
42 changes: 42 additions & 0 deletions extension/content/firebug/js/watchPanel.js
Expand Up @@ -270,6 +270,19 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
}, this)); }, 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) showToolbox: function(row)
Expand Down Expand Up @@ -358,6 +371,7 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
if (!path || !path.length) if (!path || !path.length)
return; return;



// Ignore top level variables in the Watch panel. // Ignore top level variables in the Watch panel.
if (panel.name == "watches" && path.length == 1) if (panel.name == "watches" && path.length == 1)
return; return;
Expand All @@ -369,6 +383,34 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
command: Obj.bindFixed(this.addWatch, this, path.join("")) 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;
}
}); });


// ********************************************************************************************* // // ********************************************************************************************* //
Expand Down
2 changes: 2 additions & 0 deletions extension/locale/en-US/firebug.properties
Expand Up @@ -469,7 +469,9 @@ watch.tip.Edit_Watch=Edit the watch expression's value
DeleteProperty=Delete Property DeleteProperty=Delete Property
dom.tip.Delete_Property=Delete the property dom.tip.Delete_Property=Delete the property
DeleteWatch=Delete Watch DeleteWatch=Delete Watch
DeleteAllWatches=Delete All Watches
watch.tip.Delete_Watch=Delete the watch expression 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. # 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. # Toggles setting of a breakpoint at the current line of a script inside the Script panel.
Expand Down