@theia/property-view 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 +44 -44
- package/lib/browser/empty-property-view-widget-provider.d.ts +32 -32
- package/lib/browser/empty-property-view-widget-provider.js +83 -83
- package/lib/browser/property-data-service.d.ts +28 -28
- package/lib/browser/property-data-service.js +19 -19
- package/lib/browser/property-view-content-widget.d.ts +10 -10
- package/lib/browser/property-view-content-widget.js +17 -17
- package/lib/browser/property-view-contribution.d.ts +5 -5
- package/lib/browser/property-view-contribution.js +48 -48
- package/lib/browser/property-view-frontend-module.d.ts +4 -4
- package/lib/browser/property-view-frontend-module.js +42 -42
- package/lib/browser/property-view-service.d.ts +17 -17
- package/lib/browser/property-view-service.js +81 -81
- package/lib/browser/property-view-widget-provider.d.ts +57 -57
- package/lib/browser/property-view-widget-provider.js +84 -84
- package/lib/browser/property-view-widget.d.ts +26 -26
- package/lib/browser/property-view-widget.js +130 -130
- package/lib/browser/resource-property-view/index.d.ts +1 -1
- package/lib/browser/resource-property-view/index.js +28 -28
- package/lib/browser/resource-property-view/resource-property-data-service.d.ts +17 -17
- package/lib/browser/resource-property-view/resource-property-data-service.js +72 -72
- package/lib/browser/resource-property-view/resource-property-data-service.spec.d.ts +1 -1
- package/lib/browser/resource-property-view/resource-property-data-service.spec.js +101 -101
- package/lib/browser/resource-property-view/resource-property-view-label-provider.d.ts +10 -10
- package/lib/browser/resource-property-view/resource-property-view-label-provider.js +60 -60
- package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.d.ts +1 -1
- package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.js +129 -129
- package/lib/browser/resource-property-view/resource-property-view-tree-container.d.ts +2 -2
- package/lib/browser/resource-property-view/resource-property-view-tree-container.js +43 -43
- package/lib/browser/resource-property-view/resource-property-view-tree-items.d.ts +27 -27
- package/lib/browser/resource-property-view/resource-property-view-tree-items.js +41 -41
- package/lib/browser/resource-property-view/resource-property-view-tree-widget.d.ts +40 -40
- package/lib/browser/resource-property-view/resource-property-view-tree-widget.js +191 -191
- package/lib/browser/resource-property-view/resource-property-view-widget-provider.d.ts +16 -16
- package/lib/browser/resource-property-view/resource-property-view-widget-provider.js +66 -66
- package/lib/package.spec.js +25 -25
- package/package.json +5 -5
- package/src/browser/empty-property-view-widget-provider.tsx +83 -83
- package/src/browser/property-data-service.ts +48 -48
- package/src/browser/property-view-content-widget.ts +27 -27
- package/src/browser/property-view-contribution.ts +36 -36
- package/src/browser/property-view-frontend-module.ts +47 -47
- package/src/browser/property-view-service.ts +62 -62
- package/src/browser/property-view-widget-provider.ts +112 -112
- package/src/browser/property-view-widget.tsx +118 -118
- package/src/browser/resource-property-view/index.ts +17 -17
- package/src/browser/resource-property-view/resource-property-data-service.spec.ts +127 -127
- package/src/browser/resource-property-view/resource-property-data-service.ts +64 -64
- package/src/browser/resource-property-view/resource-property-view-label-provider.spec.ts +153 -153
- package/src/browser/resource-property-view/resource-property-view-label-provider.ts +49 -49
- package/src/browser/resource-property-view/resource-property-view-tree-container.ts +47 -47
- package/src/browser/resource-property-view/resource-property-view-tree-items.ts +53 -53
- package/src/browser/resource-property-view/resource-property-view-tree-widget.tsx +219 -219
- package/src/browser/resource-property-view/resource-property-view-widget-provider.ts +55 -55
- package/src/browser/style/property-view.css +51 -51
- package/src/package.spec.ts +29 -29
|
@@ -1,153 +1,153 @@
|
|
|
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 { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
|
|
18
|
-
|
|
19
|
-
let disableJSDOM = enableJSDOM();
|
|
20
|
-
|
|
21
|
-
import { expect } from 'chai';
|
|
22
|
-
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
|
|
23
|
-
FrontendApplicationConfigProvider.set({});
|
|
24
|
-
|
|
25
|
-
import { Container } from '@theia/core/shared/inversify';
|
|
26
|
-
import { TreeNode } from '@theia/core/lib/browser/tree/tree';
|
|
27
|
-
import { DEFAULT_INFO_ICON, ResourcePropertiesLabelProvider, } from './resource-property-view-label-provider';
|
|
28
|
-
import { LabelProvider, LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
|
|
29
|
-
import { ContributionProvider } from '@theia/core/lib/common';
|
|
30
|
-
import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
|
|
31
|
-
|
|
32
|
-
disableJSDOM();
|
|
33
|
-
|
|
34
|
-
let resourcePropertiesLabelProvider: ResourcePropertiesLabelProvider;
|
|
35
|
-
|
|
36
|
-
describe('resource-property-view-label', () => {
|
|
37
|
-
|
|
38
|
-
before(() => {
|
|
39
|
-
disableJSDOM = enableJSDOM();
|
|
40
|
-
const container = new Container();
|
|
41
|
-
container.bind(ResourcePropertiesLabelProvider).toSelf().inSingletonScope();
|
|
42
|
-
container.bind(LabelProvider).toSelf().inSingletonScope();
|
|
43
|
-
container.bind<Partial<ContributionProvider<LabelProviderContribution>>>(ContributionProvider)
|
|
44
|
-
.toConstantValue({
|
|
45
|
-
getContributions: () => [],
|
|
46
|
-
})
|
|
47
|
-
.whenTargetNamed(LabelProviderContribution);
|
|
48
|
-
resourcePropertiesLabelProvider = container.get(ResourcePropertiesLabelProvider);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
after(() => {
|
|
52
|
-
disableJSDOM();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const categoryNode: ResourcePropertiesCategoryNode = {
|
|
56
|
-
name: 'category',
|
|
57
|
-
id: '',
|
|
58
|
-
icon: 'iconCategory',
|
|
59
|
-
children: [],
|
|
60
|
-
parent: {
|
|
61
|
-
id: '',
|
|
62
|
-
parent: undefined,
|
|
63
|
-
children: []
|
|
64
|
-
},
|
|
65
|
-
categoryId: '',
|
|
66
|
-
expanded: false,
|
|
67
|
-
selected: false,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const itemNode: ResourcePropertiesItemNode = {
|
|
71
|
-
name: 'item',
|
|
72
|
-
id: '',
|
|
73
|
-
icon: 'iconItem',
|
|
74
|
-
selected: false,
|
|
75
|
-
parent: {
|
|
76
|
-
name: 'category',
|
|
77
|
-
id: '',
|
|
78
|
-
icon: '',
|
|
79
|
-
children: [],
|
|
80
|
-
parent: {
|
|
81
|
-
id: '',
|
|
82
|
-
parent: undefined,
|
|
83
|
-
children: []
|
|
84
|
-
},
|
|
85
|
-
categoryId: '',
|
|
86
|
-
expanded: false,
|
|
87
|
-
selected: false,
|
|
88
|
-
},
|
|
89
|
-
property: 'property'
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
describe('#canHandle', () => {
|
|
93
|
-
it('should handle a category node', () => {
|
|
94
|
-
expect(resourcePropertiesLabelProvider.canHandle(categoryNode)).to.be.greaterThan(0);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should handle an item node', () => {
|
|
98
|
-
expect(resourcePropertiesLabelProvider.canHandle(itemNode)).to.be.greaterThan(0);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should not handle a tree node (not an item nor a category)', () => {
|
|
102
|
-
const node: TreeNode = {
|
|
103
|
-
id: '',
|
|
104
|
-
parent: undefined
|
|
105
|
-
};
|
|
106
|
-
expect(resourcePropertiesLabelProvider.canHandle(node)).eq(0);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('#getIcon', () => {
|
|
112
|
-
it('should get the icon of a category node', () => {
|
|
113
|
-
expect(resourcePropertiesLabelProvider.getIcon(categoryNode)).eq('iconCategory');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('should get the default icon if a category node has an undefined icon field', () => {
|
|
117
|
-
const emptyIconCategory: ResourcePropertiesCategoryNode = categoryNode;
|
|
118
|
-
emptyIconCategory.icon = undefined;
|
|
119
|
-
expect(resourcePropertiesLabelProvider.getIcon(emptyIconCategory)).eq(DEFAULT_INFO_ICON);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('should get the icon of an item node', () => {
|
|
123
|
-
expect(resourcePropertiesLabelProvider.getIcon(itemNode)).eq('iconItem');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('should get an empty string if an item node has an undefined icon field', () => {
|
|
127
|
-
const emptyIconItem: ResourcePropertiesItemNode = itemNode;
|
|
128
|
-
emptyIconItem.icon = undefined;
|
|
129
|
-
expect(resourcePropertiesLabelProvider.getIcon(emptyIconItem)).eq('');
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('#getName', () => {
|
|
134
|
-
it('should get the name of a category node', () => {
|
|
135
|
-
expect(resourcePropertiesLabelProvider.getName(categoryNode)).eq('category');
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('should get the name of an item node', () => {
|
|
139
|
-
expect(resourcePropertiesLabelProvider.getName(itemNode)).eq('item');
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe('#getLongName', () => {
|
|
144
|
-
it('should get the property of an item node', () => {
|
|
145
|
-
expect(resourcePropertiesLabelProvider.getLongName(itemNode)).eq('property');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should get the name of a category node', () => {
|
|
149
|
-
expect(resourcePropertiesLabelProvider.getLongName(categoryNode)).eq('category');
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
});
|
|
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 { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
|
|
18
|
+
|
|
19
|
+
let disableJSDOM = enableJSDOM();
|
|
20
|
+
|
|
21
|
+
import { expect } from 'chai';
|
|
22
|
+
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
|
|
23
|
+
FrontendApplicationConfigProvider.set({});
|
|
24
|
+
|
|
25
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
26
|
+
import { TreeNode } from '@theia/core/lib/browser/tree/tree';
|
|
27
|
+
import { DEFAULT_INFO_ICON, ResourcePropertiesLabelProvider, } from './resource-property-view-label-provider';
|
|
28
|
+
import { LabelProvider, LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
|
|
29
|
+
import { ContributionProvider } from '@theia/core/lib/common';
|
|
30
|
+
import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
|
|
31
|
+
|
|
32
|
+
disableJSDOM();
|
|
33
|
+
|
|
34
|
+
let resourcePropertiesLabelProvider: ResourcePropertiesLabelProvider;
|
|
35
|
+
|
|
36
|
+
describe('resource-property-view-label', () => {
|
|
37
|
+
|
|
38
|
+
before(() => {
|
|
39
|
+
disableJSDOM = enableJSDOM();
|
|
40
|
+
const container = new Container();
|
|
41
|
+
container.bind(ResourcePropertiesLabelProvider).toSelf().inSingletonScope();
|
|
42
|
+
container.bind(LabelProvider).toSelf().inSingletonScope();
|
|
43
|
+
container.bind<Partial<ContributionProvider<LabelProviderContribution>>>(ContributionProvider)
|
|
44
|
+
.toConstantValue({
|
|
45
|
+
getContributions: () => [],
|
|
46
|
+
})
|
|
47
|
+
.whenTargetNamed(LabelProviderContribution);
|
|
48
|
+
resourcePropertiesLabelProvider = container.get(ResourcePropertiesLabelProvider);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
after(() => {
|
|
52
|
+
disableJSDOM();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const categoryNode: ResourcePropertiesCategoryNode = {
|
|
56
|
+
name: 'category',
|
|
57
|
+
id: '',
|
|
58
|
+
icon: 'iconCategory',
|
|
59
|
+
children: [],
|
|
60
|
+
parent: {
|
|
61
|
+
id: '',
|
|
62
|
+
parent: undefined,
|
|
63
|
+
children: []
|
|
64
|
+
},
|
|
65
|
+
categoryId: '',
|
|
66
|
+
expanded: false,
|
|
67
|
+
selected: false,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const itemNode: ResourcePropertiesItemNode = {
|
|
71
|
+
name: 'item',
|
|
72
|
+
id: '',
|
|
73
|
+
icon: 'iconItem',
|
|
74
|
+
selected: false,
|
|
75
|
+
parent: {
|
|
76
|
+
name: 'category',
|
|
77
|
+
id: '',
|
|
78
|
+
icon: '',
|
|
79
|
+
children: [],
|
|
80
|
+
parent: {
|
|
81
|
+
id: '',
|
|
82
|
+
parent: undefined,
|
|
83
|
+
children: []
|
|
84
|
+
},
|
|
85
|
+
categoryId: '',
|
|
86
|
+
expanded: false,
|
|
87
|
+
selected: false,
|
|
88
|
+
},
|
|
89
|
+
property: 'property'
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
describe('#canHandle', () => {
|
|
93
|
+
it('should handle a category node', () => {
|
|
94
|
+
expect(resourcePropertiesLabelProvider.canHandle(categoryNode)).to.be.greaterThan(0);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should handle an item node', () => {
|
|
98
|
+
expect(resourcePropertiesLabelProvider.canHandle(itemNode)).to.be.greaterThan(0);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should not handle a tree node (not an item nor a category)', () => {
|
|
102
|
+
const node: TreeNode = {
|
|
103
|
+
id: '',
|
|
104
|
+
parent: undefined
|
|
105
|
+
};
|
|
106
|
+
expect(resourcePropertiesLabelProvider.canHandle(node)).eq(0);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('#getIcon', () => {
|
|
112
|
+
it('should get the icon of a category node', () => {
|
|
113
|
+
expect(resourcePropertiesLabelProvider.getIcon(categoryNode)).eq('iconCategory');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should get the default icon if a category node has an undefined icon field', () => {
|
|
117
|
+
const emptyIconCategory: ResourcePropertiesCategoryNode = categoryNode;
|
|
118
|
+
emptyIconCategory.icon = undefined;
|
|
119
|
+
expect(resourcePropertiesLabelProvider.getIcon(emptyIconCategory)).eq(DEFAULT_INFO_ICON);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should get the icon of an item node', () => {
|
|
123
|
+
expect(resourcePropertiesLabelProvider.getIcon(itemNode)).eq('iconItem');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should get an empty string if an item node has an undefined icon field', () => {
|
|
127
|
+
const emptyIconItem: ResourcePropertiesItemNode = itemNode;
|
|
128
|
+
emptyIconItem.icon = undefined;
|
|
129
|
+
expect(resourcePropertiesLabelProvider.getIcon(emptyIconItem)).eq('');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('#getName', () => {
|
|
134
|
+
it('should get the name of a category node', () => {
|
|
135
|
+
expect(resourcePropertiesLabelProvider.getName(categoryNode)).eq('category');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should get the name of an item node', () => {
|
|
139
|
+
expect(resourcePropertiesLabelProvider.getName(itemNode)).eq('item');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe('#getLongName', () => {
|
|
144
|
+
it('should get the property of an item node', () => {
|
|
145
|
+
expect(resourcePropertiesLabelProvider.getLongName(itemNode)).eq('property');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should get the name of a category node', () => {
|
|
149
|
+
expect(resourcePropertiesLabelProvider.getLongName(categoryNode)).eq('category');
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
});
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 EclipseSource 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 { codicon, LabelProvider, LabelProviderContribution, TreeNode } from '@theia/core/lib/browser';
|
|
18
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
-
import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
|
|
20
|
-
|
|
21
|
-
export const DEFAULT_INFO_ICON = codicon('info');
|
|
22
|
-
|
|
23
|
-
@injectable()
|
|
24
|
-
export class ResourcePropertiesLabelProvider implements LabelProviderContribution {
|
|
25
|
-
|
|
26
|
-
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
27
|
-
|
|
28
|
-
canHandle(element: TreeNode): number {
|
|
29
|
-
return (ResourcePropertiesCategoryNode.is(element) || ResourcePropertiesItemNode.is(element)) ? 75 : 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getIcon(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
33
|
-
if (ResourcePropertiesCategoryNode.is(node)) {
|
|
34
|
-
return node.icon ?? DEFAULT_INFO_ICON;
|
|
35
|
-
}
|
|
36
|
-
return node.icon ?? '';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
40
|
-
return node.name;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
getLongName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
44
|
-
if (ResourcePropertiesItemNode.is(node)) {
|
|
45
|
-
return node.property;
|
|
46
|
-
}
|
|
47
|
-
return this.getName(node);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 EclipseSource 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 { codicon, LabelProvider, LabelProviderContribution, TreeNode } from '@theia/core/lib/browser';
|
|
18
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_INFO_ICON = codicon('info');
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class ResourcePropertiesLabelProvider implements LabelProviderContribution {
|
|
25
|
+
|
|
26
|
+
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
27
|
+
|
|
28
|
+
canHandle(element: TreeNode): number {
|
|
29
|
+
return (ResourcePropertiesCategoryNode.is(element) || ResourcePropertiesItemNode.is(element)) ? 75 : 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getIcon(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
33
|
+
if (ResourcePropertiesCategoryNode.is(node)) {
|
|
34
|
+
return node.icon ?? DEFAULT_INFO_ICON;
|
|
35
|
+
}
|
|
36
|
+
return node.icon ?? '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
40
|
+
return node.name;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getLongName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string {
|
|
44
|
+
if (ResourcePropertiesItemNode.is(node)) {
|
|
45
|
+
return node.property;
|
|
46
|
+
}
|
|
47
|
+
return this.getName(node);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 EclipseSource 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 { createTreeContainer, LabelProviderContribution, TreeProps } from '@theia/core/lib/browser';
|
|
18
|
-
import { interfaces } from '@theia/core/shared/inversify';
|
|
19
|
-
import { PropertyDataService } from '../property-data-service';
|
|
20
|
-
import { PropertyViewWidgetProvider } from '../property-view-widget-provider';
|
|
21
|
-
import { ResourcePropertyDataService } from './resource-property-data-service';
|
|
22
|
-
import { ResourcePropertiesLabelProvider } from './resource-property-view-label-provider';
|
|
23
|
-
import { ResourcePropertyViewTreeWidget } from './resource-property-view-tree-widget';
|
|
24
|
-
import { ResourcePropertyViewWidgetProvider } from './resource-property-view-widget-provider';
|
|
25
|
-
|
|
26
|
-
const RESOURCE_PROPERTY_VIEW_TREE_PROPS = {
|
|
27
|
-
multiSelect: true,
|
|
28
|
-
search: true,
|
|
29
|
-
} as TreeProps;
|
|
30
|
-
|
|
31
|
-
function createResourcePropertyViewTreeWidget(parent: interfaces.Container): ResourcePropertyViewTreeWidget {
|
|
32
|
-
const child = createTreeContainer(parent, {
|
|
33
|
-
props: RESOURCE_PROPERTY_VIEW_TREE_PROPS,
|
|
34
|
-
widget: ResourcePropertyViewTreeWidget,
|
|
35
|
-
});
|
|
36
|
-
return child.get(ResourcePropertyViewTreeWidget);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function bindResourcePropertyView(bind: interfaces.Bind): void {
|
|
40
|
-
bind(LabelProviderContribution).to(ResourcePropertiesLabelProvider).inSingletonScope();
|
|
41
|
-
bind(PropertyDataService).to(ResourcePropertyDataService).inSingletonScope();
|
|
42
|
-
bind(PropertyViewWidgetProvider).to(ResourcePropertyViewWidgetProvider).inSingletonScope();
|
|
43
|
-
|
|
44
|
-
bind(ResourcePropertyViewTreeWidget).toDynamicValue(ctx =>
|
|
45
|
-
createResourcePropertyViewTreeWidget(ctx.container)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 EclipseSource 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 { createTreeContainer, LabelProviderContribution, TreeProps } from '@theia/core/lib/browser';
|
|
18
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
19
|
+
import { PropertyDataService } from '../property-data-service';
|
|
20
|
+
import { PropertyViewWidgetProvider } from '../property-view-widget-provider';
|
|
21
|
+
import { ResourcePropertyDataService } from './resource-property-data-service';
|
|
22
|
+
import { ResourcePropertiesLabelProvider } from './resource-property-view-label-provider';
|
|
23
|
+
import { ResourcePropertyViewTreeWidget } from './resource-property-view-tree-widget';
|
|
24
|
+
import { ResourcePropertyViewWidgetProvider } from './resource-property-view-widget-provider';
|
|
25
|
+
|
|
26
|
+
const RESOURCE_PROPERTY_VIEW_TREE_PROPS = {
|
|
27
|
+
multiSelect: true,
|
|
28
|
+
search: true,
|
|
29
|
+
} as TreeProps;
|
|
30
|
+
|
|
31
|
+
function createResourcePropertyViewTreeWidget(parent: interfaces.Container): ResourcePropertyViewTreeWidget {
|
|
32
|
+
const child = createTreeContainer(parent, {
|
|
33
|
+
props: RESOURCE_PROPERTY_VIEW_TREE_PROPS,
|
|
34
|
+
widget: ResourcePropertyViewTreeWidget,
|
|
35
|
+
});
|
|
36
|
+
return child.get(ResourcePropertyViewTreeWidget);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function bindResourcePropertyView(bind: interfaces.Bind): void {
|
|
40
|
+
bind(LabelProviderContribution).to(ResourcePropertiesLabelProvider).inSingletonScope();
|
|
41
|
+
bind(PropertyDataService).to(ResourcePropertyDataService).inSingletonScope();
|
|
42
|
+
bind(PropertyViewWidgetProvider).to(ResourcePropertyViewWidgetProvider).inSingletonScope();
|
|
43
|
+
|
|
44
|
+
bind(ResourcePropertyViewTreeWidget).toDynamicValue(ctx =>
|
|
45
|
+
createResourcePropertyViewTreeWidget(ctx.container)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 EclipseSource 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 { CompositeTreeNode, ExpandableTreeNode, SelectableTreeNode, TreeNode } from '@theia/core/lib/browser';
|
|
18
|
-
|
|
19
|
-
export const ROOT_ID = 'ResourcePropertiesTree';
|
|
20
|
-
|
|
21
|
-
export interface ResourcePropertiesRoot extends CompositeTreeNode {
|
|
22
|
-
children: ResourcePropertiesCategoryNode[];
|
|
23
|
-
}
|
|
24
|
-
export namespace ResourcePropertiesRoot {
|
|
25
|
-
export function is(node: unknown): node is ResourcePropertiesRoot {
|
|
26
|
-
return CompositeTreeNode.is(node) && node.id === ROOT_ID;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ResourcePropertiesCategoryNode extends ExpandableTreeNode, SelectableTreeNode {
|
|
31
|
-
name: string;
|
|
32
|
-
icon?: string;
|
|
33
|
-
children: ResourcePropertiesItemNode[];
|
|
34
|
-
parent: ResourcePropertiesRoot;
|
|
35
|
-
categoryId: string;
|
|
36
|
-
}
|
|
37
|
-
export namespace ResourcePropertiesCategoryNode {
|
|
38
|
-
export function is(node: TreeNode | undefined): node is ResourcePropertiesCategoryNode {
|
|
39
|
-
return ExpandableTreeNode.is(node) && SelectableTreeNode.is(node) && 'categoryId' in node;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ResourcePropertiesItemNode extends SelectableTreeNode {
|
|
44
|
-
name: string;
|
|
45
|
-
icon?: string;
|
|
46
|
-
parent: ResourcePropertiesCategoryNode;
|
|
47
|
-
property: string;
|
|
48
|
-
}
|
|
49
|
-
export namespace ResourcePropertiesItemNode {
|
|
50
|
-
export function is(node: TreeNode | undefined): node is ResourcePropertiesItemNode {
|
|
51
|
-
return !!node && SelectableTreeNode.is(node) && 'property' in node;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 EclipseSource 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 { CompositeTreeNode, ExpandableTreeNode, SelectableTreeNode, TreeNode } from '@theia/core/lib/browser';
|
|
18
|
+
|
|
19
|
+
export const ROOT_ID = 'ResourcePropertiesTree';
|
|
20
|
+
|
|
21
|
+
export interface ResourcePropertiesRoot extends CompositeTreeNode {
|
|
22
|
+
children: ResourcePropertiesCategoryNode[];
|
|
23
|
+
}
|
|
24
|
+
export namespace ResourcePropertiesRoot {
|
|
25
|
+
export function is(node: unknown): node is ResourcePropertiesRoot {
|
|
26
|
+
return CompositeTreeNode.is(node) && node.id === ROOT_ID;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ResourcePropertiesCategoryNode extends ExpandableTreeNode, SelectableTreeNode {
|
|
31
|
+
name: string;
|
|
32
|
+
icon?: string;
|
|
33
|
+
children: ResourcePropertiesItemNode[];
|
|
34
|
+
parent: ResourcePropertiesRoot;
|
|
35
|
+
categoryId: string;
|
|
36
|
+
}
|
|
37
|
+
export namespace ResourcePropertiesCategoryNode {
|
|
38
|
+
export function is(node: TreeNode | undefined): node is ResourcePropertiesCategoryNode {
|
|
39
|
+
return ExpandableTreeNode.is(node) && SelectableTreeNode.is(node) && 'categoryId' in node;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ResourcePropertiesItemNode extends SelectableTreeNode {
|
|
44
|
+
name: string;
|
|
45
|
+
icon?: string;
|
|
46
|
+
parent: ResourcePropertiesCategoryNode;
|
|
47
|
+
property: string;
|
|
48
|
+
}
|
|
49
|
+
export namespace ResourcePropertiesItemNode {
|
|
50
|
+
export function is(node: TreeNode | undefined): node is ResourcePropertiesItemNode {
|
|
51
|
+
return !!node && SelectableTreeNode.is(node) && 'property' in node;
|
|
52
|
+
}
|
|
53
|
+
}
|