Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @implements {UI.ContextFlavorListener} | 5 * @implements {UI.ContextFlavorListener} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Sources.JavaScriptBreakpointsSidebarPane = class extends UI.ThrottledWidget { | 8 Sources.JavaScriptBreakpointsSidebarPane = class extends UI.ThrottledWidget { |
| 9 constructor() { | 9 constructor() { |
| 10 super(true); | 10 super(true); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 170 |
| 171 /** | 171 /** |
| 172 * @param {!Event} event | 172 * @param {!Event} event |
| 173 */ | 173 */ |
| 174 _breakpointContextMenu(event) { | 174 _breakpointContextMenu(event) { |
| 175 var uiLocation = this._uiLocationFromEvent(event); | 175 var uiLocation = this._uiLocationFromEvent(event); |
| 176 if (!uiLocation) | 176 if (!uiLocation) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 var breakpoints = this._breakpointManager.findBreakpoints(uiLocation.uiSourc eCode, uiLocation.lineNumber); | 179 var breakpoints = this._breakpointManager.findBreakpoints(uiLocation.uiSourc eCode, uiLocation.lineNumber); |
| 180 var allBreakpoints = this._breakpointManager.allBreakpoints(); | |
| 180 | 181 |
| 181 var contextMenu = new UI.ContextMenu(event); | 182 var contextMenu = new UI.ContextMenu(event); |
| 182 var removeEntryTitle = breakpoints.length > 1 ? Common.UIString('Remove all breakpoints in line') : | 183 var removeEntryTitle = breakpoints.length > 1 ? Common.UIString('Remove all breakpoints in line') : |
| 183 Common.UIString('Remove brea kpoint'); | 184 Common.UIString('Remove brea kpoint'); |
| 184 contextMenu.appendItem(removeEntryTitle, () => breakpoints.map(breakpoint => breakpoint.remove())); | 185 contextMenu.appendItem(removeEntryTitle, () => breakpoints.map(breakpoint => breakpoint.remove())); |
| 185 | 186 |
| 186 contextMenu.appendSeparator(); | 187 contextMenu.appendSeparator(); |
| 187 var breakpointActive = this._breakpointManager.breakpointsActive(); | 188 var breakpointActive = this._breakpointManager.breakpointsActive(); |
| 188 var breakpointActiveTitle = | 189 var breakpointActiveTitle = |
| 189 breakpointActive ? Common.UIString('Deactivate breakpoints') : Common.UI String('Activate breakpoints'); | 190 breakpointActive ? Common.UIString('Deactivate breakpoints') : Common.UI String('Activate breakpoints'); |
| 190 contextMenu.appendItem( | 191 contextMenu.appendItem( |
| 191 breakpointActiveTitle, | 192 breakpointActiveTitle, |
| 192 this._breakpointManager.setBreakpointsActive.bind(this._breakpointManage r, !breakpointActive)); | 193 this._breakpointManager.setBreakpointsActive.bind(this._breakpointManage r, !breakpointActive)); |
| 193 | 194 |
| 194 contextMenu.appendSeparator(); | 195 if (allBreakpoints.length > 1) { |
|
pfeldman
2017/02/01 19:41:02
It was nice to have these items present unconditio
| |
| 195 if (breakpoints.some(breakpoint => !breakpoint.enabled())) { | 196 contextMenu.appendSeparator(); |
| 196 var enableTitle = Common.UIString('Enable all breakpoints'); | 197 if (breakpoints.some(breakpoint => !breakpoint.enabled())) { |
| 198 var enableTitle = Common.UIString('Enable all breakpoints'); | |
| 199 contextMenu.appendItem( | |
| 200 enableTitle, this._breakpointManager.toggleAllBreakpoints.bind(null, allBreakpoints, true)); | |
| 201 } | |
| 202 if (breakpoints.some(breakpoint => breakpoint.enabled())) { | |
| 203 var disableTitle = Common.UIString('Disable all breakpoints'); | |
| 204 contextMenu.appendItem( | |
| 205 disableTitle, this._breakpointManager.toggleAllBreakpoints.bind(null , allBreakpoints, false)); | |
| 206 } | |
| 207 var removeAllTitle = Common.UIString('Remove all breakpoints'); | |
| 208 contextMenu.appendItem(removeAllTitle, this._breakpointManager.removeAllBr eakpoints.bind(null, allBreakpoints)); | |
| 209 var removeOtherTitle = Common.UIString('Remove other breakpoints'); | |
| 197 contextMenu.appendItem( | 210 contextMenu.appendItem( |
| 198 enableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._b reakpointManager, true)); | 211 removeOtherTitle, this._breakpointManager.removeOtherBreakpoints.bind( null, allBreakpoints, breakpoints)); |
| 199 } | 212 } |
| 200 if (breakpoints.some(breakpoint => breakpoint.enabled())) { | |
| 201 var disableTitle = Common.UIString('Disable all breakpoints'); | |
| 202 contextMenu.appendItem( | |
| 203 disableTitle, this._breakpointManager.toggleAllBreakpoints.bind(this._ breakpointManager, false)); | |
| 204 } | |
| 205 var removeAllTitle = Common.UIString('Remove all breakpoints'); | |
| 206 contextMenu.appendItem(removeAllTitle, this._breakpointManager.removeAllBrea kpoints.bind(this._breakpointManager)); | |
| 207 contextMenu.show(); | 213 contextMenu.show(); |
| 208 } | 214 } |
| 209 | 215 |
| 210 /** | 216 /** |
| 211 * @override | 217 * @override |
| 212 * @param {?Object} object | 218 * @param {?Object} object |
| 213 */ | 219 */ |
| 214 flavorChanged(object) { | 220 flavorChanged(object) { |
| 215 this.update(); | 221 this.update(); |
| 216 } | 222 } |
| 217 | 223 |
| 218 _didUpdateForTest() { | 224 _didUpdateForTest() { |
| 219 } | 225 } |
| 220 }; | 226 }; |
| 221 | 227 |
| 222 Sources.JavaScriptBreakpointsSidebarPane._locationSymbol = Symbol('location'); | 228 Sources.JavaScriptBreakpointsSidebarPane._locationSymbol = Symbol('location'); |
| 223 Sources.JavaScriptBreakpointsSidebarPane._checkboxLabelSymbol = Symbol('checkbox -label'); | 229 Sources.JavaScriptBreakpointsSidebarPane._checkboxLabelSymbol = Symbol('checkbox -label'); |
| 224 Sources.JavaScriptBreakpointsSidebarPane._snippetElementSymbol = Symbol('snippet -element'); | 230 Sources.JavaScriptBreakpointsSidebarPane._snippetElementSymbol = Symbol('snippet -element'); |
| OLD | NEW |