@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,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
|
-
|
|
17
|
-
import { nls } from '@theia/core';
|
|
18
|
-
import { BaseWidget, PanelLayout } from '@theia/core/lib/browser';
|
|
19
|
-
import { Container, inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify';
|
|
20
|
-
import { MemoryWidgetOptions } from '../utils/memory-widget-utils';
|
|
21
|
-
import { MemoryOptionsWidget } from './memory-options-widget';
|
|
22
|
-
import { MemoryTableWidget } from './memory-table-widget';
|
|
23
|
-
|
|
24
|
-
@injectable()
|
|
25
|
-
export class MemoryWidget<
|
|
26
|
-
O extends MemoryOptionsWidget = MemoryOptionsWidget,
|
|
27
|
-
T extends MemoryTableWidget = MemoryTableWidget
|
|
28
|
-
>
|
|
29
|
-
extends BaseWidget {
|
|
30
|
-
static readonly ID = 'memory-view-wrapper';
|
|
31
|
-
static readonly LABEL = nls.localize('theia/memory-inspector/memoryTitle', 'Memory');
|
|
32
|
-
|
|
33
|
-
@inject(MemoryWidgetOptions) protected readonly memoryWidgetOptions: MemoryWidgetOptions;
|
|
34
|
-
@inject(MemoryOptionsWidget) readonly optionsWidget: O;
|
|
35
|
-
@inject(MemoryTableWidget) readonly tableWidget: T;
|
|
36
|
-
|
|
37
|
-
static createWidget<
|
|
38
|
-
Options extends MemoryOptionsWidget = MemoryOptionsWidget,
|
|
39
|
-
Table extends MemoryTableWidget = MemoryTableWidget
|
|
40
|
-
>(
|
|
41
|
-
parent: interfaces.Container,
|
|
42
|
-
optionsWidget: interfaces.ServiceIdentifier<Options>,
|
|
43
|
-
tableWidget: interfaces.ServiceIdentifier<Table>,
|
|
44
|
-
optionSymbol: interfaces.ServiceIdentifier<MemoryWidgetOptions> = MemoryWidgetOptions,
|
|
45
|
-
options?: MemoryWidgetOptions,
|
|
46
|
-
): MemoryWidget<Options, Table> {
|
|
47
|
-
const child = MemoryWidget.createContainer(parent, optionsWidget, tableWidget, optionSymbol, options);
|
|
48
|
-
return child.get(MemoryWidget);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static createContainer(
|
|
52
|
-
parent: interfaces.Container,
|
|
53
|
-
optionsWidget: interfaces.ServiceIdentifier<MemoryOptionsWidget>,
|
|
54
|
-
tableWidget: interfaces.ServiceIdentifier<MemoryTableWidget>,
|
|
55
|
-
optionSymbol: interfaces.ServiceIdentifier<MemoryWidgetOptions | undefined> = MemoryWidgetOptions,
|
|
56
|
-
options?: MemoryWidgetOptions,
|
|
57
|
-
): interfaces.Container {
|
|
58
|
-
const child = new Container({ defaultScope: 'Singleton' });
|
|
59
|
-
child.parent = parent;
|
|
60
|
-
child.bind(optionsWidget).toSelf();
|
|
61
|
-
child.bind(tableWidget).toSelf();
|
|
62
|
-
child.bind(MemoryWidgetOptions).toConstantValue(options);
|
|
63
|
-
if (optionsWidget !== MemoryOptionsWidget) {
|
|
64
|
-
child.bind(MemoryOptionsWidget).toService(optionsWidget);
|
|
65
|
-
}
|
|
66
|
-
if (tableWidget !== MemoryTableWidget) {
|
|
67
|
-
child.bind(MemoryTableWidget).toService(tableWidget);
|
|
68
|
-
}
|
|
69
|
-
if (optionSymbol !== MemoryWidgetOptions) {
|
|
70
|
-
child.bind(optionSymbol).toConstantValue(options);
|
|
71
|
-
}
|
|
72
|
-
child.bind(MemoryWidget).toSelf();
|
|
73
|
-
return child;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static getIdentifier(optionsWidgetID: string): string {
|
|
77
|
-
return `${MemoryWidget.ID}-${optionsWidgetID}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@postConstruct()
|
|
81
|
-
protected init(): void {
|
|
82
|
-
this.doInit();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected async doInit(): Promise<void> {
|
|
86
|
-
this.id = MemoryWidget.getIdentifier(this.memoryWidgetOptions.identifier.toString());
|
|
87
|
-
this.addClass(MemoryWidget.ID);
|
|
88
|
-
|
|
89
|
-
this.title.label = this.optionsWidget.title.label;
|
|
90
|
-
this.title.caption = this.optionsWidget.title.caption;
|
|
91
|
-
this.title.iconClass = this.optionsWidget.title.iconClass;
|
|
92
|
-
this.title.closable = this.optionsWidget.title.closable;
|
|
93
|
-
|
|
94
|
-
const layout = this.layout = new PanelLayout();
|
|
95
|
-
layout.addWidget(this.optionsWidget);
|
|
96
|
-
layout.addWidget(this.tableWidget);
|
|
97
|
-
|
|
98
|
-
this.toDispose.pushAll([
|
|
99
|
-
this.layout,
|
|
100
|
-
this.optionsWidget,
|
|
101
|
-
this.tableWidget,
|
|
102
|
-
]);
|
|
103
|
-
|
|
104
|
-
this.optionsWidget.title.changed.connect(title => {
|
|
105
|
-
this.title.label = title.label;
|
|
106
|
-
this.title.caption = title.caption;
|
|
107
|
-
this.title.iconClass = title.iconClass;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
protected override onActivateRequest(): void {
|
|
112
|
-
this.optionsWidget.activate();
|
|
113
|
-
}
|
|
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
|
+
|
|
17
|
+
import { nls } from '@theia/core';
|
|
18
|
+
import { BaseWidget, PanelLayout } from '@theia/core/lib/browser';
|
|
19
|
+
import { Container, inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify';
|
|
20
|
+
import { MemoryWidgetOptions } from '../utils/memory-widget-utils';
|
|
21
|
+
import { MemoryOptionsWidget } from './memory-options-widget';
|
|
22
|
+
import { MemoryTableWidget } from './memory-table-widget';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class MemoryWidget<
|
|
26
|
+
O extends MemoryOptionsWidget = MemoryOptionsWidget,
|
|
27
|
+
T extends MemoryTableWidget = MemoryTableWidget
|
|
28
|
+
>
|
|
29
|
+
extends BaseWidget {
|
|
30
|
+
static readonly ID = 'memory-view-wrapper';
|
|
31
|
+
static readonly LABEL = nls.localize('theia/memory-inspector/memoryTitle', 'Memory');
|
|
32
|
+
|
|
33
|
+
@inject(MemoryWidgetOptions) protected readonly memoryWidgetOptions: MemoryWidgetOptions;
|
|
34
|
+
@inject(MemoryOptionsWidget) readonly optionsWidget: O;
|
|
35
|
+
@inject(MemoryTableWidget) readonly tableWidget: T;
|
|
36
|
+
|
|
37
|
+
static createWidget<
|
|
38
|
+
Options extends MemoryOptionsWidget = MemoryOptionsWidget,
|
|
39
|
+
Table extends MemoryTableWidget = MemoryTableWidget
|
|
40
|
+
>(
|
|
41
|
+
parent: interfaces.Container,
|
|
42
|
+
optionsWidget: interfaces.ServiceIdentifier<Options>,
|
|
43
|
+
tableWidget: interfaces.ServiceIdentifier<Table>,
|
|
44
|
+
optionSymbol: interfaces.ServiceIdentifier<MemoryWidgetOptions> = MemoryWidgetOptions,
|
|
45
|
+
options?: MemoryWidgetOptions,
|
|
46
|
+
): MemoryWidget<Options, Table> {
|
|
47
|
+
const child = MemoryWidget.createContainer(parent, optionsWidget, tableWidget, optionSymbol, options);
|
|
48
|
+
return child.get(MemoryWidget);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static createContainer(
|
|
52
|
+
parent: interfaces.Container,
|
|
53
|
+
optionsWidget: interfaces.ServiceIdentifier<MemoryOptionsWidget>,
|
|
54
|
+
tableWidget: interfaces.ServiceIdentifier<MemoryTableWidget>,
|
|
55
|
+
optionSymbol: interfaces.ServiceIdentifier<MemoryWidgetOptions | undefined> = MemoryWidgetOptions,
|
|
56
|
+
options?: MemoryWidgetOptions,
|
|
57
|
+
): interfaces.Container {
|
|
58
|
+
const child = new Container({ defaultScope: 'Singleton' });
|
|
59
|
+
child.parent = parent;
|
|
60
|
+
child.bind(optionsWidget).toSelf();
|
|
61
|
+
child.bind(tableWidget).toSelf();
|
|
62
|
+
child.bind(MemoryWidgetOptions).toConstantValue(options);
|
|
63
|
+
if (optionsWidget !== MemoryOptionsWidget) {
|
|
64
|
+
child.bind(MemoryOptionsWidget).toService(optionsWidget);
|
|
65
|
+
}
|
|
66
|
+
if (tableWidget !== MemoryTableWidget) {
|
|
67
|
+
child.bind(MemoryTableWidget).toService(tableWidget);
|
|
68
|
+
}
|
|
69
|
+
if (optionSymbol !== MemoryWidgetOptions) {
|
|
70
|
+
child.bind(optionSymbol).toConstantValue(options);
|
|
71
|
+
}
|
|
72
|
+
child.bind(MemoryWidget).toSelf();
|
|
73
|
+
return child;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static getIdentifier(optionsWidgetID: string): string {
|
|
77
|
+
return `${MemoryWidget.ID}-${optionsWidgetID}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@postConstruct()
|
|
81
|
+
protected init(): void {
|
|
82
|
+
this.doInit();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected async doInit(): Promise<void> {
|
|
86
|
+
this.id = MemoryWidget.getIdentifier(this.memoryWidgetOptions.identifier.toString());
|
|
87
|
+
this.addClass(MemoryWidget.ID);
|
|
88
|
+
|
|
89
|
+
this.title.label = this.optionsWidget.title.label;
|
|
90
|
+
this.title.caption = this.optionsWidget.title.caption;
|
|
91
|
+
this.title.iconClass = this.optionsWidget.title.iconClass;
|
|
92
|
+
this.title.closable = this.optionsWidget.title.closable;
|
|
93
|
+
|
|
94
|
+
const layout = this.layout = new PanelLayout();
|
|
95
|
+
layout.addWidget(this.optionsWidget);
|
|
96
|
+
layout.addWidget(this.tableWidget);
|
|
97
|
+
|
|
98
|
+
this.toDispose.pushAll([
|
|
99
|
+
this.layout,
|
|
100
|
+
this.optionsWidget,
|
|
101
|
+
this.tableWidget,
|
|
102
|
+
]);
|
|
103
|
+
|
|
104
|
+
this.optionsWidget.title.changed.connect(title => {
|
|
105
|
+
this.title.label = title.label;
|
|
106
|
+
this.title.caption = title.caption;
|
|
107
|
+
this.title.iconClass = title.iconClass;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
protected override onActivateRequest(): void {
|
|
112
|
+
this.optionsWidget.activate();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,76 +1,76 @@
|
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
|
|
19
|
-
export enum AllOrCustom {
|
|
20
|
-
All = 'All',
|
|
21
|
-
Custom = 'Custom'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const RegisterFilterService = Symbol('RegisterFilterService');
|
|
25
|
-
export interface RegisterFilterService {
|
|
26
|
-
currentFilterLabel: string;
|
|
27
|
-
filterLabels: string[];
|
|
28
|
-
setFilter(filterLabel: string): void;
|
|
29
|
-
shouldDisplayRegister(registerName: string): boolean;
|
|
30
|
-
currentFilterRegisters(): string[];
|
|
31
|
-
}
|
|
32
|
-
export const RegisterFilterServiceOptions = Symbol('RegisterFilterServiceOptions');
|
|
33
|
-
export interface RegisterFilterServiceOptions {
|
|
34
|
-
[key: string]: string[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@injectable()
|
|
38
|
-
export class RegisterFilterServiceImpl implements RegisterFilterService {
|
|
39
|
-
@inject(RegisterFilterServiceOptions) protected readonly options: RegisterFilterServiceOptions;
|
|
40
|
-
|
|
41
|
-
protected filters: Map<string, Set<string> | undefined> = new Map();
|
|
42
|
-
protected currentFilter: string = AllOrCustom.All;
|
|
43
|
-
|
|
44
|
-
get filterLabels(): string[] {
|
|
45
|
-
return [...this.filters.keys()];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
get currentFilterLabel(): string {
|
|
49
|
-
return this.currentFilter;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@postConstruct()
|
|
53
|
-
protected init(): void {
|
|
54
|
-
this.filters.set(AllOrCustom.All, undefined);
|
|
55
|
-
this.filters.set(AllOrCustom.Custom, new Set());
|
|
56
|
-
for (const [key, values] of Object.entries(this.options)) {
|
|
57
|
-
this.filters.set(key, new Set(values));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
setFilter(filterLabel: string): void {
|
|
62
|
-
if (this.filters.has(filterLabel)) {
|
|
63
|
-
this.currentFilter = filterLabel;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
shouldDisplayRegister(registerName: string): boolean {
|
|
68
|
-
const currentFilter = this.filters.get(this.currentFilter);
|
|
69
|
-
return !currentFilter || currentFilter.has(registerName);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
currentFilterRegisters(): string[] {
|
|
73
|
-
const currentFilterRegisters = this.filters.get(this.currentFilter);
|
|
74
|
-
return currentFilterRegisters ? Array.from(currentFilterRegisters) : [];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
|
|
19
|
+
export enum AllOrCustom {
|
|
20
|
+
All = 'All',
|
|
21
|
+
Custom = 'Custom'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const RegisterFilterService = Symbol('RegisterFilterService');
|
|
25
|
+
export interface RegisterFilterService {
|
|
26
|
+
currentFilterLabel: string;
|
|
27
|
+
filterLabels: string[];
|
|
28
|
+
setFilter(filterLabel: string): void;
|
|
29
|
+
shouldDisplayRegister(registerName: string): boolean;
|
|
30
|
+
currentFilterRegisters(): string[];
|
|
31
|
+
}
|
|
32
|
+
export const RegisterFilterServiceOptions = Symbol('RegisterFilterServiceOptions');
|
|
33
|
+
export interface RegisterFilterServiceOptions {
|
|
34
|
+
[key: string]: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@injectable()
|
|
38
|
+
export class RegisterFilterServiceImpl implements RegisterFilterService {
|
|
39
|
+
@inject(RegisterFilterServiceOptions) protected readonly options: RegisterFilterServiceOptions;
|
|
40
|
+
|
|
41
|
+
protected filters: Map<string, Set<string> | undefined> = new Map();
|
|
42
|
+
protected currentFilter: string = AllOrCustom.All;
|
|
43
|
+
|
|
44
|
+
get filterLabels(): string[] {
|
|
45
|
+
return [...this.filters.keys()];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get currentFilterLabel(): string {
|
|
49
|
+
return this.currentFilter;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@postConstruct()
|
|
53
|
+
protected init(): void {
|
|
54
|
+
this.filters.set(AllOrCustom.All, undefined);
|
|
55
|
+
this.filters.set(AllOrCustom.Custom, new Set());
|
|
56
|
+
for (const [key, values] of Object.entries(this.options)) {
|
|
57
|
+
this.filters.set(key, new Set(values));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setFilter(filterLabel: string): void {
|
|
62
|
+
if (this.filters.has(filterLabel)) {
|
|
63
|
+
this.currentFilter = filterLabel;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
shouldDisplayRegister(registerName: string): boolean {
|
|
68
|
+
const currentFilter = this.filters.get(this.currentFilter);
|
|
69
|
+
return !currentFilter || currentFilter.has(registerName);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
currentFilterRegisters(): string[] {
|
|
73
|
+
const currentFilterRegisters = this.filters.get(this.currentFilter);
|
|
74
|
+
return currentFilterRegisters ? Array.from(currentFilterRegisters) : [];
|
|
75
|
+
}
|
|
76
|
+
}
|