зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900763 - "edit conditional breakpoint". r=jlong
This patch updates the Source Editor contextmenu's UX. Prior to the patch, the menu would show the option "Add conditional breakpoint" even when there was a conditional breakpoint. Now, that option reads "Edit conditional breakpoint".
This commit is contained in:
Родитель
de6c414085
Коммит
37f4efccea
|
@ -63,6 +63,7 @@ function SourcesView(controller, DebuggerView) {
|
|||
this._onConditionalPopupShown = this._onConditionalPopupShown.bind(this);
|
||||
this._onConditionalPopupHiding = this._onConditionalPopupHiding.bind(this);
|
||||
this._onConditionalTextboxKeyPress = this._onConditionalTextboxKeyPress.bind(this);
|
||||
this._onEditorContextMenuOpen = this._onEditorContextMenuOpen.bind(this);
|
||||
this._onCopyUrlCommand = this._onCopyUrlCommand.bind(this);
|
||||
this._onNewTabCommand = this._onNewTabCommand.bind(this);
|
||||
}
|
||||
|
@ -134,6 +135,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
|||
return (a in KNOWN_SOURCE_GROUPS) ? 1 : -1;
|
||||
};
|
||||
|
||||
this.DebuggerView.editor.on("popupOpen", this._onEditorContextMenuOpen);
|
||||
|
||||
this._addCommands();
|
||||
},
|
||||
|
||||
|
@ -151,6 +154,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
|||
this._cbTextbox.removeEventListener("keypress", this._onConditionalTextboxKeyPress, false);
|
||||
this._copyUrlMenuItem.removeEventListener("command", this._onCopyUrlCommand, false);
|
||||
this._newTabMenuItem.removeEventListener("command", this._onNewTabCommand, false);
|
||||
this.DebuggerView.editor.off("popupOpen", this._onEditorContextMenuOpen, false);
|
||||
},
|
||||
|
||||
empty: function() {
|
||||
|
@ -1077,6 +1081,29 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
|||
this.actions.blackbox(getSelectedSource(this.getState()), false);
|
||||
}),
|
||||
|
||||
/**
|
||||
* The source editor's contextmenu handler.
|
||||
* - Toggles "Add Conditional Breakpoint" and "Edit Conditional Breakpoint" items
|
||||
*/
|
||||
_onEditorContextMenuOpen: function(message, ev, popup) {
|
||||
let actor = this.selectedValue;
|
||||
let line = this.DebuggerView.editor.getCursor().line + 1;
|
||||
let location = { actor, line };
|
||||
|
||||
let breakpoint = getBreakpoint(this.getState(), location);
|
||||
let addConditionalBreakpointMenuItem = popup.querySelector("#se-dbg-cMenu-addConditionalBreakpoint");
|
||||
let editConditionalBreakpointMenuItem = popup.querySelector("#se-dbg-cMenu-editConditionalBreakpoint");
|
||||
|
||||
if (breakpoint && !!breakpoint.condition) {
|
||||
editConditionalBreakpointMenuItem.removeAttribute("hidden");
|
||||
addConditionalBreakpointMenuItem.setAttribute("hidden", true);
|
||||
}
|
||||
else {
|
||||
addConditionalBreakpointMenuItem.removeAttribute("hidden");
|
||||
editConditionalBreakpointMenuItem.setAttribute("hidden", true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The click listener for a breakpoint container.
|
||||
*/
|
||||
|
|
|
@ -67,6 +67,7 @@ var DebuggerView = {
|
|||
this._startup = deferred.promise;
|
||||
|
||||
this._initializePanes();
|
||||
this._initializeEditor(deferred.resolve);
|
||||
this.Toolbar.initialize();
|
||||
this.Options.initialize();
|
||||
this.Filtering.initialize();
|
||||
|
@ -80,7 +81,6 @@ var DebuggerView = {
|
|||
this.GlobalSearch.initialize();
|
||||
this._initializeVariablesView();
|
||||
|
||||
this._initializeEditor(deferred.resolve);
|
||||
this._editorSource = {};
|
||||
|
||||
document.title = L10N.getStr("DebuggerWindowTitle");
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
label="&debuggerUI.seMenuCondBreak;"
|
||||
key="addConditionalBreakpointKey"
|
||||
command="addConditionalBreakpointCommand"/>
|
||||
<menuitem id="se-dbg-cMenu-editConditionalBreakpoint"
|
||||
label="&debuggerUI.seEditMenuCondBreak;"
|
||||
key="addConditionalBreakpointKey"
|
||||
command="addConditionalBreakpointCommand"/>
|
||||
<menuitem id="se-dbg-cMenu-addAsWatch"
|
||||
label="&debuggerUI.seMenuAddWatch;"
|
||||
key="addWatchExpressionKey"
|
||||
|
|
|
@ -167,6 +167,11 @@
|
|||
<!ENTITY debuggerUI.seMenuCondBreak "Add Conditional Breakpoint">
|
||||
<!ENTITY debuggerUI.seMenuCondBreak.key "B">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.seMenuBreak): This is the text that
|
||||
- appears in the source editor context menu for editing a breakpoint. -->
|
||||
<!ENTITY debuggerUI.seEditMenuCondBreak "Edit Conditional Breakpoint">
|
||||
<!ENTITY debuggerUI.seEditMenuCondBreak.key "B">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.tabs.*): This is the text that
|
||||
- appears in the debugger's side pane tabs. -->
|
||||
<!ENTITY debuggerUI.tabs.workers "Workers">
|
||||
|
|
|
@ -337,6 +337,8 @@ Editor.prototype = {
|
|||
if (typeof popup == "string") {
|
||||
popup = el.ownerDocument.getElementById(this.config.contextMenu);
|
||||
}
|
||||
|
||||
this.emit("popupOpen", ev, popup);
|
||||
popup.openPopupAtScreen(ev.screenX, ev.screenY, true);
|
||||
}, false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче