@theia/memory-inspector 1.45.1 → 1.46.0-next.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -71
- package/lib/browser/diff-widget/memory-diff-options-widget.d.ts +36 -36
- package/lib/browser/diff-widget/memory-diff-options-widget.js +132 -132
- package/lib/browser/diff-widget/memory-diff-select-widget.d.ts +50 -50
- package/lib/browser/diff-widget/memory-diff-select-widget.js +137 -137
- package/lib/browser/diff-widget/memory-diff-table-widget.d.ts +77 -77
- package/lib/browser/diff-widget/memory-diff-table-widget.js +314 -314
- package/lib/browser/diff-widget/memory-diff-widget-types.d.ts +41 -41
- package/lib/browser/diff-widget/memory-diff-widget-types.js +23 -23
- package/lib/browser/editable-widget/memory-editable-table-widget.d.ts +64 -64
- package/lib/browser/editable-widget/memory-editable-table-widget.js +324 -324
- package/lib/browser/memory-inspector-frontend-contribution.d.ts +46 -46
- package/lib/browser/memory-inspector-frontend-contribution.js +291 -291
- package/lib/browser/memory-inspector-frontend-module.d.ts +21 -21
- package/lib/browser/memory-inspector-frontend-module.js +87 -87
- package/lib/browser/memory-provider/cdt-gdb-memory-provider.d.ts +35 -35
- package/lib/browser/memory-provider/cdt-gdb-memory-provider.js +136 -136
- package/lib/browser/memory-provider/memory-provider-service.d.ts +36 -36
- package/lib/browser/memory-provider/memory-provider-service.js +101 -101
- package/lib/browser/memory-provider/memory-provider.d.ts +65 -65
- package/lib/browser/memory-provider/memory-provider.js +96 -96
- package/lib/browser/memory-provider/memory-provider.spec.d.ts +16 -16
- package/lib/browser/memory-provider/memory-provider.spec.js +23 -23
- package/lib/browser/memory-widget/memory-options-widget.d.ts +136 -136
- package/lib/browser/memory-widget/memory-options-widget.js +564 -564
- package/lib/browser/memory-widget/memory-table-widget.d.ts +146 -146
- package/lib/browser/memory-widget/memory-table-widget.js +487 -487
- package/lib/browser/memory-widget/memory-widget.d.ts +33 -33
- package/lib/browser/memory-widget/memory-widget.js +112 -112
- package/lib/browser/register-widget/register-filter-service.d.ts +42 -42
- package/lib/browser/register-widget/register-filter-service.js +81 -81
- package/lib/browser/register-widget/register-options-widget.d.ts +81 -81
- package/lib/browser/register-widget/register-options-widget.js +338 -338
- package/lib/browser/register-widget/register-table-widget.d.ts +77 -77
- package/lib/browser/register-widget/register-table-widget.js +230 -230
- package/lib/browser/register-widget/register-widget-types.d.ts +29 -29
- package/lib/browser/register-widget/register-widget-types.js +35 -35
- package/lib/browser/utils/memory-commands.d.ts +27 -27
- package/lib/browser/utils/memory-commands.js +67 -67
- package/lib/browser/utils/memory-hover-renderer.d.ts +33 -33
- package/lib/browser/utils/memory-hover-renderer.js +111 -111
- package/lib/browser/utils/memory-recents.d.ts +27 -27
- package/lib/browser/utils/memory-recents.js +52 -52
- package/lib/browser/utils/memory-widget-components.d.ts +58 -58
- package/lib/browser/utils/memory-widget-components.js +69 -69
- package/lib/browser/utils/memory-widget-manager.d.ts +50 -50
- package/lib/browser/utils/memory-widget-manager.js +182 -182
- package/lib/browser/utils/memory-widget-utils.d.ts +113 -113
- package/lib/browser/utils/memory-widget-utils.js +42 -42
- package/lib/browser/utils/memory-widget-variable-utils.d.ts +57 -57
- package/lib/browser/utils/memory-widget-variable-utils.js +143 -143
- package/lib/browser/utils/multi-select-bar.d.ts +31 -31
- package/lib/browser/utils/multi-select-bar.js +34 -34
- package/lib/browser/wrapper-widgets/memory-dock-panel.d.ts +24 -24
- package/lib/browser/wrapper-widgets/memory-dock-panel.js +48 -48
- package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.d.ts +23 -23
- package/lib/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.js +57 -57
- package/lib/browser/wrapper-widgets/memory-layout-widget.d.ts +51 -51
- package/lib/browser/wrapper-widgets/memory-layout-widget.js +191 -191
- package/lib/common/util.d.ts +21 -21
- package/lib/common/util.js +30 -30
- package/lib/common/utils.spec.d.ts +16 -16
- package/lib/common/utils.spec.js +45 -45
- package/package.json +4 -4
- package/src/browser/diff-widget/memory-diff-options-widget.tsx +152 -152
- package/src/browser/diff-widget/memory-diff-select-widget.tsx +163 -163
- package/src/browser/diff-widget/memory-diff-table-widget.tsx +366 -366
- package/src/browser/diff-widget/memory-diff-widget-types.ts +45 -45
- package/src/browser/editable-widget/memory-editable-table-widget.tsx +359 -359
- package/src/browser/memory-inspector-frontend-contribution.ts +301 -301
- package/src/browser/memory-inspector-frontend-module.ts +118 -118
- package/src/browser/memory-provider/cdt-gdb-memory-provider.ts +132 -132
- package/src/browser/memory-provider/memory-provider-service.ts +86 -86
- package/src/browser/memory-provider/memory-provider.spec.ts +23 -23
- package/src/browser/memory-provider/memory-provider.ts +119 -119
- package/src/browser/memory-widget/memory-options-widget.tsx +738 -738
- package/src/browser/memory-widget/memory-table-widget.tsx +625 -625
- package/src/browser/memory-widget/memory-widget.ts +114 -114
- package/src/browser/register-widget/register-filter-service.ts +76 -76
- package/src/browser/register-widget/register-options-widget.tsx +393 -393
- package/src/browser/register-widget/register-table-widget.tsx +276 -276
- package/src/browser/register-widget/register-widget-types.ts +45 -45
- package/src/browser/register-widget/register-widget.css +34 -34
- package/src/browser/style/index.css +746 -746
- package/src/browser/style/memory-lock.svg +21 -21
- package/src/browser/style/memory-view.svg +20 -20
- package/src/browser/style/register-lock.svg +29 -29
- package/src/browser/style/register-view.svg +28 -28
- package/src/browser/utils/memory-commands.ts +76 -76
- package/src/browser/utils/memory-hover-renderer.ts +113 -113
- package/src/browser/utils/memory-recents.ts +58 -58
- package/src/browser/utils/memory-widget-components.tsx +193 -193
- package/src/browser/utils/memory-widget-manager.ts +179 -179
- package/src/browser/utils/memory-widget-utils.tsx +132 -132
- package/src/browser/utils/memory-widget-variable-utils.ts +170 -170
- package/src/browser/utils/multi-select-bar.css +61 -61
- package/src/browser/utils/multi-select-bar.tsx +75 -75
- package/src/browser/wrapper-widgets/memory-dock-panel.ts +51 -51
- package/src/browser/wrapper-widgets/memory-dockpanel-placeholder-widget.tsx +38 -38
- package/src/browser/wrapper-widgets/memory-layout-widget.tsx +167 -167
- package/src/common/util.ts +28 -28
- package/src/common/utils.spec.ts +52 -52
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MemoryWidgetManager = void 0;
|
|
13
|
-
/********************************************************************************
|
|
14
|
-
* Copyright (C) 2021 Ericsson and others.
|
|
15
|
-
*
|
|
16
|
-
* This program and the accompanying materials are made available under the
|
|
17
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
18
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
19
|
-
*
|
|
20
|
-
* This Source Code may also be made available under the following Secondary
|
|
21
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
22
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
23
|
-
* with the GNU Classpath Exception which is available at
|
|
24
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
25
|
-
*
|
|
26
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
27
|
-
********************************************************************************/
|
|
28
|
-
const core_1 = require("@theia/core");
|
|
29
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
-
const memory_diff_table_widget_1 = require("../diff-widget/memory-diff-table-widget");
|
|
32
|
-
const memory_widget_1 = require("../memory-widget/memory-widget");
|
|
33
|
-
const register_widget_types_1 = require("../register-widget/register-widget-types");
|
|
34
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
35
|
-
const memory_editable_table_widget_1 = require("../editable-widget/memory-editable-table-widget");
|
|
36
|
-
let MemoryWidgetManager = class MemoryWidgetManager {
|
|
37
|
-
constructor() {
|
|
38
|
-
this.createdWidgetCount = 0;
|
|
39
|
-
this.widgetDisplayId = 0;
|
|
40
|
-
this.toDispose = new core_1.DisposableCollection();
|
|
41
|
-
this.onNewWidgetCreated = new core_1.Emitter();
|
|
42
|
-
this.onDidCreateNewWidget = this.onNewWidgetCreated.event;
|
|
43
|
-
this.onSelectedWidgetChanged = new core_1.Emitter();
|
|
44
|
-
this.onDidChangeSelectedWidget = this.onSelectedWidgetChanged.event;
|
|
45
|
-
this.onChangedEmitter = new core_1.Emitter();
|
|
46
|
-
this.onChanged = this.onChangedEmitter.event;
|
|
47
|
-
this._availableWidgets = new Map();
|
|
48
|
-
this._canCompare = false;
|
|
49
|
-
}
|
|
50
|
-
get availableWidgets() {
|
|
51
|
-
return Array.from(this._availableWidgets.values());
|
|
52
|
-
}
|
|
53
|
-
get canCompare() {
|
|
54
|
-
return this._canCompare;
|
|
55
|
-
}
|
|
56
|
-
init() {
|
|
57
|
-
this.toDispose.pushAll([
|
|
58
|
-
this.shell.onDidChangeActiveWidget(({ newValue }) => {
|
|
59
|
-
if (newValue instanceof memory_widget_1.MemoryWidget) {
|
|
60
|
-
this._focusedWidget = newValue;
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
this.widgetManager.onDidCreateWidget(e => {
|
|
64
|
-
const { widget } = e;
|
|
65
|
-
if (widget instanceof memory_widget_1.MemoryWidget) {
|
|
66
|
-
this._availableWidgets.set(widget.id, widget);
|
|
67
|
-
this.toDispose.push(widget.onDidDispose(() => {
|
|
68
|
-
this._availableWidgets.delete(widget.id);
|
|
69
|
-
if (widget === this._focusedWidget) {
|
|
70
|
-
this.focusedWidget = undefined;
|
|
71
|
-
}
|
|
72
|
-
this.onChangedEmitter.fire();
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
}),
|
|
76
|
-
this.onChanged(() => this.setCanCompare()),
|
|
77
|
-
this.onNewWidgetCreated,
|
|
78
|
-
this.onChangedEmitter,
|
|
79
|
-
this.onSelectedWidgetChanged,
|
|
80
|
-
]);
|
|
81
|
-
}
|
|
82
|
-
get focusedWidget() {
|
|
83
|
-
var _a;
|
|
84
|
-
return (_a = this._focusedWidget) !== null && _a !== void 0 ? _a : this._availableWidgets.values().next().value;
|
|
85
|
-
}
|
|
86
|
-
set focusedWidget(title) {
|
|
87
|
-
this._focusedWidget = title;
|
|
88
|
-
this.onSelectedWidgetChanged.fire(title);
|
|
89
|
-
}
|
|
90
|
-
setCanCompare() {
|
|
91
|
-
this._canCompare = this.availableWidgets.filter(widget => !register_widget_types_1.RegisterWidget.is(widget) && !memory_diff_table_widget_1.MemoryDiffWidget.is(widget)).length > 1;
|
|
92
|
-
}
|
|
93
|
-
async createNewMemoryWidget(kind = 'memory') {
|
|
94
|
-
this.widgetDisplayId = this._availableWidgets.size !== 0 ? this.widgetDisplayId + 1 : 1;
|
|
95
|
-
const widget = await this.getWidgetOfKind(kind);
|
|
96
|
-
this._availableWidgets.set(widget.id, widget);
|
|
97
|
-
widget.title.changed.connect(() => this.onChangedEmitter.fire());
|
|
98
|
-
widget.activate();
|
|
99
|
-
this.fireNewWidget(widget);
|
|
100
|
-
return widget;
|
|
101
|
-
}
|
|
102
|
-
getWidgetOfKind(kind) {
|
|
103
|
-
const widgetId = this.getWidgetIdForKind(kind);
|
|
104
|
-
const options = this.getWidgetOptionsForId(widgetId);
|
|
105
|
-
return this.widgetManager.getOrCreateWidget(widgetId, options);
|
|
106
|
-
}
|
|
107
|
-
getWidgetIdForKind(kind) {
|
|
108
|
-
switch (kind) {
|
|
109
|
-
case 'register':
|
|
110
|
-
case register_widget_types_1.RegisterWidget.ID:
|
|
111
|
-
return register_widget_types_1.RegisterWidget.ID;
|
|
112
|
-
case 'writable':
|
|
113
|
-
case memory_editable_table_widget_1.EditableMemoryWidget.ID:
|
|
114
|
-
return memory_editable_table_widget_1.EditableMemoryWidget.ID;
|
|
115
|
-
default:
|
|
116
|
-
return memory_widget_1.MemoryWidget.ID;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
getWidgetOptionsForId(widgetId) {
|
|
120
|
-
return { identifier: this.createdWidgetCount += 1, displayId: this.widgetDisplayId };
|
|
121
|
-
}
|
|
122
|
-
dispose() {
|
|
123
|
-
this.toDispose.dispose();
|
|
124
|
-
}
|
|
125
|
-
fireNewWidget(widget) {
|
|
126
|
-
this.onNewWidgetCreated.fire(widget);
|
|
127
|
-
this.onChangedEmitter.fire();
|
|
128
|
-
}
|
|
129
|
-
async doDiff(options) {
|
|
130
|
-
if (options.beforeBytes.length === 0) {
|
|
131
|
-
// eslint-disable-next-line max-len
|
|
132
|
-
const beforeBytesMessage = nls_1.nls.localize('theia/memory-inspector/utils/bytesMessage', 'You must load memory in both widgets you would like to compare. {0} has no memory loaded.', options.titles[0]);
|
|
133
|
-
this.messageService.warn(beforeBytesMessage);
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
else if (options.afterBytes.length === 0) {
|
|
137
|
-
// eslint-disable-next-line max-len
|
|
138
|
-
const afterBytesMessage = nls_1.nls.localize('theia/memory-inspector/utils/afterBytes', 'You must load memory in both widgets you would like to compare. {0} has no memory loaded.', options.titles[1]);
|
|
139
|
-
this.messageService.warn(afterBytesMessage);
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
const fullOptions = { ...options, dynamic: false, identifier: options.titles.join('-') };
|
|
143
|
-
const existingWidget = this._availableWidgets.get(memory_widget_1.MemoryWidget.getIdentifier(fullOptions.identifier.toString()));
|
|
144
|
-
if (existingWidget && existingWidget.tableWidget instanceof memory_diff_table_widget_1.MemoryDiffTableWidget) {
|
|
145
|
-
existingWidget.tableWidget.updateDiffData(options);
|
|
146
|
-
}
|
|
147
|
-
const widget = existingWidget !== null && existingWidget !== void 0 ? existingWidget : await this.widgetManager
|
|
148
|
-
.getOrCreateWidget(memory_diff_table_widget_1.MemoryDiffWidget.ID, { ...options, dynamic: false, identifier: options.titles.join('-') });
|
|
149
|
-
const tabBar = this.shell.getTabBarFor(widget);
|
|
150
|
-
if (!tabBar) {
|
|
151
|
-
// The widget is not attached yet, so add it to the shell
|
|
152
|
-
const widgetArgs = {
|
|
153
|
-
area: 'main',
|
|
154
|
-
};
|
|
155
|
-
await this.shell.addWidget(widget, widgetArgs);
|
|
156
|
-
}
|
|
157
|
-
await this.shell.activateWidget(widget.id);
|
|
158
|
-
return widget;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
__decorate([
|
|
162
|
-
(0, inversify_1.inject)(browser_1.WidgetManager),
|
|
163
|
-
__metadata("design:type", browser_1.WidgetManager)
|
|
164
|
-
], MemoryWidgetManager.prototype, "widgetManager", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
167
|
-
__metadata("design:type", browser_1.ApplicationShell)
|
|
168
|
-
], MemoryWidgetManager.prototype, "shell", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
(0, inversify_1.inject)(core_1.MessageService),
|
|
171
|
-
__metadata("design:type", core_1.MessageService)
|
|
172
|
-
], MemoryWidgetManager.prototype, "messageService", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
(0, inversify_1.postConstruct)(),
|
|
175
|
-
__metadata("design:type", Function),
|
|
176
|
-
__metadata("design:paramtypes", []),
|
|
177
|
-
__metadata("design:returntype", void 0)
|
|
178
|
-
], MemoryWidgetManager.prototype, "init", null);
|
|
179
|
-
MemoryWidgetManager = __decorate([
|
|
180
|
-
(0, inversify_1.injectable)()
|
|
181
|
-
], MemoryWidgetManager);
|
|
182
|
-
exports.MemoryWidgetManager = MemoryWidgetManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MemoryWidgetManager = void 0;
|
|
13
|
+
/********************************************************************************
|
|
14
|
+
* Copyright (C) 2021 Ericsson and others.
|
|
15
|
+
*
|
|
16
|
+
* This program and the accompanying materials are made available under the
|
|
17
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
18
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
19
|
+
*
|
|
20
|
+
* This Source Code may also be made available under the following Secondary
|
|
21
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
22
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
23
|
+
* with the GNU Classpath Exception which is available at
|
|
24
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
25
|
+
*
|
|
26
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
27
|
+
********************************************************************************/
|
|
28
|
+
const core_1 = require("@theia/core");
|
|
29
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
30
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
+
const memory_diff_table_widget_1 = require("../diff-widget/memory-diff-table-widget");
|
|
32
|
+
const memory_widget_1 = require("../memory-widget/memory-widget");
|
|
33
|
+
const register_widget_types_1 = require("../register-widget/register-widget-types");
|
|
34
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
35
|
+
const memory_editable_table_widget_1 = require("../editable-widget/memory-editable-table-widget");
|
|
36
|
+
let MemoryWidgetManager = class MemoryWidgetManager {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.createdWidgetCount = 0;
|
|
39
|
+
this.widgetDisplayId = 0;
|
|
40
|
+
this.toDispose = new core_1.DisposableCollection();
|
|
41
|
+
this.onNewWidgetCreated = new core_1.Emitter();
|
|
42
|
+
this.onDidCreateNewWidget = this.onNewWidgetCreated.event;
|
|
43
|
+
this.onSelectedWidgetChanged = new core_1.Emitter();
|
|
44
|
+
this.onDidChangeSelectedWidget = this.onSelectedWidgetChanged.event;
|
|
45
|
+
this.onChangedEmitter = new core_1.Emitter();
|
|
46
|
+
this.onChanged = this.onChangedEmitter.event;
|
|
47
|
+
this._availableWidgets = new Map();
|
|
48
|
+
this._canCompare = false;
|
|
49
|
+
}
|
|
50
|
+
get availableWidgets() {
|
|
51
|
+
return Array.from(this._availableWidgets.values());
|
|
52
|
+
}
|
|
53
|
+
get canCompare() {
|
|
54
|
+
return this._canCompare;
|
|
55
|
+
}
|
|
56
|
+
init() {
|
|
57
|
+
this.toDispose.pushAll([
|
|
58
|
+
this.shell.onDidChangeActiveWidget(({ newValue }) => {
|
|
59
|
+
if (newValue instanceof memory_widget_1.MemoryWidget) {
|
|
60
|
+
this._focusedWidget = newValue;
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
this.widgetManager.onDidCreateWidget(e => {
|
|
64
|
+
const { widget } = e;
|
|
65
|
+
if (widget instanceof memory_widget_1.MemoryWidget) {
|
|
66
|
+
this._availableWidgets.set(widget.id, widget);
|
|
67
|
+
this.toDispose.push(widget.onDidDispose(() => {
|
|
68
|
+
this._availableWidgets.delete(widget.id);
|
|
69
|
+
if (widget === this._focusedWidget) {
|
|
70
|
+
this.focusedWidget = undefined;
|
|
71
|
+
}
|
|
72
|
+
this.onChangedEmitter.fire();
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
this.onChanged(() => this.setCanCompare()),
|
|
77
|
+
this.onNewWidgetCreated,
|
|
78
|
+
this.onChangedEmitter,
|
|
79
|
+
this.onSelectedWidgetChanged,
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
get focusedWidget() {
|
|
83
|
+
var _a;
|
|
84
|
+
return (_a = this._focusedWidget) !== null && _a !== void 0 ? _a : this._availableWidgets.values().next().value;
|
|
85
|
+
}
|
|
86
|
+
set focusedWidget(title) {
|
|
87
|
+
this._focusedWidget = title;
|
|
88
|
+
this.onSelectedWidgetChanged.fire(title);
|
|
89
|
+
}
|
|
90
|
+
setCanCompare() {
|
|
91
|
+
this._canCompare = this.availableWidgets.filter(widget => !register_widget_types_1.RegisterWidget.is(widget) && !memory_diff_table_widget_1.MemoryDiffWidget.is(widget)).length > 1;
|
|
92
|
+
}
|
|
93
|
+
async createNewMemoryWidget(kind = 'memory') {
|
|
94
|
+
this.widgetDisplayId = this._availableWidgets.size !== 0 ? this.widgetDisplayId + 1 : 1;
|
|
95
|
+
const widget = await this.getWidgetOfKind(kind);
|
|
96
|
+
this._availableWidgets.set(widget.id, widget);
|
|
97
|
+
widget.title.changed.connect(() => this.onChangedEmitter.fire());
|
|
98
|
+
widget.activate();
|
|
99
|
+
this.fireNewWidget(widget);
|
|
100
|
+
return widget;
|
|
101
|
+
}
|
|
102
|
+
getWidgetOfKind(kind) {
|
|
103
|
+
const widgetId = this.getWidgetIdForKind(kind);
|
|
104
|
+
const options = this.getWidgetOptionsForId(widgetId);
|
|
105
|
+
return this.widgetManager.getOrCreateWidget(widgetId, options);
|
|
106
|
+
}
|
|
107
|
+
getWidgetIdForKind(kind) {
|
|
108
|
+
switch (kind) {
|
|
109
|
+
case 'register':
|
|
110
|
+
case register_widget_types_1.RegisterWidget.ID:
|
|
111
|
+
return register_widget_types_1.RegisterWidget.ID;
|
|
112
|
+
case 'writable':
|
|
113
|
+
case memory_editable_table_widget_1.EditableMemoryWidget.ID:
|
|
114
|
+
return memory_editable_table_widget_1.EditableMemoryWidget.ID;
|
|
115
|
+
default:
|
|
116
|
+
return memory_widget_1.MemoryWidget.ID;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
getWidgetOptionsForId(widgetId) {
|
|
120
|
+
return { identifier: this.createdWidgetCount += 1, displayId: this.widgetDisplayId };
|
|
121
|
+
}
|
|
122
|
+
dispose() {
|
|
123
|
+
this.toDispose.dispose();
|
|
124
|
+
}
|
|
125
|
+
fireNewWidget(widget) {
|
|
126
|
+
this.onNewWidgetCreated.fire(widget);
|
|
127
|
+
this.onChangedEmitter.fire();
|
|
128
|
+
}
|
|
129
|
+
async doDiff(options) {
|
|
130
|
+
if (options.beforeBytes.length === 0) {
|
|
131
|
+
// eslint-disable-next-line max-len
|
|
132
|
+
const beforeBytesMessage = nls_1.nls.localize('theia/memory-inspector/utils/bytesMessage', 'You must load memory in both widgets you would like to compare. {0} has no memory loaded.', options.titles[0]);
|
|
133
|
+
this.messageService.warn(beforeBytesMessage);
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
else if (options.afterBytes.length === 0) {
|
|
137
|
+
// eslint-disable-next-line max-len
|
|
138
|
+
const afterBytesMessage = nls_1.nls.localize('theia/memory-inspector/utils/afterBytes', 'You must load memory in both widgets you would like to compare. {0} has no memory loaded.', options.titles[1]);
|
|
139
|
+
this.messageService.warn(afterBytesMessage);
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const fullOptions = { ...options, dynamic: false, identifier: options.titles.join('-') };
|
|
143
|
+
const existingWidget = this._availableWidgets.get(memory_widget_1.MemoryWidget.getIdentifier(fullOptions.identifier.toString()));
|
|
144
|
+
if (existingWidget && existingWidget.tableWidget instanceof memory_diff_table_widget_1.MemoryDiffTableWidget) {
|
|
145
|
+
existingWidget.tableWidget.updateDiffData(options);
|
|
146
|
+
}
|
|
147
|
+
const widget = existingWidget !== null && existingWidget !== void 0 ? existingWidget : await this.widgetManager
|
|
148
|
+
.getOrCreateWidget(memory_diff_table_widget_1.MemoryDiffWidget.ID, { ...options, dynamic: false, identifier: options.titles.join('-') });
|
|
149
|
+
const tabBar = this.shell.getTabBarFor(widget);
|
|
150
|
+
if (!tabBar) {
|
|
151
|
+
// The widget is not attached yet, so add it to the shell
|
|
152
|
+
const widgetArgs = {
|
|
153
|
+
area: 'main',
|
|
154
|
+
};
|
|
155
|
+
await this.shell.addWidget(widget, widgetArgs);
|
|
156
|
+
}
|
|
157
|
+
await this.shell.activateWidget(widget.id);
|
|
158
|
+
return widget;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, inversify_1.inject)(browser_1.WidgetManager),
|
|
163
|
+
__metadata("design:type", browser_1.WidgetManager)
|
|
164
|
+
], MemoryWidgetManager.prototype, "widgetManager", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, inversify_1.inject)(browser_1.ApplicationShell),
|
|
167
|
+
__metadata("design:type", browser_1.ApplicationShell)
|
|
168
|
+
], MemoryWidgetManager.prototype, "shell", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, inversify_1.inject)(core_1.MessageService),
|
|
171
|
+
__metadata("design:type", core_1.MessageService)
|
|
172
|
+
], MemoryWidgetManager.prototype, "messageService", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, inversify_1.postConstruct)(),
|
|
175
|
+
__metadata("design:type", Function),
|
|
176
|
+
__metadata("design:paramtypes", []),
|
|
177
|
+
__metadata("design:returntype", void 0)
|
|
178
|
+
], MemoryWidgetManager.prototype, "init", null);
|
|
179
|
+
MemoryWidgetManager = __decorate([
|
|
180
|
+
(0, inversify_1.injectable)()
|
|
181
|
+
], MemoryWidgetManager);
|
|
182
|
+
exports.MemoryWidgetManager = MemoryWidgetManager;
|
|
183
183
|
//# sourceMappingURL=memory-widget-manager.js.map
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2021 Ericsson and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
/// <reference types="react" />
|
|
17
|
-
import * as Long from 'long';
|
|
18
|
-
import { VariableRange, VariableDecoration } from './memory-widget-variable-utils';
|
|
19
|
-
export declare namespace Constants {
|
|
20
|
-
const DEBOUNCE_TIME = 200;
|
|
21
|
-
const ERROR_TIMEOUT = 5000;
|
|
22
|
-
}
|
|
23
|
-
export declare namespace Utils {
|
|
24
|
-
const validateNumericalInputs: (e: React.ChangeEvent<HTMLInputElement>, allowNegative?: boolean) => void;
|
|
25
|
-
const isPrintableAsAscii: (byte: number) => boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare namespace Interfaces {
|
|
28
|
-
interface MemoryReadResult {
|
|
29
|
-
bytes: LabeledUint8Array;
|
|
30
|
-
address: Long;
|
|
31
|
-
}
|
|
32
|
-
interface WidgetMemoryState extends MemoryReadResult {
|
|
33
|
-
variables: VariableRange[];
|
|
34
|
-
}
|
|
35
|
-
interface MemoryOptions {
|
|
36
|
-
address: string | number;
|
|
37
|
-
offset: number;
|
|
38
|
-
length: number;
|
|
39
|
-
byteSize: number;
|
|
40
|
-
bytesPerGroup: number;
|
|
41
|
-
groupsPerRow: number;
|
|
42
|
-
endianness: Endianness;
|
|
43
|
-
doDisplaySettings: boolean;
|
|
44
|
-
doUpdateAutomatically: boolean;
|
|
45
|
-
columnsDisplayed: ColumnsDisplayed;
|
|
46
|
-
recentLocationsArray: string[];
|
|
47
|
-
isFrozen: boolean;
|
|
48
|
-
}
|
|
49
|
-
interface MoreMemoryOptions {
|
|
50
|
-
numBytes: number;
|
|
51
|
-
direction: 'above' | 'below';
|
|
52
|
-
}
|
|
53
|
-
enum Endianness {
|
|
54
|
-
Little = "Little Endian",
|
|
55
|
-
Big = "Big Endian"
|
|
56
|
-
}
|
|
57
|
-
interface LabeledUint8Array extends Uint8Array {
|
|
58
|
-
label?: string;
|
|
59
|
-
}
|
|
60
|
-
interface StylableNodeAttributes {
|
|
61
|
-
className?: string;
|
|
62
|
-
style?: React.CSSProperties;
|
|
63
|
-
variable?: VariableDecoration;
|
|
64
|
-
title?: string;
|
|
65
|
-
isHighlighted?: boolean;
|
|
66
|
-
}
|
|
67
|
-
interface FullNodeAttributes extends StylableNodeAttributes {
|
|
68
|
-
content: string;
|
|
69
|
-
}
|
|
70
|
-
interface BitDecorator {
|
|
71
|
-
(...args: any[]): Partial<FullNodeAttributes>;
|
|
72
|
-
}
|
|
73
|
-
interface RowDecorator {
|
|
74
|
-
(...args: any[]): Partial<StylableNodeAttributes>;
|
|
75
|
-
}
|
|
76
|
-
interface ByteFromChunkData {
|
|
77
|
-
address: Long;
|
|
78
|
-
/**
|
|
79
|
-
* A single eight-bit byte
|
|
80
|
-
*/
|
|
81
|
-
value: string;
|
|
82
|
-
}
|
|
83
|
-
interface Column {
|
|
84
|
-
label: string;
|
|
85
|
-
doRender: boolean;
|
|
86
|
-
}
|
|
87
|
-
interface ColumnIDs {
|
|
88
|
-
label: string;
|
|
89
|
-
id: string;
|
|
90
|
-
}
|
|
91
|
-
interface ColumnsDisplayed {
|
|
92
|
-
[id: string]: Column;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export declare const MemoryWidgetOptions: unique symbol;
|
|
96
|
-
export interface MemoryWidgetOptions {
|
|
97
|
-
identifier: string | number;
|
|
98
|
-
displayId?: string | number;
|
|
99
|
-
dynamic?: boolean;
|
|
100
|
-
}
|
|
101
|
-
export declare const MemoryDiffWidgetData: unique symbol;
|
|
102
|
-
export interface MemoryDiffWidgetData extends MemoryWidgetOptions {
|
|
103
|
-
beforeAddress: Long;
|
|
104
|
-
beforeBytes: Interfaces.LabeledUint8Array;
|
|
105
|
-
beforeVariables: VariableRange[];
|
|
106
|
-
afterAddress: Long;
|
|
107
|
-
afterBytes: Interfaces.LabeledUint8Array;
|
|
108
|
-
afterVariables: VariableRange[];
|
|
109
|
-
dynamic: false;
|
|
110
|
-
titles: [string, string];
|
|
111
|
-
}
|
|
112
|
-
export declare const RegisterWidgetOptions: unique symbol;
|
|
113
|
-
export declare type RegisterWidgetOptions = MemoryWidgetOptions;
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2021 Ericsson and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
/// <reference types="react" />
|
|
17
|
+
import * as Long from 'long';
|
|
18
|
+
import { VariableRange, VariableDecoration } from './memory-widget-variable-utils';
|
|
19
|
+
export declare namespace Constants {
|
|
20
|
+
const DEBOUNCE_TIME = 200;
|
|
21
|
+
const ERROR_TIMEOUT = 5000;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace Utils {
|
|
24
|
+
const validateNumericalInputs: (e: React.ChangeEvent<HTMLInputElement>, allowNegative?: boolean) => void;
|
|
25
|
+
const isPrintableAsAscii: (byte: number) => boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace Interfaces {
|
|
28
|
+
interface MemoryReadResult {
|
|
29
|
+
bytes: LabeledUint8Array;
|
|
30
|
+
address: Long;
|
|
31
|
+
}
|
|
32
|
+
interface WidgetMemoryState extends MemoryReadResult {
|
|
33
|
+
variables: VariableRange[];
|
|
34
|
+
}
|
|
35
|
+
interface MemoryOptions {
|
|
36
|
+
address: string | number;
|
|
37
|
+
offset: number;
|
|
38
|
+
length: number;
|
|
39
|
+
byteSize: number;
|
|
40
|
+
bytesPerGroup: number;
|
|
41
|
+
groupsPerRow: number;
|
|
42
|
+
endianness: Endianness;
|
|
43
|
+
doDisplaySettings: boolean;
|
|
44
|
+
doUpdateAutomatically: boolean;
|
|
45
|
+
columnsDisplayed: ColumnsDisplayed;
|
|
46
|
+
recentLocationsArray: string[];
|
|
47
|
+
isFrozen: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface MoreMemoryOptions {
|
|
50
|
+
numBytes: number;
|
|
51
|
+
direction: 'above' | 'below';
|
|
52
|
+
}
|
|
53
|
+
enum Endianness {
|
|
54
|
+
Little = "Little Endian",
|
|
55
|
+
Big = "Big Endian"
|
|
56
|
+
}
|
|
57
|
+
interface LabeledUint8Array extends Uint8Array {
|
|
58
|
+
label?: string;
|
|
59
|
+
}
|
|
60
|
+
interface StylableNodeAttributes {
|
|
61
|
+
className?: string;
|
|
62
|
+
style?: React.CSSProperties;
|
|
63
|
+
variable?: VariableDecoration;
|
|
64
|
+
title?: string;
|
|
65
|
+
isHighlighted?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface FullNodeAttributes extends StylableNodeAttributes {
|
|
68
|
+
content: string;
|
|
69
|
+
}
|
|
70
|
+
interface BitDecorator {
|
|
71
|
+
(...args: any[]): Partial<FullNodeAttributes>;
|
|
72
|
+
}
|
|
73
|
+
interface RowDecorator {
|
|
74
|
+
(...args: any[]): Partial<StylableNodeAttributes>;
|
|
75
|
+
}
|
|
76
|
+
interface ByteFromChunkData {
|
|
77
|
+
address: Long;
|
|
78
|
+
/**
|
|
79
|
+
* A single eight-bit byte
|
|
80
|
+
*/
|
|
81
|
+
value: string;
|
|
82
|
+
}
|
|
83
|
+
interface Column {
|
|
84
|
+
label: string;
|
|
85
|
+
doRender: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ColumnIDs {
|
|
88
|
+
label: string;
|
|
89
|
+
id: string;
|
|
90
|
+
}
|
|
91
|
+
interface ColumnsDisplayed {
|
|
92
|
+
[id: string]: Column;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export declare const MemoryWidgetOptions: unique symbol;
|
|
96
|
+
export interface MemoryWidgetOptions {
|
|
97
|
+
identifier: string | number;
|
|
98
|
+
displayId?: string | number;
|
|
99
|
+
dynamic?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare const MemoryDiffWidgetData: unique symbol;
|
|
102
|
+
export interface MemoryDiffWidgetData extends MemoryWidgetOptions {
|
|
103
|
+
beforeAddress: Long;
|
|
104
|
+
beforeBytes: Interfaces.LabeledUint8Array;
|
|
105
|
+
beforeVariables: VariableRange[];
|
|
106
|
+
afterAddress: Long;
|
|
107
|
+
afterBytes: Interfaces.LabeledUint8Array;
|
|
108
|
+
afterVariables: VariableRange[];
|
|
109
|
+
dynamic: false;
|
|
110
|
+
titles: [string, string];
|
|
111
|
+
}
|
|
112
|
+
export declare const RegisterWidgetOptions: unique symbol;
|
|
113
|
+
export declare type RegisterWidgetOptions = MemoryWidgetOptions;
|
|
114
114
|
//# sourceMappingURL=memory-widget-utils.d.ts.map
|