OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 this._rowMessageBuckets = {}; | 47 this._rowMessageBuckets = {}; |
48 /** @type {!Set<string>} */ | 48 /** @type {!Set<string>} */ |
49 this._typeDecorationsPending = new Set(); | 49 this._typeDecorationsPending = new Set(); |
50 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this); | 50 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._onWorkingCopyChanged, this); |
51 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this); | 51 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._onWorkingCopyCommitted, this); |
52 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this); | 52 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Added, this._onMessageAdded, this); |
53 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this); | 53 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Message Removed, this._onMessageRemoved, this); |
54 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineDec orationAdded, this._onLineDecorationAdded, this); | 54 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineDec orationAdded, this._onLineDecorationAdded, this); |
55 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineDec orationRemoved, this._onLineDecorationRemoved, this); | 55 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.LineDec orationRemoved, this._onLineDecorationRemoved, this); |
56 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi ndingCreated, this._onBindingChanged, this); | |
57 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi ndingRemoved, this._onBindingChanged, this); | |
56 this._updateStyle(); | 58 this._updateStyle(); |
57 | 59 |
58 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); | 60 this._errorPopoverHelper = new WebInspector.PopoverHelper(this.element, this ._getErrorAnchor.bind(this), this._showErrorPopover.bind(this)); |
59 this._errorPopoverHelper.setTimeout(100, 100); | 61 this._errorPopoverHelper.setTimeout(100, 100); |
60 | 62 |
61 /** | 63 /** |
62 * @return {!Promise<?string>} | 64 * @return {!Promise<?string>} |
63 */ | 65 */ |
64 function workingCopy() | 66 function workingCopy() |
65 { | 67 { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 WebInspector.context.setFlavor(WebInspector.UISourceCodeFrame, null); | 116 WebInspector.context.setFlavor(WebInspector.UISourceCodeFrame, null); |
115 WebInspector.SourceFrame.prototype.editorBlurred.call(this); | 117 WebInspector.SourceFrame.prototype.editorBlurred.call(this); |
116 }, | 118 }, |
117 | 119 |
118 /** | 120 /** |
119 * @override | 121 * @override |
120 * @return {boolean} | 122 * @return {boolean} |
121 */ | 123 */ |
122 canEditSource: function() | 124 canEditSource: function() |
123 { | 125 { |
126 if (WebInspector.persistence.binding(this._uiSourceCode)) | |
127 return true; | |
124 var projectType = this._uiSourceCode.project().type(); | 128 var projectType = this._uiSourceCode.project().type(); |
125 if (projectType === WebInspector.projectTypes.Service || projectType === WebInspector.projectTypes.Debugger || projectType === WebInspector.projectTypes .Formatter) | 129 if (projectType === WebInspector.projectTypes.Service || projectType === WebInspector.projectTypes.Debugger || projectType === WebInspector.projectTypes .Formatter) |
126 return false; | 130 return false; |
127 if (projectType === WebInspector.projectTypes.Network && this._uiSourceC ode.contentType() === WebInspector.resourceTypes.Document) | 131 if (projectType === WebInspector.projectTypes.Network && this._uiSourceC ode.contentType() === WebInspector.resourceTypes.Document) |
128 return false; | 132 return false; |
129 return true; | 133 return true; |
130 }, | 134 }, |
131 | 135 |
132 _windowFocused: function(event) | 136 _windowFocused: function(event) |
133 { | 137 { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 _onWorkingCopyCommitted: function(event) | 206 _onWorkingCopyCommitted: function(event) |
203 { | 207 { |
204 if (!this._muteSourceCodeEvents) { | 208 if (!this._muteSourceCodeEvents) { |
205 this._innerSetContent(this._uiSourceCode.workingCopy()); | 209 this._innerSetContent(this._uiSourceCode.workingCopy()); |
206 this.onUISourceCodeContentChanged(); | 210 this.onUISourceCodeContentChanged(); |
207 } | 211 } |
208 this._textEditor.markClean(); | 212 this._textEditor.markClean(); |
209 this._updateStyle(); | 213 this._updateStyle(); |
210 }, | 214 }, |
211 | 215 |
216 _onBindingChanged: function(event) | |
dgozman
2016/09/22 19:55:54
JSDoc
lushnikov
2016/09/23 21:56:14
Done.
| |
217 { | |
218 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data ); | |
219 if (binding.network === this._uiSourceCode || binding.persistent === thi s._uiSourceCode) | |
220 this._updateStyle(); | |
221 }, | |
222 | |
212 _updateStyle: function() | 223 _updateStyle: function() |
213 { | 224 { |
214 this.element.classList.toggle("source-frame-unsaved-committed-changes", this._uiSourceCode.hasUnsavedCommittedChanges()); | 225 this.element.classList.toggle("source-frame-unsaved-committed-changes", WebInspector.persistence.hasUnsavedCommittedChanges(this._uiSourceCode)); |
226 this._textEditor.setReadOnly(!this.canEditSource()); | |
215 }, | 227 }, |
216 | 228 |
217 onUISourceCodeContentChanged: function() | 229 onUISourceCodeContentChanged: function() |
218 { | 230 { |
219 }, | 231 }, |
220 | 232 |
221 _updateAutocomplete: function() | 233 _updateAutocomplete: function() |
222 { | 234 { |
223 this._textEditor.configureAutocomplete(WebInspector.moduleSetting("textE ditorAutocompletion").get() ? this._autocompleteConfig : null); | 235 this._textEditor.configureAutocomplete(WebInspector.moduleSetting("textE ditorAutocompletion").get() ? this._autocompleteConfig : null); |
224 }, | 236 }, |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 678 |
667 /** | 679 /** |
668 * @param {!WebInspector.UISourceCode.Message} a | 680 * @param {!WebInspector.UISourceCode.Message} a |
669 * @param {!WebInspector.UISourceCode.Message} b | 681 * @param {!WebInspector.UISourceCode.Message} b |
670 * @return {number} | 682 * @return {number} |
671 */ | 683 */ |
672 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) | 684 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) |
673 { | 685 { |
674 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; | 686 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] - WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; |
675 } | 687 } |
OLD | NEW |