| 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.SidebarPane} | 33 * @extends {WebInspector.View} |
| 34 */ | 34 */ |
| 35 WebInspector.WatchExpressionsSidebarPane = function() | 35 WebInspector.WatchExpressionsSidebarPane = function() |
| 36 { | 36 { |
| 37 WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch")); | 37 WebInspector.View.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.toolbar().appendToolbarItem(addButton); | 47 this.addToolbarItem(addButton); |
| 48 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); | 48 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); |
| 49 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
)); | 49 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
)); |
| 50 this.toolbar().appendToolbarItem(refreshButton); | 50 this.addToolbarItem(refreshButton); |
| 51 | 51 |
| 52 this._bodyElement = this.element.createChild("div", "vbox watch-expressions"
); | 52 this._bodyElement = this.element.createChild("div", "vbox watch-expressions"
); |
| 53 this._bodyElement.addEventListener("contextmenu", this._contextMenu.bind(thi
s), false); | 53 this._bodyElement.addEventListener("contextmenu", this._contextMenu.bind(thi
s), false); |
| 54 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); | 54 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); |
| 55 | 55 |
| 56 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this.refreshExpressions, this); | 56 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this.refreshExpressions, this); |
| 57 | 57 |
| 58 this._linkifier = new WebInspector.Linkifier(); | 58 this._linkifier = new WebInspector.Linkifier(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 WebInspector.WatchExpressionsSidebarPane.prototype = { | 61 WebInspector.WatchExpressionsSidebarPane.prototype = { |
| 62 wasShown: function() | 62 wasShown: function() |
| 63 { | 63 { |
| 64 this._refreshExpressionsIfNeeded(); | 64 this._refreshExpressionsIfNeeded(); |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 refreshExpressions: function() | 67 refreshExpressions: function() |
| 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.expandPane(); | 78 this.requestReveal(); |
| 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 expandIfNecessary: function() |
| 88 { | 88 { |
| 89 if (this._watchExpressionsSetting.get().length) | 89 if (this._watchExpressionsSetting.get().length) |
| 90 this.expandPane(); | 90 this.requestReveal(); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 _saveExpressions: function() | 93 _saveExpressions: function() |
| 94 { | 94 { |
| 95 var toSave = []; | 95 var toSave = []; |
| 96 for (var i = 0; i < this._watchExpressions.length; i++) | 96 for (var i = 0; i < this._watchExpressions.length; i++) |
| 97 if (this._watchExpressions[i].expression()) | 97 if (this._watchExpressions[i].expression()) |
| 98 toSave.push(this._watchExpressions[i].expression()); | 98 toSave.push(this._watchExpressions[i].expression()); |
| 99 | 99 |
| 100 this._watchExpressionsSetting.set(toSave); | 100 this._watchExpressionsSetting.set(toSave); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 _refreshExpressionsIfNeeded: function() | 103 _refreshExpressionsIfNeeded: function() |
| 104 { | 104 { |
| 105 if (this._requiresUpdate && this.isShowing()) { | 105 if (this._requiresUpdate && this.isShowing()) { |
| 106 this._rebuildWatchExpressions(); | 106 this._rebuildWatchExpressions(); |
| 107 delete this._requiresUpdate; | 107 delete this._requiresUpdate; |
| 108 } else | 108 } else |
| 109 this._requiresUpdate = true; | 109 this._requiresUpdate = true; |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * @param {!WebInspector.Event=} event | 113 * @param {!WebInspector.Event=} event |
| 114 */ | 114 */ |
| 115 _addButtonClicked: function(event) | 115 _addButtonClicked: function(event) |
| 116 { | 116 { |
| 117 if (event) | 117 if (event) |
| 118 event.consume(true); | 118 event.consume(true); |
| 119 this.expandPane(); | 119 this.requestReveal(); |
| 120 this._createWatchExpression(null).startEditing(); | 120 this._createWatchExpression(null).startEditing(); |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {!WebInspector.Event} event | 124 * @param {!WebInspector.Event} event |
| 125 */ | 125 */ |
| 126 _refreshButtonClicked: function(event) | 126 _refreshButtonClicked: function(event) |
| 127 { | 127 { |
| 128 event.consume(); | 128 event.consume(); |
| 129 this.refreshExpressions(); | 129 this.refreshExpressions(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 watchExpression._populateContextMenu(contextMenu, event); | 206 watchExpression._populateContextMenu(contextMenu, event); |
| 207 }, | 207 }, |
| 208 | 208 |
| 209 _deleteAllButtonClicked: function() | 209 _deleteAllButtonClicked: function() |
| 210 { | 210 { |
| 211 this._watchExpressions = []; | 211 this._watchExpressions = []; |
| 212 this._saveExpressions(); | 212 this._saveExpressions(); |
| 213 this._rebuildWatchExpressions(); | 213 this._rebuildWatchExpressions(); |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 __proto__: WebInspector.SidebarPane.prototype | 216 __proto__: WebInspector.View.prototype |
| 217 } | 217 } |
| 218 | 218 |
| 219 /** | 219 /** |
| 220 * @constructor | 220 * @constructor |
| 221 * @extends {WebInspector.Object} | 221 * @extends {WebInspector.Object} |
| 222 * @param {?string} expression | 222 * @param {?string} expression |
| 223 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er | 223 * @param {!WebInspector.ObjectPropertiesSectionExpandController} expandControll
er |
| 224 * @param {!WebInspector.Linkifier} linkifier | 224 * @param {!WebInspector.Linkifier} linkifier |
| 225 */ | 225 */ |
| 226 WebInspector.WatchExpression = function(expression, expandController, linkifier) | 226 WebInspector.WatchExpression = function(expression, expandController, linkifier) |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 contextMenu.appendApplicableItems(this._result); | 436 contextMenu.appendApplicableItems(this._result); |
| 437 }, | 437 }, |
| 438 | 438 |
| 439 _copyValueButtonClicked: function() | 439 _copyValueButtonClicked: function() |
| 440 { | 440 { |
| 441 InspectorFrontendHost.copyText(this._valueElement.textContent); | 441 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 442 }, | 442 }, |
| 443 | 443 |
| 444 __proto__: WebInspector.Object.prototype | 444 __proto__: WebInspector.Object.prototype |
| 445 } | 445 } |
| OLD | NEW |