OLD | NEW |
---|---|
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 var selection = this.textEditor.copyRange(textSelection); | 273 var selection = this.textEditor.copyRange(textSelection); |
274 var addToWatchLabel = WebInspector.UIString(WebInspector.useLowerCas eMenuTitles() ? "Add to watch" : "Add to Watch"); | 274 var addToWatchLabel = WebInspector.UIString(WebInspector.useLowerCas eMenuTitles() ? "Add to watch" : "Add to Watch"); |
275 contextMenu.appendItem(addToWatchLabel, this._innerAddToWatch.bind(t his, selection)); | 275 contextMenu.appendItem(addToWatchLabel, this._innerAddToWatch.bind(t his, selection)); |
276 var evaluateLabel = WebInspector.UIString(WebInspector.useLowerCaseM enuTitles() ? "Evaluate in console" : "Evaluate in Console"); | 276 var evaluateLabel = WebInspector.UIString(WebInspector.useLowerCaseM enuTitles() ? "Evaluate in console" : "Evaluate in Console"); |
277 contextMenu.appendItem(evaluateLabel, this._evaluateInConsole.bind(t his, selection)); | 277 contextMenu.appendItem(evaluateLabel, this._evaluateInConsole.bind(t his, selection)); |
278 contextMenu.appendSeparator(); | 278 contextMenu.appendSeparator(); |
279 } else if (this._uiSourceCode.project().type() === WebInspector.projectT ypes.Debugger) { | 279 } else if (this._uiSourceCode.project().type() === WebInspector.projectT ypes.Debugger) { |
280 // FIXME: Change condition above to explicitly check that current ui SourceCode is created by default debugger mapping | 280 // FIXME: Change condition above to explicitly check that current ui SourceCode is created by default debugger mapping |
281 // and move the code adding this menu item to generic context menu p rovider for UISourceCode. | 281 // and move the code adding this menu item to generic context menu p rovider for UISourceCode. |
282 var liveEditLabel = WebInspector.UIString(WebInspector.useLowerCaseM enuTitles() ? "Live edit" : "Live Edit"); | 282 var liveEditLabel = WebInspector.UIString(WebInspector.useLowerCaseM enuTitles() ? "Live edit" : "Live Edit"); |
283 contextMenu.appendItem(liveEditLabel, liveEdit.bind(this)); | 283 var targetId = WebInspector.DefaultScriptMapping.targetIdFromProject Id(this._uiSourceCode.project().id()); |
vsevik
2014/06/26 13:07:29
Let's make projectIdForTargetId public static inst
sergeyv
2014/06/26 14:08:40
Done.
| |
284 var target; | |
285 var targets = WebInspector.targetManager.targets(); | |
286 for (var i = 0; i < targets.length; ++i) { | |
287 if (targetId === targets[i].id()) { | |
288 target = targets[i]; | |
289 break; | |
290 } | |
291 } | |
292 if (!target) | |
293 return; | |
294 | |
295 contextMenu.appendItem(liveEditLabel, liveEdit.bind(this, target.liv eEditSupport)); | |
284 contextMenu.appendSeparator(); | 296 contextMenu.appendSeparator(); |
285 } | 297 } |
286 | 298 |
287 /** | 299 /** |
288 * @this {WebInspector.JavaScriptSourceFrame} | 300 * @this {WebInspector.JavaScriptSourceFrame} |
301 * @param {!WebInspector.LiveEditSupport} liveEditSupport | |
289 */ | 302 */ |
290 function liveEdit() | 303 function liveEdit(liveEditSupport) |
291 { | 304 { |
292 var liveEditUISourceCode = WebInspector.liveEditSupport.uiSourceCode ForLiveEdit(this._uiSourceCode); | 305 var liveEditUISourceCode = liveEditSupport.uiSourceCodeForLiveEdit(t his._uiSourceCode); |
293 WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNum ber)); | 306 WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNum ber)); |
294 } | 307 } |
295 | 308 |
296 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.cal l(this, contextMenu, lineNumber); | 309 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.cal l(this, contextMenu, lineNumber); |
297 }, | 310 }, |
298 | 311 |
299 _workingCopyChanged: function(event) | 312 _workingCopyChanged: function(event) |
300 { | 313 { |
301 if (this._supportsEnabledBreakpointsWhileEditing() || this._scriptFileFo rTarget.size()) | 314 if (this._supportsEnabledBreakpointsWhileEditing() || this._scriptFileFo rTarget.size()) |
302 return; | 315 return; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
836 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this); | 849 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this); |
837 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this); | 850 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this); |
838 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); | 851 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); |
839 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); | 852 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); |
840 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); | 853 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); |
841 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); | 854 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); |
842 }, | 855 }, |
843 | 856 |
844 __proto__: WebInspector.UISourceCodeFrame.prototype | 857 __proto__: WebInspector.UISourceCodeFrame.prototype |
845 } | 858 } |
OLD | NEW |