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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.SidebarPane} | 33 * @extends {WebInspector.SidebarPane} |
34 */ | 34 */ |
35 WebInspector.WatchExpressionsSidebarPane = function() | 35 WebInspector.WatchExpressionsSidebarPane = function() |
36 { | 36 { |
37 WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions
")); | 37 WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions
")); |
38 | 38 |
39 this.section = new WebInspector.WatchExpressionsSection(); | 39 /** @type {!WebInspector.ObjectPropertiesMemento} */ |
| 40 this.memento = new WebInspector.ObjectPropertiesMemento(); |
| 41 |
| 42 this.section = new WebInspector.WatchExpressionsSection(this.memento); |
40 this.bodyElement.appendChild(this.section.element); | 43 this.bodyElement.appendChild(this.section.element); |
41 | 44 |
42 var refreshButton = this.titleElement.createChild("button", "pane-title-butt
on refresh"); | 45 var refreshButton = this.titleElement.createChild("button", "pane-title-butt
on refresh"); |
43 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
), false); | 46 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
), false); |
44 refreshButton.title = WebInspector.UIString("Refresh"); | 47 refreshButton.title = WebInspector.UIString("Refresh"); |
45 | 48 |
46 var addButton = this.titleElement.createChild("button", "pane-title-button a
dd"); | 49 var addButton = this.titleElement.createChild("button", "pane-title-button a
dd"); |
47 addButton.addEventListener("click", this._addButtonClicked.bind(this), false
); | 50 addButton.addEventListener("click", this._addButtonClicked.bind(this), false
); |
48 addButton.title = WebInspector.UIString("Add watch expression"); | 51 addButton.title = WebInspector.UIString("Add watch expression"); |
49 | 52 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 event.consume(); | 96 event.consume(); |
94 this.refreshExpressions(); | 97 this.refreshExpressions(); |
95 }, | 98 }, |
96 | 99 |
97 __proto__: WebInspector.SidebarPane.prototype | 100 __proto__: WebInspector.SidebarPane.prototype |
98 } | 101 } |
99 | 102 |
100 /** | 103 /** |
101 * @constructor | 104 * @constructor |
102 * @extends {WebInspector.PropertiesSection} | 105 * @extends {WebInspector.PropertiesSection} |
| 106 * @param {!WebInspector.ObjectPropertiesMemento} memento |
103 */ | 107 */ |
104 WebInspector.WatchExpressionsSection = function() | 108 WebInspector.WatchExpressionsSection = function(memento) |
105 { | 109 { |
106 this._watchObjectGroupId = "watch-group"; | 110 this._watchObjectGroupId = "watch-group"; |
107 | 111 |
108 WebInspector.PropertiesSection.call(this, ""); | 112 WebInspector.PropertiesSection.call(this, ""); |
| 113 |
| 114 this.memento = memento; |
| 115 |
109 this.treeElementConstructor = WebInspector.ObjectPropertyTreeElement; | 116 this.treeElementConstructor = WebInspector.ObjectPropertyTreeElement; |
110 this.skipProto = false; | 117 this.skipProto = false; |
111 | 118 |
112 this.emptyElement = createElementWithClass("div", "info"); | 119 this.emptyElement = createElementWithClass("div", "info"); |
113 this.emptyElement.textContent = WebInspector.UIString("No Watch Expressions"
); | 120 this.emptyElement.textContent = WebInspector.UIString("No Watch Expressions"
); |
114 | 121 |
115 /** @type {!Array.<string>} */ | 122 /** @type {!Array.<string>} */ |
116 this.watchExpressions = WebInspector.settings.watchExpressions.get(); | 123 this.watchExpressions = WebInspector.settings.watchExpressions.get(); |
117 | 124 |
118 this.headerElement.className = "hidden"; | 125 this.headerElement.className = "hidden"; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 this.element.appendChild(this.propertiesElement); | 222 this.element.appendChild(this.propertiesElement); |
216 this.emptyElement.remove(); | 223 this.emptyElement.remove(); |
217 } | 224 } |
218 }, | 225 }, |
219 | 226 |
220 /** | 227 /** |
221 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties | 228 * @param {!Array.<!WebInspector.RemoteObjectProperty>} properties |
222 */ | 229 */ |
223 updateProperties: function(properties) | 230 updateProperties: function(properties) |
224 { | 231 { |
| 232 this.memento.forgetProperties(); |
| 233 |
225 this.propertiesTreeOutline.removeChildren(); | 234 this.propertiesTreeOutline.removeChildren(); |
226 WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.prope
rtiesTreeOutline, properties, [], | 235 WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.prope
rtiesTreeOutline, properties, [], |
227 WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressio
nsSection.CompareProperties, false, null); | 236 WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressio
nsSection.CompareProperties, false, null); |
228 | 237 |
229 this.propertiesForTest = properties; | 238 this.propertiesForTest = properties; |
230 }, | 239 }, |
231 | 240 |
232 /** | 241 /** |
233 * @param {string} expression | 242 * @param {string} expression |
234 */ | 243 */ |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 */ | 489 */ |
481 applyExpression: function(expression) | 490 applyExpression: function(expression) |
482 { | 491 { |
483 expression = expression.trim(); | 492 expression = expression.trim(); |
484 this.property.name = expression || null; | 493 this.property.name = expression || null; |
485 this.treeOutline.section.updateExpression(this, expression); | 494 this.treeOutline.section.updateExpression(this, expression); |
486 }, | 495 }, |
487 | 496 |
488 __proto__: WebInspector.ObjectPropertyTreeElement.prototype | 497 __proto__: WebInspector.ObjectPropertyTreeElement.prototype |
489 } | 498 } |
OLD | NEW |