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 25 matching lines...) Expand all Loading... |
36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget { | 36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget { |
37 constructor() { | 37 constructor() { |
38 super(); | 38 super(); |
39 this.registerRequiredCSS('components/objectValue.css'); | 39 this.registerRequiredCSS('components/objectValue.css'); |
40 | 40 |
41 /** @type {!Array.<!Sources.WatchExpression>} */ | 41 /** @type {!Array.<!Sources.WatchExpression>} */ |
42 this._watchExpressions = []; | 42 this._watchExpressions = []; |
43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp
ressions', []); | 43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp
ressions', []); |
44 | 44 |
45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l
argeicon-add'); | 45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l
argeicon-add'); |
46 this._addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addBut
tonClicked.bind(this)); | 46 this._addButton.addEventListener('click', this._addButtonClicked.bind(this))
; |
47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); | 47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); |
48 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this.upd
ate, this); | 48 this._refreshButton.addEventListener('click', this._refreshButtonClicked.bin
d(this)); |
49 | 49 |
50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions'
); | 50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions'
); |
51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi
s), false); | 51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi
s), false); |
52 this._expandController = new Components.ObjectPropertiesSectionExpandControl
ler(); | 52 this._expandController = new Components.ObjectPropertiesSectionExpandControl
ler(); |
53 | 53 |
54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this); | 54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this); |
55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update,
this); | 55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update,
this); |
56 this._linkifier = new Components.Linkifier(); | 56 this._linkifier = new Components.Linkifier(); |
57 this.update(); | 57 this.update(); |
58 } | 58 } |
(...skipping 16 matching lines...) Expand all Loading... |
75 _saveExpressions() { | 75 _saveExpressions() { |
76 var toSave = []; | 76 var toSave = []; |
77 for (var i = 0; i < this._watchExpressions.length; i++) { | 77 for (var i = 0; i < this._watchExpressions.length; i++) { |
78 if (this._watchExpressions[i].expression()) | 78 if (this._watchExpressions[i].expression()) |
79 toSave.push(this._watchExpressions[i].expression()); | 79 toSave.push(this._watchExpressions[i].expression()); |
80 } | 80 } |
81 | 81 |
82 this._watchExpressionsSetting.set(toSave); | 82 this._watchExpressionsSetting.set(toSave); |
83 } | 83 } |
84 | 84 |
85 _addButtonClicked() { | 85 /** |
| 86 * @param {!Common.Event=} event |
| 87 */ |
| 88 _addButtonClicked(event) { |
| 89 if (event) |
| 90 event.consume(true); |
86 UI.viewManager.showView('sources.watch'); | 91 UI.viewManager.showView('sources.watch'); |
87 this._createWatchExpression(null).startEditing(); | 92 this._createWatchExpression(null).startEditing(); |
88 } | 93 } |
89 | 94 |
90 /** | 95 /** |
| 96 * @param {!Common.Event} event |
| 97 */ |
| 98 _refreshButtonClicked(event) { |
| 99 event.consume(); |
| 100 this.update(); |
| 101 } |
| 102 |
| 103 /** |
91 * @override | 104 * @override |
92 * @return {!Promise.<?>} | 105 * @return {!Promise.<?>} |
93 */ | 106 */ |
94 doUpdate() { | 107 doUpdate() { |
95 this._linkifier.reset(); | 108 this._linkifier.reset(); |
96 this._bodyElement.removeChildren(); | 109 this._bodyElement.removeChildren(); |
97 this._watchExpressions = []; | 110 this._watchExpressions = []; |
98 this._emptyElement = this._bodyElement.createChild('div', 'gray-info-message
'); | 111 this._emptyElement = this._bodyElement.createChild('div', 'gray-info-message
'); |
99 this._emptyElement.textContent = Common.UIString('No Watch Expressions'); | 112 this._emptyElement.textContent = Common.UIString('No Watch Expressions'); |
100 var watchExpressionStrings = this._watchExpressionsSetting.get(); | 113 var watchExpressionStrings = this._watchExpressionsSetting.get(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 InspectorFrontendHost.copyText(this._valueElement.textContent); | 430 InspectorFrontendHost.copyText(this._valueElement.textContent); |
418 } | 431 } |
419 }; | 432 }; |
420 | 433 |
421 Sources.WatchExpression._watchObjectGroupId = 'watch-group'; | 434 Sources.WatchExpression._watchObjectGroupId = 'watch-group'; |
422 | 435 |
423 /** @enum {symbol} */ | 436 /** @enum {symbol} */ |
424 Sources.WatchExpression.Events = { | 437 Sources.WatchExpression.Events = { |
425 ExpressionUpdated: Symbol('ExpressionUpdated') | 438 ExpressionUpdated: Symbol('ExpressionUpdated') |
426 }; | 439 }; |
OLD | NEW |