Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 1165263002: DevTools: Add 'continue to here' to the editor context menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 249 {
250 this._scriptsPanel.setIgnoreExecutionLineEvents(true); 250 this._scriptsPanel.setIgnoreExecutionLineEvents(true);
251 WebInspector.UISourceCodeFrame.prototype.onTextChanged.call(this, oldRan ge, newRange); 251 WebInspector.UISourceCodeFrame.prototype.onTextChanged.call(this, oldRan ge, newRange);
252 this._scriptsPanel.setIgnoreExecutionLineEvents(false); 252 this._scriptsPanel.setIgnoreExecutionLineEvents(false);
253 if (this._compiler) 253 if (this._compiler)
254 this._compiler.scheduleCompile(); 254 this._compiler.scheduleCompile();
255 }, 255 },
256 256
257 populateLineGutterContextMenu: function(contextMenu, lineNumber) 257 populateLineGutterContextMenu: function(contextMenu, lineNumber)
258 { 258 {
259 contextMenu.appendItem(WebInspector.UIString.capitalize("Continue to ^he re"), this._continueToLine.bind(this, lineNumber)); 259 var uiLocation = new WebInspector.UILocation(this._uiSourceCode, lineNum ber, 0);
260 this._scriptsPanel.appendUILocationItems(contextMenu, uiLocation);
260 var breakpoint = this._breakpointManager.findBreakpointOnLine(this._uiSo urceCode, lineNumber); 261 var breakpoint = this._breakpointManager.findBreakpointOnLine(this._uiSo urceCode, lineNumber);
261 if (!breakpoint) { 262 if (!breakpoint) {
262 // This row doesn't have a breakpoint: We want to show Add Breakpoin t and Add and Edit Breakpoint. 263 // This row doesn't have a breakpoint: We want to show Add Breakpoin t and Add and Edit Breakpoint.
263 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakp oint"), this._createNewBreakpoint.bind(this, lineNumber, 0, "", true)); 264 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakp oint"), this._createNewBreakpoint.bind(this, lineNumber, 0, "", true));
264 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^condit ional ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber)); 265 contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^condit ional ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber));
265 } else { 266 } else {
266 // This row has a breakpoint, we want to show edit and remove breakp oint, and either disable or enable. 267 // This row has a breakpoint, we want to show edit and remove breakp oint, and either disable or enable.
267 contextMenu.appendItem(WebInspector.UIString.capitalize("Remove ^bre akpoint"), breakpoint.remove.bind(breakpoint)); 268 contextMenu.appendItem(WebInspector.UIString.capitalize("Remove ^bre akpoint"), breakpoint.remove.bind(breakpoint));
268 contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^break point…"), this._editBreakpointCondition.bind(this, lineNumber, breakpoint)); 269 contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^break point…"), this._editBreakpointCondition.bind(this, lineNumber, breakpoint));
269 if (breakpoint.enabled()) 270 if (breakpoint.enabled())
270 contextMenu.appendItem(WebInspector.UIString.capitalize("Disable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, false)); 271 contextMenu.appendItem(WebInspector.UIString.capitalize("Disable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, false));
271 else 272 else
272 contextMenu.appendItem(WebInspector.UIString.capitalize("Enable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, true)); 273 contextMenu.appendItem(WebInspector.UIString.capitalize("Enable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, true));
273 } 274 }
274 }, 275 },
275 276
276 populateTextAreaContextMenu: function(contextMenu, lineNumber) 277 populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber)
277 { 278 {
278 var textSelection = this.textEditor.selection(); 279 var textSelection = this.textEditor.selection();
279 if (textSelection && !textSelection.isEmpty()) { 280 if (textSelection && !textSelection.isEmpty()) {
280 var selection = this.textEditor.copyRange(textSelection); 281 var selection = this.textEditor.copyRange(textSelection);
281 var addToWatchLabel = WebInspector.UIString.capitalize("Add to ^watc h"); 282 var addToWatchLabel = WebInspector.UIString.capitalize("Add to ^watc h");
282 contextMenu.appendItem(addToWatchLabel, this._innerAddToWatch.bind(t his, selection)); 283 contextMenu.appendItem(addToWatchLabel, this._innerAddToWatch.bind(t his, selection));
283 var evaluateLabel = WebInspector.UIString.capitalize("Evaluate in ^c onsole"); 284 var evaluateLabel = WebInspector.UIString.capitalize("Evaluate in ^c onsole");
284 contextMenu.appendItem(evaluateLabel, this._evaluateInConsole.bind(t his, selection)); 285 contextMenu.appendItem(evaluateLabel, this._evaluateInConsole.bind(t his, selection));
285 contextMenu.appendSeparator(); 286 contextMenu.appendSeparator();
286 } 287 }
(...skipping 11 matching lines...) Expand all
298 * @param {!WebInspector.ResourceScriptFile} scriptFile 299 * @param {!WebInspector.ResourceScriptFile} scriptFile
299 * @param {string} url 300 * @param {string} url
300 */ 301 */
301 function addSourceMapURLDialogCallback(scriptFile, url) 302 function addSourceMapURLDialogCallback(scriptFile, url)
302 { 303 {
303 if (!url) 304 if (!url)
304 return; 305 return;
305 scriptFile.addSourceMapURL(url); 306 scriptFile.addSourceMapURL(url);
306 } 307 }
307 308
308 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.cal l(this, contextMenu, lineNumber); 309 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.cal l(this, contextMenu, lineNumber, columnNumber);
309 310
310 if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Ne twork && WebInspector.moduleSetting("jsSourceMapsEnabled").get()) { 311 if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Ne twork && WebInspector.moduleSetting("jsSourceMapsEnabled").get()) {
311 if (this._scriptFileForTarget.size) { 312 if (this._scriptFileForTarget.size) {
312 var scriptFile = this._scriptFileForTarget.valuesArray()[0]; 313 var scriptFile = this._scriptFileForTarget.valuesArray()[0];
313 var addSourceMapURLLabel = WebInspector.UIString.capitalize("Add ^source ^map\u2026"); 314 var addSourceMapURLLabel = WebInspector.UIString.capitalize("Add ^source ^map\u2026");
314 contextMenu.appendItem(addSourceMapURLLabel, addSourceMapURL.bin d(this, scriptFile)); 315 contextMenu.appendItem(addSourceMapURLLabel, addSourceMapURL.bin d(this, scriptFile));
315 contextMenu.appendSeparator(); 316 contextMenu.appendSeparator();
316 } 317 }
317 } 318 }
318 }, 319 },
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 * @param {number} lineNumber 1098 * @param {number} lineNumber
1098 * @param {number} columnNumber 1099 * @param {number} columnNumber
1099 * @param {string} condition 1100 * @param {string} condition
1100 * @param {boolean} enabled 1101 * @param {boolean} enabled
1101 */ 1102 */
1102 _setBreakpoint: function(lineNumber, columnNumber, condition, enabled) 1103 _setBreakpoint: function(lineNumber, columnNumber, condition, enabled)
1103 { 1104 {
1104 this._breakpointManager.setBreakpoint(this._uiSourceCode, lineNumber, co lumnNumber, condition, enabled); 1105 this._breakpointManager.setBreakpoint(this._uiSourceCode, lineNumber, co lumnNumber, condition, enabled);
1105 }, 1106 },
1106 1107
1107 /**
1108 * @param {number} lineNumber
1109 */
1110 _continueToLine: function(lineNumber)
1111 {
1112 var executionContext = WebInspector.context.flavor(WebInspector.Executio nContext);
1113 if (!executionContext)
1114 return;
1115 var rawLocation = WebInspector.debuggerWorkspaceBinding.uiLocationToRawL ocation(executionContext.target(), this._uiSourceCode, lineNumber, 0);
1116 if (!rawLocation)
1117 return;
1118 this._scriptsPanel.continueToLocation(rawLocation);
1119 },
1120
1121 dispose: function() 1108 dispose: function()
1122 { 1109 {
1123 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointAdded, this._breakpointAdded, this); 1110 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointAdded, this._breakpointAdded, this);
1124 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointRemoved, this._breakpointRemoved, this); 1111 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointRemoved, this._breakpointRemoved, this);
1125 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageAdded , this._uiSourceCode, this._consoleMessageAdded, this); 1112 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageAdded , this._uiSourceCode, this._consoleMessageAdded, this);
1126 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageRemov ed, this._uiSourceCode, this._consoleMessageRemoved, this); 1113 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessageRemov ed, this._uiSourceCode, this._consoleMessageRemoved, this);
1127 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessagesClea red, this._uiSourceCode, this._consoleMessagesCleared, this); 1114 WebInspector.presentationConsoleMessageHelper.removeConsoleMessageEventL istener(WebInspector.PresentationConsoleMessageHelper.Events.ConsoleMessagesClea red, this._uiSourceCode, this._consoleMessagesCleared, this);
1128 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); 1115 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this);
1129 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 1116 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
1130 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 1117 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
1131 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this); 1118 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this);
1132 WebInspector.moduleSetting("skipStackFramesPattern").removeChangeListene r(this._showBlackboxInfobarIfNeeded, this); 1119 WebInspector.moduleSetting("skipStackFramesPattern").removeChangeListene r(this._showBlackboxInfobarIfNeeded, this);
1133 WebInspector.moduleSetting("skipContentScripts").removeChangeListener(th is._showBlackboxInfobarIfNeeded, this); 1120 WebInspector.moduleSetting("skipContentScripts").removeChangeListener(th is._showBlackboxInfobarIfNeeded, this);
1134 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); 1121 WebInspector.UISourceCodeFrame.prototype.dispose.call(this);
1135 }, 1122 },
1136 1123
1137 __proto__: WebInspector.UISourceCodeFrame.prototype 1124 __proto__: WebInspector.UISourceCodeFrame.prototype
1138 } 1125 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/CallStackSidebarPane.js ('k') | Source/devtools/front_end/sources/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698