| 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 /** |
| 217 * @param {!WebInspector.Event} event |
| 218 */ |
| 219 _onBindingChanged: function(event) |
| 220 { |
| 221 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data
); |
| 222 if (binding.network === this._uiSourceCode || binding.fileSystem === thi
s._uiSourceCode) |
| 223 this._updateStyle(); |
| 224 }, |
| 225 |
| 212 _updateStyle: function() | 226 _updateStyle: function() |
| 213 { | 227 { |
| 214 this.element.classList.toggle("source-frame-unsaved-committed-changes",
this._uiSourceCode.hasUnsavedCommittedChanges()); | 228 this.element.classList.toggle("source-frame-unsaved-committed-changes",
WebInspector.persistence.hasUnsavedCommittedChanges(this._uiSourceCode)); |
| 229 this._textEditor.setReadOnly(!this.canEditSource()); |
| 215 }, | 230 }, |
| 216 | 231 |
| 217 onUISourceCodeContentChanged: function() | 232 onUISourceCodeContentChanged: function() |
| 218 { | 233 { |
| 219 }, | 234 }, |
| 220 | 235 |
| 221 _updateAutocomplete: function() | 236 _updateAutocomplete: function() |
| 222 { | 237 { |
| 223 this._textEditor.configureAutocomplete(WebInspector.moduleSetting("textE
ditorAutocompletion").get() ? this._autocompleteConfig : null); | 238 this._textEditor.configureAutocomplete(WebInspector.moduleSetting("textE
ditorAutocompletion").get() ? this._autocompleteConfig : null); |
| 224 }, | 239 }, |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 681 |
| 667 /** | 682 /** |
| 668 * @param {!WebInspector.UISourceCode.Message} a | 683 * @param {!WebInspector.UISourceCode.Message} a |
| 669 * @param {!WebInspector.UISourceCode.Message} b | 684 * @param {!WebInspector.UISourceCode.Message} b |
| 670 * @return {number} | 685 * @return {number} |
| 671 */ | 686 */ |
| 672 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) | 687 WebInspector.UISourceCode.Message.messageLevelComparator = function(a, b) |
| 673 { | 688 { |
| 674 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] -
WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; | 689 return WebInspector.UISourceCode.Message._messageLevelPriority[a.level()] -
WebInspector.UISourceCode.Message._messageLevelPriority[b.level()]; |
| 675 } | 690 } |
| OLD | NEW |