@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,51 +1,51 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2019 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
|
-
|
|
17
|
-
import { DockPanelRendererFactory } from '@theia/core/lib/browser';
|
|
18
|
-
import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel';
|
|
19
|
-
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
|
-
|
|
21
|
-
export class MemoryDockPanel extends TheiaDockPanel {
|
|
22
|
-
override toggleMaximized(): void { /* don't */ }
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export namespace MemoryDockPanel {
|
|
26
|
-
export const ID = 'memory-dock-panel-widget';
|
|
27
|
-
const DOCK_PANEL_ID = 'theia-main-content-panel';
|
|
28
|
-
const THEIA_TABBAR_CLASSES = ['theia-app-centers', 'theia-app-main'];
|
|
29
|
-
const MEMORY_INSPECTOR_TABBAR_CLASS = 'memory-dock-tabbar';
|
|
30
|
-
const DOCK_PANEL_CLASS = 'memory-dock-panel';
|
|
31
|
-
|
|
32
|
-
const createDockPanel = (factory: DockPanelRendererFactory): MemoryDockPanel => {
|
|
33
|
-
const renderer = factory();
|
|
34
|
-
renderer.tabBarClasses.push(...THEIA_TABBAR_CLASSES, MEMORY_INSPECTOR_TABBAR_CLASS);
|
|
35
|
-
const dockPanel = new MemoryDockPanel({
|
|
36
|
-
mode: 'multiple-document',
|
|
37
|
-
renderer,
|
|
38
|
-
spacing: 0,
|
|
39
|
-
});
|
|
40
|
-
dockPanel.addClass(DOCK_PANEL_CLASS);
|
|
41
|
-
dockPanel.id = DOCK_PANEL_ID;
|
|
42
|
-
|
|
43
|
-
return dockPanel;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const createWidget = (parent: interfaces.Container): MemoryDockPanel => {
|
|
47
|
-
const dockFactory = parent.get<DockPanelRendererFactory>(DockPanelRendererFactory);
|
|
48
|
-
const dockPanel = createDockPanel(dockFactory);
|
|
49
|
-
return dockPanel;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2019 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
|
+
|
|
17
|
+
import { DockPanelRendererFactory } from '@theia/core/lib/browser';
|
|
18
|
+
import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel';
|
|
19
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
|
+
|
|
21
|
+
export class MemoryDockPanel extends TheiaDockPanel {
|
|
22
|
+
override toggleMaximized(): void { /* don't */ }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export namespace MemoryDockPanel {
|
|
26
|
+
export const ID = 'memory-dock-panel-widget';
|
|
27
|
+
const DOCK_PANEL_ID = 'theia-main-content-panel';
|
|
28
|
+
const THEIA_TABBAR_CLASSES = ['theia-app-centers', 'theia-app-main'];
|
|
29
|
+
const MEMORY_INSPECTOR_TABBAR_CLASS = 'memory-dock-tabbar';
|
|
30
|
+
const DOCK_PANEL_CLASS = 'memory-dock-panel';
|
|
31
|
+
|
|
32
|
+
const createDockPanel = (factory: DockPanelRendererFactory): MemoryDockPanel => {
|
|
33
|
+
const renderer = factory();
|
|
34
|
+
renderer.tabBarClasses.push(...THEIA_TABBAR_CLASSES, MEMORY_INSPECTOR_TABBAR_CLASS);
|
|
35
|
+
const dockPanel = new MemoryDockPanel({
|
|
36
|
+
mode: 'multiple-document',
|
|
37
|
+
renderer,
|
|
38
|
+
spacing: 0,
|
|
39
|
+
});
|
|
40
|
+
dockPanel.addClass(DOCK_PANEL_CLASS);
|
|
41
|
+
dockPanel.id = DOCK_PANEL_ID;
|
|
42
|
+
|
|
43
|
+
return dockPanel;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const createWidget = (parent: interfaces.Container): MemoryDockPanel => {
|
|
47
|
+
const dockFactory = parent.get<DockPanelRendererFactory>(DockPanelRendererFactory);
|
|
48
|
+
const dockPanel = createDockPanel(dockFactory);
|
|
49
|
+
return dockPanel;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
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
|
-
import { ReactWidget } from '@theia/core/lib/browser';
|
|
17
|
-
import { injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import * as React from '@theia/core/shared/react';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class MemoryDockpanelPlaceholder extends ReactWidget {
|
|
22
|
-
static ID = 'memory-dockpanel-placeholder';
|
|
23
|
-
|
|
24
|
-
@postConstruct()
|
|
25
|
-
init(): void {
|
|
26
|
-
this.id = MemoryDockpanelPlaceholder.ID;
|
|
27
|
-
this.addClass(MemoryDockpanelPlaceholder.ID);
|
|
28
|
-
this.update();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
render(): React.ReactNode {
|
|
32
|
-
return (
|
|
33
|
-
<div className='t-mv-memory-fetch-error'>
|
|
34
|
-
Click the <i className='memory-view-icon toolbar' /> icon to add a new memory view or the <i className='register-view-icon toolbar' /> icon to add a register view.
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
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
|
+
import { ReactWidget } from '@theia/core/lib/browser';
|
|
17
|
+
import { injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import * as React from '@theia/core/shared/react';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class MemoryDockpanelPlaceholder extends ReactWidget {
|
|
22
|
+
static ID = 'memory-dockpanel-placeholder';
|
|
23
|
+
|
|
24
|
+
@postConstruct()
|
|
25
|
+
init(): void {
|
|
26
|
+
this.id = MemoryDockpanelPlaceholder.ID;
|
|
27
|
+
this.addClass(MemoryDockpanelPlaceholder.ID);
|
|
28
|
+
this.update();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render(): React.ReactNode {
|
|
32
|
+
return (
|
|
33
|
+
<div className='t-mv-memory-fetch-error'>
|
|
34
|
+
Click the <i className='memory-view-icon toolbar' /> icon to add a new memory view or the <i className='register-view-icon toolbar' /> icon to add a register view.
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,167 +1,167 @@
|
|
|
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
|
-
|
|
17
|
-
import { Disposable, DisposableCollection, Emitter, nls } from '@theia/core';
|
|
18
|
-
import { ApplicationShell, Message, Panel, Widget, WidgetManager } from '@theia/core/lib/browser';
|
|
19
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
20
|
-
import { MemoryDiffSelectWidget } from '../diff-widget/memory-diff-select-widget';
|
|
21
|
-
import { MemoryWidget } from '../memory-widget/memory-widget';
|
|
22
|
-
import { MemoryWidgetManager } from '../utils/memory-widget-manager';
|
|
23
|
-
import { MemoryDockPanel } from './memory-dock-panel';
|
|
24
|
-
import { MemoryDockpanelPlaceholder } from './memory-dockpanel-placeholder-widget';
|
|
25
|
-
|
|
26
|
-
@injectable()
|
|
27
|
-
export class MemoryLayoutWidget extends Panel implements Disposable, ApplicationShell.TrackableWidgetProvider {
|
|
28
|
-
static readonly ID = 'memory-layout-widget';
|
|
29
|
-
static readonly LABEL = nls.localize('theia/memory-inspector/memoryInspector', 'Memory Inspector');
|
|
30
|
-
|
|
31
|
-
// Necessary to inherit theia's tabbar styling
|
|
32
|
-
static readonly DOCK_PANEL_ID = 'theia-main-content-panel';
|
|
33
|
-
static readonly THEIA_TABBAR_CLASSES = ['theia-app-centers', 'theia-app-main'];
|
|
34
|
-
static readonly MEMORY_INSPECTOR_TABBAR_CLASS = 'memory-dock-tabbar';
|
|
35
|
-
static readonly DOCK_PANEL_CLASS = 'memory-dock-panel';
|
|
36
|
-
|
|
37
|
-
@inject(WidgetManager) protected readonly widgetManager: WidgetManager;
|
|
38
|
-
@inject(MemoryWidgetManager) protected readonly memoryWidgetManager: MemoryWidgetManager;
|
|
39
|
-
@inject(MemoryDiffSelectWidget) protected readonly diffSelectWidget: MemoryDiffSelectWidget;
|
|
40
|
-
@inject(MemoryDockpanelPlaceholder) protected readonly placeholderWidget: MemoryDockpanelPlaceholder;
|
|
41
|
-
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
|
|
42
|
-
|
|
43
|
-
protected readonly onDidChangeTrackableWidgetsEmitter = new Emitter<Widget[]>();
|
|
44
|
-
readonly onDidChangeTrackableWidgets = this.onDidChangeTrackableWidgetsEmitter.event;
|
|
45
|
-
|
|
46
|
-
protected readonly toDispose = new DisposableCollection();
|
|
47
|
-
protected dockPanel: MemoryDockPanel;
|
|
48
|
-
protected hasGeneratedWidgetAutomatically = false;
|
|
49
|
-
|
|
50
|
-
@postConstruct()
|
|
51
|
-
protected init(): void {
|
|
52
|
-
this.doInit();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
protected async doInit(): Promise<void> {
|
|
56
|
-
this.id = MemoryLayoutWidget.ID;
|
|
57
|
-
this.addClass(MemoryLayoutWidget.ID);
|
|
58
|
-
this.title.label = MemoryLayoutWidget.LABEL;
|
|
59
|
-
this.title.caption = MemoryLayoutWidget.LABEL;
|
|
60
|
-
this.title.closable = true;
|
|
61
|
-
this.title.iconClass = 'memory-view-icon';
|
|
62
|
-
this.dockPanel = await this.widgetManager.getOrCreateWidget<MemoryDockPanel>(MemoryDockPanel.ID);
|
|
63
|
-
this.addWidget(this.dockPanel);
|
|
64
|
-
this.addWidget(this.diffSelectWidget);
|
|
65
|
-
this.addWidget(this.placeholderWidget);
|
|
66
|
-
this.toDispose.push(this.memoryWidgetManager.onDidCreateNewWidget(widget => {
|
|
67
|
-
this.dockPanel.addWidget(widget);
|
|
68
|
-
this.dockPanel.activateWidget(widget);
|
|
69
|
-
this.onDidChangeTrackableWidgetsEmitter.fire([widget]);
|
|
70
|
-
}));
|
|
71
|
-
this.toDispose.push(this.memoryWidgetManager.onChanged(() => {
|
|
72
|
-
if (!this.memoryWidgetManager.canCompare) {
|
|
73
|
-
this.diffSelectWidget.hide();
|
|
74
|
-
}
|
|
75
|
-
}));
|
|
76
|
-
this.dockPanel.widgetRemoved.connect(this.handleWidgetRemoved.bind(this), this);
|
|
77
|
-
this.dockPanel.widgetAdded.connect(this.handleWidgetsChanged.bind(this), this);
|
|
78
|
-
this.toDispose.push(this.onDidChangeTrackableWidgetsEmitter);
|
|
79
|
-
this.diffSelectWidget.hide();
|
|
80
|
-
this.update();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
toggleComparisonVisibility(): void {
|
|
84
|
-
if (this.diffSelectWidget.isHidden) {
|
|
85
|
-
this.diffSelectWidget.show();
|
|
86
|
-
} else {
|
|
87
|
-
this.diffSelectWidget.hide();
|
|
88
|
-
}
|
|
89
|
-
this.update();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
override dispose(): void {
|
|
93
|
-
this.toDispose.dispose();
|
|
94
|
-
super.dispose();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected dockPanelHoldsWidgets(): boolean {
|
|
98
|
-
const iter = this.dockPanel.tabBars();
|
|
99
|
-
let tabBar = iter.next();
|
|
100
|
-
while (tabBar) {
|
|
101
|
-
if (tabBar.titles.length) {
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
tabBar = iter.next();
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
protected handleWidgetsChanged(): void {
|
|
110
|
-
if (this.dockPanelHoldsWidgets()) {
|
|
111
|
-
this.placeholderWidget.hide();
|
|
112
|
-
} else {
|
|
113
|
-
this.placeholderWidget.show();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
protected handleWidgetRemoved(_sender: Widget, widgetRemoved: Widget): void {
|
|
118
|
-
if (widgetRemoved instanceof MemoryWidget) { // Sometimes it's the tabbar.
|
|
119
|
-
this.handleWidgetsChanged();
|
|
120
|
-
this.shell.activateWidget(this.id);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
protected async createAndFocusWidget(): Promise<void> {
|
|
125
|
-
const widget = await this.memoryWidgetManager.createNewMemoryWidget();
|
|
126
|
-
widget.activate();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
protected override async onAfterShow(msg: Message): Promise<void> {
|
|
130
|
-
if (!this.hasGeneratedWidgetAutomatically && !this.dockPanelHoldsWidgets()) {
|
|
131
|
-
await this.createAndFocusWidget();
|
|
132
|
-
this.hasGeneratedWidgetAutomatically = true;
|
|
133
|
-
}
|
|
134
|
-
super.onAfterShow(msg);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
getTrackableWidgets(): Widget[] {
|
|
138
|
-
const children: Widget[] = [];
|
|
139
|
-
const childIterator = this.dockPanel.children();
|
|
140
|
-
let currentChild = childIterator.next();
|
|
141
|
-
while (currentChild) {
|
|
142
|
-
children.push(currentChild);
|
|
143
|
-
currentChild = childIterator.next();
|
|
144
|
-
}
|
|
145
|
-
return children;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
activateWidget(id: string): Widget | undefined {
|
|
149
|
-
const widget = this.getTrackableWidgets().find(candidateWidget => candidateWidget.id === id);
|
|
150
|
-
if (widget) {
|
|
151
|
-
this.dockPanel.activateWidget(widget);
|
|
152
|
-
}
|
|
153
|
-
return widget;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
override onActivateRequest(msg: Message): void {
|
|
157
|
-
const displayedWidget = this.dockPanel.currentTabBar?.currentTitle?.owner;
|
|
158
|
-
if (displayedWidget) {
|
|
159
|
-
displayedWidget.activate();
|
|
160
|
-
} else {
|
|
161
|
-
// Only happens if you remove all widgets, then close the view.
|
|
162
|
-
this.node.tabIndex = -1;
|
|
163
|
-
this.node.focus();
|
|
164
|
-
}
|
|
165
|
-
super.onActivateRequest(msg);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
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
|
+
|
|
17
|
+
import { Disposable, DisposableCollection, Emitter, nls } from '@theia/core';
|
|
18
|
+
import { ApplicationShell, Message, Panel, Widget, WidgetManager } from '@theia/core/lib/browser';
|
|
19
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
20
|
+
import { MemoryDiffSelectWidget } from '../diff-widget/memory-diff-select-widget';
|
|
21
|
+
import { MemoryWidget } from '../memory-widget/memory-widget';
|
|
22
|
+
import { MemoryWidgetManager } from '../utils/memory-widget-manager';
|
|
23
|
+
import { MemoryDockPanel } from './memory-dock-panel';
|
|
24
|
+
import { MemoryDockpanelPlaceholder } from './memory-dockpanel-placeholder-widget';
|
|
25
|
+
|
|
26
|
+
@injectable()
|
|
27
|
+
export class MemoryLayoutWidget extends Panel implements Disposable, ApplicationShell.TrackableWidgetProvider {
|
|
28
|
+
static readonly ID = 'memory-layout-widget';
|
|
29
|
+
static readonly LABEL = nls.localize('theia/memory-inspector/memoryInspector', 'Memory Inspector');
|
|
30
|
+
|
|
31
|
+
// Necessary to inherit theia's tabbar styling
|
|
32
|
+
static readonly DOCK_PANEL_ID = 'theia-main-content-panel';
|
|
33
|
+
static readonly THEIA_TABBAR_CLASSES = ['theia-app-centers', 'theia-app-main'];
|
|
34
|
+
static readonly MEMORY_INSPECTOR_TABBAR_CLASS = 'memory-dock-tabbar';
|
|
35
|
+
static readonly DOCK_PANEL_CLASS = 'memory-dock-panel';
|
|
36
|
+
|
|
37
|
+
@inject(WidgetManager) protected readonly widgetManager: WidgetManager;
|
|
38
|
+
@inject(MemoryWidgetManager) protected readonly memoryWidgetManager: MemoryWidgetManager;
|
|
39
|
+
@inject(MemoryDiffSelectWidget) protected readonly diffSelectWidget: MemoryDiffSelectWidget;
|
|
40
|
+
@inject(MemoryDockpanelPlaceholder) protected readonly placeholderWidget: MemoryDockpanelPlaceholder;
|
|
41
|
+
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
|
|
42
|
+
|
|
43
|
+
protected readonly onDidChangeTrackableWidgetsEmitter = new Emitter<Widget[]>();
|
|
44
|
+
readonly onDidChangeTrackableWidgets = this.onDidChangeTrackableWidgetsEmitter.event;
|
|
45
|
+
|
|
46
|
+
protected readonly toDispose = new DisposableCollection();
|
|
47
|
+
protected dockPanel: MemoryDockPanel;
|
|
48
|
+
protected hasGeneratedWidgetAutomatically = false;
|
|
49
|
+
|
|
50
|
+
@postConstruct()
|
|
51
|
+
protected init(): void {
|
|
52
|
+
this.doInit();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected async doInit(): Promise<void> {
|
|
56
|
+
this.id = MemoryLayoutWidget.ID;
|
|
57
|
+
this.addClass(MemoryLayoutWidget.ID);
|
|
58
|
+
this.title.label = MemoryLayoutWidget.LABEL;
|
|
59
|
+
this.title.caption = MemoryLayoutWidget.LABEL;
|
|
60
|
+
this.title.closable = true;
|
|
61
|
+
this.title.iconClass = 'memory-view-icon';
|
|
62
|
+
this.dockPanel = await this.widgetManager.getOrCreateWidget<MemoryDockPanel>(MemoryDockPanel.ID);
|
|
63
|
+
this.addWidget(this.dockPanel);
|
|
64
|
+
this.addWidget(this.diffSelectWidget);
|
|
65
|
+
this.addWidget(this.placeholderWidget);
|
|
66
|
+
this.toDispose.push(this.memoryWidgetManager.onDidCreateNewWidget(widget => {
|
|
67
|
+
this.dockPanel.addWidget(widget);
|
|
68
|
+
this.dockPanel.activateWidget(widget);
|
|
69
|
+
this.onDidChangeTrackableWidgetsEmitter.fire([widget]);
|
|
70
|
+
}));
|
|
71
|
+
this.toDispose.push(this.memoryWidgetManager.onChanged(() => {
|
|
72
|
+
if (!this.memoryWidgetManager.canCompare) {
|
|
73
|
+
this.diffSelectWidget.hide();
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
this.dockPanel.widgetRemoved.connect(this.handleWidgetRemoved.bind(this), this);
|
|
77
|
+
this.dockPanel.widgetAdded.connect(this.handleWidgetsChanged.bind(this), this);
|
|
78
|
+
this.toDispose.push(this.onDidChangeTrackableWidgetsEmitter);
|
|
79
|
+
this.diffSelectWidget.hide();
|
|
80
|
+
this.update();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
toggleComparisonVisibility(): void {
|
|
84
|
+
if (this.diffSelectWidget.isHidden) {
|
|
85
|
+
this.diffSelectWidget.show();
|
|
86
|
+
} else {
|
|
87
|
+
this.diffSelectWidget.hide();
|
|
88
|
+
}
|
|
89
|
+
this.update();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override dispose(): void {
|
|
93
|
+
this.toDispose.dispose();
|
|
94
|
+
super.dispose();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected dockPanelHoldsWidgets(): boolean {
|
|
98
|
+
const iter = this.dockPanel.tabBars();
|
|
99
|
+
let tabBar = iter.next();
|
|
100
|
+
while (tabBar) {
|
|
101
|
+
if (tabBar.titles.length) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
tabBar = iter.next();
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected handleWidgetsChanged(): void {
|
|
110
|
+
if (this.dockPanelHoldsWidgets()) {
|
|
111
|
+
this.placeholderWidget.hide();
|
|
112
|
+
} else {
|
|
113
|
+
this.placeholderWidget.show();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
protected handleWidgetRemoved(_sender: Widget, widgetRemoved: Widget): void {
|
|
118
|
+
if (widgetRemoved instanceof MemoryWidget) { // Sometimes it's the tabbar.
|
|
119
|
+
this.handleWidgetsChanged();
|
|
120
|
+
this.shell.activateWidget(this.id);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
protected async createAndFocusWidget(): Promise<void> {
|
|
125
|
+
const widget = await this.memoryWidgetManager.createNewMemoryWidget();
|
|
126
|
+
widget.activate();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
protected override async onAfterShow(msg: Message): Promise<void> {
|
|
130
|
+
if (!this.hasGeneratedWidgetAutomatically && !this.dockPanelHoldsWidgets()) {
|
|
131
|
+
await this.createAndFocusWidget();
|
|
132
|
+
this.hasGeneratedWidgetAutomatically = true;
|
|
133
|
+
}
|
|
134
|
+
super.onAfterShow(msg);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
getTrackableWidgets(): Widget[] {
|
|
138
|
+
const children: Widget[] = [];
|
|
139
|
+
const childIterator = this.dockPanel.children();
|
|
140
|
+
let currentChild = childIterator.next();
|
|
141
|
+
while (currentChild) {
|
|
142
|
+
children.push(currentChild);
|
|
143
|
+
currentChild = childIterator.next();
|
|
144
|
+
}
|
|
145
|
+
return children;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
activateWidget(id: string): Widget | undefined {
|
|
149
|
+
const widget = this.getTrackableWidgets().find(candidateWidget => candidateWidget.id === id);
|
|
150
|
+
if (widget) {
|
|
151
|
+
this.dockPanel.activateWidget(widget);
|
|
152
|
+
}
|
|
153
|
+
return widget;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
override onActivateRequest(msg: Message): void {
|
|
157
|
+
const displayedWidget = this.dockPanel.currentTabBar?.currentTitle?.owner;
|
|
158
|
+
if (displayedWidget) {
|
|
159
|
+
displayedWidget.activate();
|
|
160
|
+
} else {
|
|
161
|
+
// Only happens if you remove all widgets, then close the view.
|
|
162
|
+
this.node.tabIndex = -1;
|
|
163
|
+
this.node.focus();
|
|
164
|
+
}
|
|
165
|
+
super.onActivateRequest(msg);
|
|
166
|
+
}
|
|
167
|
+
}
|
package/src/common/util.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2019 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
|
-
|
|
17
|
-
import * as Long from 'long';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Parse `hexStr` as an hexadecimal string (with or without the leading 0x)
|
|
21
|
-
* and return the value as a Long.
|
|
22
|
-
*/
|
|
23
|
-
export function hexStrToUnsignedLong(hexStr: string): Long {
|
|
24
|
-
if (hexStr.trim().length === 0) {
|
|
25
|
-
return new Long(0, 0, true);
|
|
26
|
-
}
|
|
27
|
-
return Long.fromString(hexStr, true, 16);
|
|
28
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2019 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
|
+
|
|
17
|
+
import * as Long from 'long';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Parse `hexStr` as an hexadecimal string (with or without the leading 0x)
|
|
21
|
+
* and return the value as a Long.
|
|
22
|
+
*/
|
|
23
|
+
export function hexStrToUnsignedLong(hexStr: string): Long {
|
|
24
|
+
if (hexStr.trim().length === 0) {
|
|
25
|
+
return new Long(0, 0, true);
|
|
26
|
+
}
|
|
27
|
+
return Long.fromString(hexStr, true, 16);
|
|
28
|
+
}
|