| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) IBM Corp. 2009 All rights reserved. | 2 * Copyright (C) IBM Corp. 2009 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.View} | 33 * @extends {WebInspector.SimpleView} |
| 34 */ | 34 */ |
| 35 WebInspector.WatchExpressionsSidebarPane = function() | 35 WebInspector.WatchExpressionsSidebarPane = function() |
| 36 { | 36 { |
| 37 WebInspector.View.call(this, WebInspector.UIString("Watch")); | 37 WebInspector.SimpleView.call(this, WebInspector.UIString("Watch")); |
| 38 this.registerRequiredCSS("components/objectValue.css"); | 38 this.registerRequiredCSS("components/objectValue.css"); |
| 39 | 39 |
| 40 this._requiresUpdate = true; | 40 this._requiresUpdate = true; |
| 41 /** @type {!Array.<!WebInspector.WatchExpression>} */ | 41 /** @type {!Array.<!WebInspector.WatchExpression>} */ |
| 42 this._watchExpressions = []; | 42 this._watchExpressions = []; |
| 43 this._watchExpressionsSetting = WebInspector.settings.createLocalSetting("wa
tchExpressions", []); | 43 this._watchExpressionsSetting = WebInspector.settings.createLocalSetting("wa
tchExpressions", []); |
| 44 | 44 |
| 45 var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add ex
pression"), "add-toolbar-item"); | 45 var addButton = new WebInspector.ToolbarButton(WebInspector.UIString("Add ex
pression"), "add-toolbar-item"); |
| 46 addButton.addEventListener("click", this._addButtonClicked.bind(this)); | 46 addButton.addEventListener("click", this._addButtonClicked.bind(this)); |
| 47 this.addToolbarItem(addButton); | 47 this.addToolbarItem(addButton); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 68 { | 68 { |
| 69 this._requiresUpdate = true; | 69 this._requiresUpdate = true; |
| 70 this._refreshExpressionsIfNeeded(); | 70 this._refreshExpressionsIfNeeded(); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * @param {string} expressionString | 74 * @param {string} expressionString |
| 75 */ | 75 */ |
| 76 addExpression: function(expressionString) | 76 addExpression: function(expressionString) |
| 77 { | 77 { |
| 78 this.revealWidget(); | 78 this.revealView(); |
| 79 if (this._requiresUpdate) { | 79 if (this._requiresUpdate) { |
| 80 this._rebuildWatchExpressions(); | 80 this._rebuildWatchExpressions(); |
| 81 delete this._requiresUpdate; | 81 delete this._requiresUpdate; |
| 82 } | 82 } |
| 83 this._createWatchExpression(expressionString); | 83 this._createWatchExpression(expressionString); |
| 84 this._saveExpressions(); | 84 this._saveExpressions(); |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 expandIfNecessary: function() | 87 /** |
| 88 * @return {boolean} |
| 89 */ |
| 90 hasExpressions: function() |
| 88 { | 91 { |
| 89 if (this._watchExpressionsSetting.get().length) | 92 return !!this._watchExpressionsSetting.get().length; |
| 90 this.revealWidget(); | |
| 91 }, | 93 }, |
| 92 | 94 |
| 93 _saveExpressions: function() | 95 _saveExpressions: function() |
| 94 { | 96 { |
| 95 var toSave = []; | 97 var toSave = []; |
| 96 for (var i = 0; i < this._watchExpressions.length; i++) | 98 for (var i = 0; i < this._watchExpressions.length; i++) |
| 97 if (this._watchExpressions[i].expression()) | 99 if (this._watchExpressions[i].expression()) |
| 98 toSave.push(this._watchExpressions[i].expression()); | 100 toSave.push(this._watchExpressions[i].expression()); |
| 99 | 101 |
| 100 this._watchExpressionsSetting.set(toSave); | 102 this._watchExpressionsSetting.set(toSave); |
| 101 }, | 103 }, |
| 102 | 104 |
| 103 _refreshExpressionsIfNeeded: function() | 105 _refreshExpressionsIfNeeded: function() |
| 104 { | 106 { |
| 105 if (this._requiresUpdate && this.isShowing()) { | 107 if (this._requiresUpdate && this.isShowing()) { |
| 106 this._rebuildWatchExpressions(); | 108 this._rebuildWatchExpressions(); |
| 107 delete this._requiresUpdate; | 109 delete this._requiresUpdate; |
| 108 } else | 110 } else |
| 109 this._requiresUpdate = true; | 111 this._requiresUpdate = true; |
| 110 }, | 112 }, |
| 111 | 113 |
| 112 /** | 114 /** |
| 113 * @param {!WebInspector.Event=} event | 115 * @param {!WebInspector.Event=} event |
| 114 */ | 116 */ |
| 115 _addButtonClicked: function(event) | 117 _addButtonClicked: function(event) |
| 116 { | 118 { |
| 117 if (event) | 119 if (event) |
| 118 event.consume(true); | 120 event.consume(true); |
| 119 this.revealWidget(); | 121 this.revealView(); |
| 120 this._createWatchExpression(null).startEditing(); | 122 this._createWatchExpression(null).startEditing(); |
| 121 }, | 123 }, |
| 122 | 124 |
| 123 /** | 125 /** |
| 124 * @param {!WebInspector.Event} event | 126 * @param {!WebInspector.Event} event |
| 125 */ | 127 */ |
| 126 _refreshButtonClicked: function(event) | 128 _refreshButtonClicked: function(event) |
| 127 { | 129 { |
| 128 event.consume(); | 130 event.consume(); |
| 129 this.refreshExpressions(); | 131 this.refreshExpressions(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 watchExpression._populateContextMenu(contextMenu, event); | 208 watchExpression._populateContextMenu(contextMenu, event); |
| 207 }, | 209 }, |
| 208 | 210 |
| 209 _deleteAllButtonClicked: function() | 211 _deleteAllButtonClicked: function() |
| 210 { | 212 { |
| 211 this._watchExpressions = []; | 213 this._watchExpressions = []; |
| 212 this._saveExpressions(); | 214 this._saveExpressions(); |
| 213 this._rebuildWatchExpressions(); | 215 this._rebuildWatchExpressions(); |
| 214 }, | 216 }, |
| 215 | 217 |
| 216 __proto__: WebInspector.View.prototype | 218 __proto__: WebInspector.SimpleView.prototype |
| 217 } | 219 } |
| 218 | 220 |
| 219 /** | 221 /** |
| 220 * @constructor | 222 * @constructor |
| 221 * @extends {WebInspector.Object} | 223 * @extends {WebInspector.Object} |
| 222 * @param {?string} expression | 224 * @param {?string} expression |
| 223 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er | 225 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er |
| 224 * @param {!WebInspector.Linkifier} linkifier | 226 * @param {!WebInspector.Linkifier} linkifier |
| 225 */ | 227 */ |
| 226 WebInspector.WatchExpression = function(expression, expandController, linkifier) | 228 WebInspector.WatchExpression = function(expression, expandController, linkifier) |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 contextMenu.appendApplicableItems(this._result); | 438 contextMenu.appendApplicableItems(this._result); |
| 437 }, | 439 }, |
| 438 | 440 |
| 439 _copyValueButtonClicked: function() | 441 _copyValueButtonClicked: function() |
| 440 { | 442 { |
| 441 InspectorFrontendHost.copyText(this._valueElement.textContent); | 443 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 442 }, | 444 }, |
| 443 | 445 |
| 444 __proto__: WebInspector.Object.prototype | 446 __proto__: WebInspector.Object.prototype |
| 445 } | 447 } |
| OLD | NEW |