diff --git a/assets/panel/debugger.properties b/assets/panel/debugger.properties index bc750921a9..29175c3efe 100644 --- a/assets/panel/debugger.properties +++ b/assets/panel/debugger.properties @@ -271,6 +271,8 @@ breakpointMenuItem.deleteAll2.label=Remove all breakpointMenuItem.deleteAll2.accesskey=a breakpointMenuItem.removeCondition2.label=Remove condition breakpointMenuItem.removeCondition2.accesskey=c +breakpointMenuItem.addCondition2.label=Add condition +breakpointMenuItem.addCondition2.accesskey=A breakpointMenuItem.editCondition2.label=Edit condition breakpointMenuItem.editCondition2.accesskey=n diff --git a/src/actions/ui.js b/src/actions/ui.js index 653a861085..f3415ad5d0 100644 --- a/src/actions/ui.js +++ b/src/actions/ui.js @@ -118,9 +118,9 @@ export function clearHighlightLineRange() { }; } -export function toggleConditionalBreakpointPanel(line: null | number) { +export function toggleConditionalBreakpointPanel(line?: number) { return { type: "TOGGLE_CONDITIONAL_BREAKPOINT_PANEL", - line + line: line }; } diff --git a/src/components/SecondaryPanes/Breakpoints.js b/src/components/SecondaryPanes/Breakpoints.js index de2f7c2d01..aa56716dd5 100644 --- a/src/components/SecondaryPanes/Breakpoints.js +++ b/src/components/SecondaryPanes/Breakpoints.js @@ -132,6 +132,9 @@ class Breakpoints extends PureComponent { const removeConditionLabel = L10N.getStr( "breakpointMenuItem.removeCondition2.label" ); + const addConditionLabel = L10N.getStr( + "breakpointMenuItem.addCondition2.label" + ); const editConditionLabel = L10N.getStr( "breakpointMenuItem.editCondition2.label" ); @@ -165,6 +168,9 @@ class Breakpoints extends PureComponent { const editConditionKey = L10N.getStr( "breakpointMenuItem.editCondition2.accesskey" ); + const addConditionKey = L10N.getStr( + "breakpointMenuItem.addCondition2.accesskey" + ); const otherBreakpoints = breakpoints.filter(b => b !== breakpoint); const enabledBreakpoints = breakpoints.filter(b => !b.disabled); @@ -255,11 +261,24 @@ class Breakpoints extends PureComponent { click: () => setBreakpointCondition(breakpoint.location) }; + const addCondition = { + id: "node-menu-add-condition", + label: addConditionLabel, + accesskey: addConditionKey, + click: () => { + this.selectBreakpoint(breakpoint) + toggleConditionalBreakpointPanel(breakpoint.location.line) + } + }; + const editCondition = { id: "node-menu-edit-condition", label: editConditionLabel, accesskey: editConditionKey, - click: () => toggleConditionalBreakpointPanel(breakpoint.location.line) + click: () => { + this.selectBreakpoint(breakpoint) + toggleConditionalBreakpointPanel(breakpoint.location.line) + } }; const hideEnableSelf = !breakpoint.disabled; @@ -291,6 +310,10 @@ class Breakpoints extends PureComponent { { item: { type: "separator" } }, + { + item: addCondition, + hidden: () => breakpoint.condition + }, { item: editCondition, hidden: () => !breakpoint.condition