@theia/property-view 1.45.0 → 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,192 +1,192 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 EclipseSource and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
var ResourcePropertyViewTreeWidget_1;
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.ResourcePropertyViewTreeWidget = void 0;
|
|
32
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
34
|
-
const React = require("@theia/core/shared/react");
|
|
35
|
-
const resource_property_view_tree_items_1 = require("./resource-property-view-tree-items");
|
|
36
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
37
|
-
/**
|
|
38
|
-
* This widget fetches the property data for {@link FileSelection}s and selections of {@link Navigatable}s
|
|
39
|
-
* and renders that property data as a {@link TreeWidget}.
|
|
40
|
-
* This widget is provided by the registered `ResourcePropertyViewWidgetProvider`.
|
|
41
|
-
*/
|
|
42
|
-
let ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget_1 = class ResourcePropertyViewTreeWidget extends browser_1.TreeWidget {
|
|
43
|
-
constructor(props, model, contextMenuRenderer) {
|
|
44
|
-
super(props, model, contextMenuRenderer);
|
|
45
|
-
model.root = {
|
|
46
|
-
id: resource_property_view_tree_items_1.ROOT_ID,
|
|
47
|
-
name: ResourcePropertyViewTreeWidget_1.LABEL,
|
|
48
|
-
parent: undefined,
|
|
49
|
-
visible: false,
|
|
50
|
-
children: []
|
|
51
|
-
};
|
|
52
|
-
this.propertiesTree = new Map();
|
|
53
|
-
}
|
|
54
|
-
init() {
|
|
55
|
-
super.init();
|
|
56
|
-
this.id = ResourcePropertyViewTreeWidget_1.ID + '-treeContainer';
|
|
57
|
-
this.addClass('treeContainer');
|
|
58
|
-
this.fillPropertiesTree();
|
|
59
|
-
}
|
|
60
|
-
updateNeeded(selection) {
|
|
61
|
-
return this.currentSelection !== selection;
|
|
62
|
-
}
|
|
63
|
-
updatePropertyViewContent(propertyDataService, selection) {
|
|
64
|
-
if (this.updateNeeded(selection)) {
|
|
65
|
-
this.currentSelection = selection;
|
|
66
|
-
if (propertyDataService) {
|
|
67
|
-
propertyDataService.providePropertyData(selection).then((fileStatObject) => {
|
|
68
|
-
this.fillPropertiesTree(fileStatObject);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
fillPropertiesTree(fileStatObject) {
|
|
74
|
-
if (fileStatObject) {
|
|
75
|
-
this.propertiesTree.clear();
|
|
76
|
-
const infoNode = this.createCategoryNode('info', nls_1.nls.localizeByDefault('Info'));
|
|
77
|
-
this.propertiesTree.set('info', infoNode);
|
|
78
|
-
infoNode.children.push(this.createResultLineNode('isDirectory', nls_1.nls.localize('theia/property-view/directory', 'Directory'), fileStatObject.isDirectory, infoNode));
|
|
79
|
-
infoNode.children.push(this.createResultLineNode('isFile', nls_1.nls.localizeByDefault('File'), fileStatObject.isFile, infoNode));
|
|
80
|
-
infoNode.children.push(this.createResultLineNode('isSymbolicLink', nls_1.nls.localize('theia/property-view/symbolicLink', 'Symbolic link'), fileStatObject.isSymbolicLink, infoNode));
|
|
81
|
-
infoNode.children.push(this.createResultLineNode('location', nls_1.nls.localize('theia/property-view/location', 'Location'), this.getLocationString(fileStatObject), infoNode));
|
|
82
|
-
infoNode.children.push(this.createResultLineNode('name', nls_1.nls.localizeByDefault('Name'), this.getFileName(fileStatObject), infoNode));
|
|
83
|
-
infoNode.children.push(this.createResultLineNode('path', nls_1.nls.localizeByDefault('Path'), this.getFilePath(fileStatObject), infoNode));
|
|
84
|
-
infoNode.children.push(this.createResultLineNode('lastModification', nls_1.nls.localize('theia/property-view/lastModified', 'Last modified'), this.getLastModificationString(fileStatObject), infoNode));
|
|
85
|
-
infoNode.children.push(this.createResultLineNode('created', nls_1.nls.localize('theia/property-view/created', 'Created'), this.getCreationTimeString(fileStatObject), infoNode));
|
|
86
|
-
infoNode.children.push(this.createResultLineNode('size', nls_1.nls.localize('theia/property-view/size', 'Size'), this.getSizeString(fileStatObject), infoNode));
|
|
87
|
-
this.refreshModelChildren();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
getLocationString(fileStat) {
|
|
91
|
-
return fileStat.resource.path.fsPath();
|
|
92
|
-
}
|
|
93
|
-
getFileName(fileStat) {
|
|
94
|
-
return this.labelProvider.getName(fileStat.resource);
|
|
95
|
-
}
|
|
96
|
-
getFilePath(fileStat) {
|
|
97
|
-
return this.labelProvider.getLongName(fileStat.resource);
|
|
98
|
-
}
|
|
99
|
-
getLastModificationString(fileStat) {
|
|
100
|
-
return fileStat.mtime ? new Date(fileStat.mtime).toLocaleString() : '';
|
|
101
|
-
}
|
|
102
|
-
getCreationTimeString(fileStat) {
|
|
103
|
-
return fileStat.ctime ? new Date(fileStat.ctime).toLocaleString() : '';
|
|
104
|
-
}
|
|
105
|
-
getSizeString(fileStat) {
|
|
106
|
-
return fileStat.size ? nls_1.nls.localizeByDefault('{0}B', fileStat.size.toString()) : '';
|
|
107
|
-
}
|
|
108
|
-
/*
|
|
109
|
-
* Creating TreeNodes
|
|
110
|
-
*/
|
|
111
|
-
createCategoryNode(categoryId, name) {
|
|
112
|
-
return {
|
|
113
|
-
id: categoryId,
|
|
114
|
-
parent: this.model.root,
|
|
115
|
-
name,
|
|
116
|
-
children: [],
|
|
117
|
-
categoryId,
|
|
118
|
-
selected: false,
|
|
119
|
-
expanded: true
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
createResultLineNode(id, name, property, parent) {
|
|
123
|
-
return {
|
|
124
|
-
id: `${parent.id}::${id}`,
|
|
125
|
-
parent,
|
|
126
|
-
name: name,
|
|
127
|
-
property: property !== undefined ? String(property) : '',
|
|
128
|
-
selected: false
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Rendering
|
|
133
|
-
*/
|
|
134
|
-
async refreshModelChildren() {
|
|
135
|
-
if (resource_property_view_tree_items_1.ResourcePropertiesRoot.is(this.model.root)) {
|
|
136
|
-
this.model.root.children = Array.from(this.propertiesTree.values());
|
|
137
|
-
this.model.refresh();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
renderCaption(node, props) {
|
|
141
|
-
if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
|
|
142
|
-
return this.renderExpandableNode(node);
|
|
143
|
-
}
|
|
144
|
-
else if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
|
|
145
|
-
return this.renderItemNode(node);
|
|
146
|
-
}
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
renderExpandableNode(node) {
|
|
150
|
-
return React.createElement(React.Fragment, null,
|
|
151
|
-
React.createElement("div", { className: `theia-resource-tree-node-icon ${this.toNodeIcon(node)}` }),
|
|
152
|
-
React.createElement("div", { className: 'theia-resource-tree-node-name theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeName(node)));
|
|
153
|
-
}
|
|
154
|
-
renderItemNode(node) {
|
|
155
|
-
return React.createElement(React.Fragment, null,
|
|
156
|
-
React.createElement("div", { className: `theia-resource-tree-node-icon ${this.toNodeIcon(node)}` }),
|
|
157
|
-
React.createElement("div", { className: 'theia-resource-tree-node-name theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeName(node)),
|
|
158
|
-
React.createElement("div", { className: 'theia-resource-tree-node-property theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeDescription(node)));
|
|
159
|
-
}
|
|
160
|
-
createNodeAttributes(node, props) {
|
|
161
|
-
return {
|
|
162
|
-
...super.createNodeAttributes(node, props),
|
|
163
|
-
title: this.getNodeTooltip(node)
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
getNodeTooltip(node) {
|
|
167
|
-
if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
|
|
168
|
-
return this.labelProvider.getName(node);
|
|
169
|
-
}
|
|
170
|
-
else if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
|
|
171
|
-
return `${this.labelProvider.getName(node)}: ${this.labelProvider.getLongName(node)}`;
|
|
172
|
-
}
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
ResourcePropertyViewTreeWidget.ID = 'resource-properties-tree-widget';
|
|
177
|
-
ResourcePropertyViewTreeWidget.LABEL = 'Resource Properties Tree';
|
|
178
|
-
__decorate([
|
|
179
|
-
(0, inversify_1.postConstruct)(),
|
|
180
|
-
__metadata("design:type", Function),
|
|
181
|
-
__metadata("design:paramtypes", []),
|
|
182
|
-
__metadata("design:returntype", void 0)
|
|
183
|
-
], ResourcePropertyViewTreeWidget.prototype, "init", null);
|
|
184
|
-
ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget_1 = __decorate([
|
|
185
|
-
(0, inversify_1.injectable)(),
|
|
186
|
-
__param(0, (0, inversify_1.inject)(browser_1.TreeProps)),
|
|
187
|
-
__param(1, (0, inversify_1.inject)(browser_1.TreeModel)),
|
|
188
|
-
__param(2, (0, inversify_1.inject)(browser_1.ContextMenuRenderer)),
|
|
189
|
-
__metadata("design:paramtypes", [Object, Object, browser_1.ContextMenuRenderer])
|
|
190
|
-
], ResourcePropertyViewTreeWidget);
|
|
191
|
-
exports.ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
var ResourcePropertyViewTreeWidget_1;
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.ResourcePropertyViewTreeWidget = void 0;
|
|
32
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
34
|
+
const React = require("@theia/core/shared/react");
|
|
35
|
+
const resource_property_view_tree_items_1 = require("./resource-property-view-tree-items");
|
|
36
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
37
|
+
/**
|
|
38
|
+
* This widget fetches the property data for {@link FileSelection}s and selections of {@link Navigatable}s
|
|
39
|
+
* and renders that property data as a {@link TreeWidget}.
|
|
40
|
+
* This widget is provided by the registered `ResourcePropertyViewWidgetProvider`.
|
|
41
|
+
*/
|
|
42
|
+
let ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget_1 = class ResourcePropertyViewTreeWidget extends browser_1.TreeWidget {
|
|
43
|
+
constructor(props, model, contextMenuRenderer) {
|
|
44
|
+
super(props, model, contextMenuRenderer);
|
|
45
|
+
model.root = {
|
|
46
|
+
id: resource_property_view_tree_items_1.ROOT_ID,
|
|
47
|
+
name: ResourcePropertyViewTreeWidget_1.LABEL,
|
|
48
|
+
parent: undefined,
|
|
49
|
+
visible: false,
|
|
50
|
+
children: []
|
|
51
|
+
};
|
|
52
|
+
this.propertiesTree = new Map();
|
|
53
|
+
}
|
|
54
|
+
init() {
|
|
55
|
+
super.init();
|
|
56
|
+
this.id = ResourcePropertyViewTreeWidget_1.ID + '-treeContainer';
|
|
57
|
+
this.addClass('treeContainer');
|
|
58
|
+
this.fillPropertiesTree();
|
|
59
|
+
}
|
|
60
|
+
updateNeeded(selection) {
|
|
61
|
+
return this.currentSelection !== selection;
|
|
62
|
+
}
|
|
63
|
+
updatePropertyViewContent(propertyDataService, selection) {
|
|
64
|
+
if (this.updateNeeded(selection)) {
|
|
65
|
+
this.currentSelection = selection;
|
|
66
|
+
if (propertyDataService) {
|
|
67
|
+
propertyDataService.providePropertyData(selection).then((fileStatObject) => {
|
|
68
|
+
this.fillPropertiesTree(fileStatObject);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
fillPropertiesTree(fileStatObject) {
|
|
74
|
+
if (fileStatObject) {
|
|
75
|
+
this.propertiesTree.clear();
|
|
76
|
+
const infoNode = this.createCategoryNode('info', nls_1.nls.localizeByDefault('Info'));
|
|
77
|
+
this.propertiesTree.set('info', infoNode);
|
|
78
|
+
infoNode.children.push(this.createResultLineNode('isDirectory', nls_1.nls.localize('theia/property-view/directory', 'Directory'), fileStatObject.isDirectory, infoNode));
|
|
79
|
+
infoNode.children.push(this.createResultLineNode('isFile', nls_1.nls.localizeByDefault('File'), fileStatObject.isFile, infoNode));
|
|
80
|
+
infoNode.children.push(this.createResultLineNode('isSymbolicLink', nls_1.nls.localize('theia/property-view/symbolicLink', 'Symbolic link'), fileStatObject.isSymbolicLink, infoNode));
|
|
81
|
+
infoNode.children.push(this.createResultLineNode('location', nls_1.nls.localize('theia/property-view/location', 'Location'), this.getLocationString(fileStatObject), infoNode));
|
|
82
|
+
infoNode.children.push(this.createResultLineNode('name', nls_1.nls.localizeByDefault('Name'), this.getFileName(fileStatObject), infoNode));
|
|
83
|
+
infoNode.children.push(this.createResultLineNode('path', nls_1.nls.localizeByDefault('Path'), this.getFilePath(fileStatObject), infoNode));
|
|
84
|
+
infoNode.children.push(this.createResultLineNode('lastModification', nls_1.nls.localize('theia/property-view/lastModified', 'Last modified'), this.getLastModificationString(fileStatObject), infoNode));
|
|
85
|
+
infoNode.children.push(this.createResultLineNode('created', nls_1.nls.localize('theia/property-view/created', 'Created'), this.getCreationTimeString(fileStatObject), infoNode));
|
|
86
|
+
infoNode.children.push(this.createResultLineNode('size', nls_1.nls.localize('theia/property-view/size', 'Size'), this.getSizeString(fileStatObject), infoNode));
|
|
87
|
+
this.refreshModelChildren();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
getLocationString(fileStat) {
|
|
91
|
+
return fileStat.resource.path.fsPath();
|
|
92
|
+
}
|
|
93
|
+
getFileName(fileStat) {
|
|
94
|
+
return this.labelProvider.getName(fileStat.resource);
|
|
95
|
+
}
|
|
96
|
+
getFilePath(fileStat) {
|
|
97
|
+
return this.labelProvider.getLongName(fileStat.resource);
|
|
98
|
+
}
|
|
99
|
+
getLastModificationString(fileStat) {
|
|
100
|
+
return fileStat.mtime ? new Date(fileStat.mtime).toLocaleString() : '';
|
|
101
|
+
}
|
|
102
|
+
getCreationTimeString(fileStat) {
|
|
103
|
+
return fileStat.ctime ? new Date(fileStat.ctime).toLocaleString() : '';
|
|
104
|
+
}
|
|
105
|
+
getSizeString(fileStat) {
|
|
106
|
+
return fileStat.size ? nls_1.nls.localizeByDefault('{0}B', fileStat.size.toString()) : '';
|
|
107
|
+
}
|
|
108
|
+
/*
|
|
109
|
+
* Creating TreeNodes
|
|
110
|
+
*/
|
|
111
|
+
createCategoryNode(categoryId, name) {
|
|
112
|
+
return {
|
|
113
|
+
id: categoryId,
|
|
114
|
+
parent: this.model.root,
|
|
115
|
+
name,
|
|
116
|
+
children: [],
|
|
117
|
+
categoryId,
|
|
118
|
+
selected: false,
|
|
119
|
+
expanded: true
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
createResultLineNode(id, name, property, parent) {
|
|
123
|
+
return {
|
|
124
|
+
id: `${parent.id}::${id}`,
|
|
125
|
+
parent,
|
|
126
|
+
name: name,
|
|
127
|
+
property: property !== undefined ? String(property) : '',
|
|
128
|
+
selected: false
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Rendering
|
|
133
|
+
*/
|
|
134
|
+
async refreshModelChildren() {
|
|
135
|
+
if (resource_property_view_tree_items_1.ResourcePropertiesRoot.is(this.model.root)) {
|
|
136
|
+
this.model.root.children = Array.from(this.propertiesTree.values());
|
|
137
|
+
this.model.refresh();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
renderCaption(node, props) {
|
|
141
|
+
if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
|
|
142
|
+
return this.renderExpandableNode(node);
|
|
143
|
+
}
|
|
144
|
+
else if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
|
|
145
|
+
return this.renderItemNode(node);
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
renderExpandableNode(node) {
|
|
150
|
+
return React.createElement(React.Fragment, null,
|
|
151
|
+
React.createElement("div", { className: `theia-resource-tree-node-icon ${this.toNodeIcon(node)}` }),
|
|
152
|
+
React.createElement("div", { className: 'theia-resource-tree-node-name theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeName(node)));
|
|
153
|
+
}
|
|
154
|
+
renderItemNode(node) {
|
|
155
|
+
return React.createElement(React.Fragment, null,
|
|
156
|
+
React.createElement("div", { className: `theia-resource-tree-node-icon ${this.toNodeIcon(node)}` }),
|
|
157
|
+
React.createElement("div", { className: 'theia-resource-tree-node-name theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeName(node)),
|
|
158
|
+
React.createElement("div", { className: 'theia-resource-tree-node-property theia-TreeNodeSegment theia-TreeNodeSegmentGrow' }, this.toNodeDescription(node)));
|
|
159
|
+
}
|
|
160
|
+
createNodeAttributes(node, props) {
|
|
161
|
+
return {
|
|
162
|
+
...super.createNodeAttributes(node, props),
|
|
163
|
+
title: this.getNodeTooltip(node)
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
getNodeTooltip(node) {
|
|
167
|
+
if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
|
|
168
|
+
return this.labelProvider.getName(node);
|
|
169
|
+
}
|
|
170
|
+
else if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
|
|
171
|
+
return `${this.labelProvider.getName(node)}: ${this.labelProvider.getLongName(node)}`;
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
ResourcePropertyViewTreeWidget.ID = 'resource-properties-tree-widget';
|
|
177
|
+
ResourcePropertyViewTreeWidget.LABEL = 'Resource Properties Tree';
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, inversify_1.postConstruct)(),
|
|
180
|
+
__metadata("design:type", Function),
|
|
181
|
+
__metadata("design:paramtypes", []),
|
|
182
|
+
__metadata("design:returntype", void 0)
|
|
183
|
+
], ResourcePropertyViewTreeWidget.prototype, "init", null);
|
|
184
|
+
ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget_1 = __decorate([
|
|
185
|
+
(0, inversify_1.injectable)(),
|
|
186
|
+
__param(0, (0, inversify_1.inject)(browser_1.TreeProps)),
|
|
187
|
+
__param(1, (0, inversify_1.inject)(browser_1.TreeModel)),
|
|
188
|
+
__param(2, (0, inversify_1.inject)(browser_1.ContextMenuRenderer)),
|
|
189
|
+
__metadata("design:paramtypes", [Object, Object, browser_1.ContextMenuRenderer])
|
|
190
|
+
], ResourcePropertyViewTreeWidget);
|
|
191
|
+
exports.ResourcePropertyViewTreeWidget = ResourcePropertyViewTreeWidget;
|
|
192
192
|
//# sourceMappingURL=resource-property-view-tree-widget.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { DefaultPropertyViewWidgetProvider } from '../property-view-widget-provider';
|
|
2
|
-
import { ResourcePropertyViewTreeWidget } from './resource-property-view-tree-widget';
|
|
3
|
-
/**
|
|
4
|
-
* Provides the {@link ResourcePropertyViewTreeWidget} for
|
|
5
|
-
* {@link FileSelection}s and selections of {@link Navigatable}s.
|
|
6
|
-
*/
|
|
7
|
-
export declare class ResourcePropertyViewWidgetProvider extends DefaultPropertyViewWidgetProvider {
|
|
8
|
-
protected treeWidget: ResourcePropertyViewTreeWidget;
|
|
9
|
-
readonly id = "resources";
|
|
10
|
-
readonly label = "ResourcePropertyViewWidgetProvider";
|
|
11
|
-
canHandle(selection: Object | undefined): number;
|
|
12
|
-
protected isFileSelection(selection: Object | undefined): boolean;
|
|
13
|
-
protected isNavigatableSelection(selection: Object | undefined): boolean;
|
|
14
|
-
provideWidget(selection: Object | undefined): Promise<ResourcePropertyViewTreeWidget>;
|
|
15
|
-
updateContentWidget(selection: Object | undefined): void;
|
|
16
|
-
}
|
|
1
|
+
import { DefaultPropertyViewWidgetProvider } from '../property-view-widget-provider';
|
|
2
|
+
import { ResourcePropertyViewTreeWidget } from './resource-property-view-tree-widget';
|
|
3
|
+
/**
|
|
4
|
+
* Provides the {@link ResourcePropertyViewTreeWidget} for
|
|
5
|
+
* {@link FileSelection}s and selections of {@link Navigatable}s.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ResourcePropertyViewWidgetProvider extends DefaultPropertyViewWidgetProvider {
|
|
8
|
+
protected treeWidget: ResourcePropertyViewTreeWidget;
|
|
9
|
+
readonly id = "resources";
|
|
10
|
+
readonly label = "ResourcePropertyViewWidgetProvider";
|
|
11
|
+
canHandle(selection: Object | undefined): number;
|
|
12
|
+
protected isFileSelection(selection: Object | undefined): boolean;
|
|
13
|
+
protected isNavigatableSelection(selection: Object | undefined): boolean;
|
|
14
|
+
provideWidget(selection: Object | undefined): Promise<ResourcePropertyViewTreeWidget>;
|
|
15
|
+
updateContentWidget(selection: Object | undefined): void;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=resource-property-view-widget-provider.d.ts.map
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 EclipseSource and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.ResourcePropertyViewWidgetProvider = void 0;
|
|
28
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
29
|
-
const file_selection_1 = require("@theia/filesystem/lib/browser/file-selection");
|
|
30
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
-
const property_view_widget_provider_1 = require("../property-view-widget-provider");
|
|
32
|
-
const resource_property_view_tree_widget_1 = require("./resource-property-view-tree-widget");
|
|
33
|
-
/**
|
|
34
|
-
* Provides the {@link ResourcePropertyViewTreeWidget} for
|
|
35
|
-
* {@link FileSelection}s and selections of {@link Navigatable}s.
|
|
36
|
-
*/
|
|
37
|
-
let ResourcePropertyViewWidgetProvider = class ResourcePropertyViewWidgetProvider extends property_view_widget_provider_1.DefaultPropertyViewWidgetProvider {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(...arguments);
|
|
40
|
-
this.id = 'resources';
|
|
41
|
-
this.label = 'ResourcePropertyViewWidgetProvider';
|
|
42
|
-
}
|
|
43
|
-
canHandle(selection) {
|
|
44
|
-
return (this.isFileSelection(selection) || this.isNavigatableSelection(selection)) ? 1 : 0;
|
|
45
|
-
}
|
|
46
|
-
isFileSelection(selection) {
|
|
47
|
-
return !!selection && Array.isArray(selection) && file_selection_1.FileSelection.is(selection[0]);
|
|
48
|
-
}
|
|
49
|
-
isNavigatableSelection(selection) {
|
|
50
|
-
return !!selection && browser_1.Navigatable.is(selection);
|
|
51
|
-
}
|
|
52
|
-
provideWidget(selection) {
|
|
53
|
-
return Promise.resolve(this.treeWidget);
|
|
54
|
-
}
|
|
55
|
-
updateContentWidget(selection) {
|
|
56
|
-
this.getPropertyDataService(selection).then(service => this.treeWidget.updatePropertyViewContent(service, selection));
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, inversify_1.inject)(resource_property_view_tree_widget_1.ResourcePropertyViewTreeWidget),
|
|
61
|
-
__metadata("design:type", resource_property_view_tree_widget_1.ResourcePropertyViewTreeWidget)
|
|
62
|
-
], ResourcePropertyViewWidgetProvider.prototype, "treeWidget", void 0);
|
|
63
|
-
ResourcePropertyViewWidgetProvider = __decorate([
|
|
64
|
-
(0, inversify_1.injectable)()
|
|
65
|
-
], ResourcePropertyViewWidgetProvider);
|
|
66
|
-
exports.ResourcePropertyViewWidgetProvider = ResourcePropertyViewWidgetProvider;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ResourcePropertyViewWidgetProvider = void 0;
|
|
28
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
29
|
+
const file_selection_1 = require("@theia/filesystem/lib/browser/file-selection");
|
|
30
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
+
const property_view_widget_provider_1 = require("../property-view-widget-provider");
|
|
32
|
+
const resource_property_view_tree_widget_1 = require("./resource-property-view-tree-widget");
|
|
33
|
+
/**
|
|
34
|
+
* Provides the {@link ResourcePropertyViewTreeWidget} for
|
|
35
|
+
* {@link FileSelection}s and selections of {@link Navigatable}s.
|
|
36
|
+
*/
|
|
37
|
+
let ResourcePropertyViewWidgetProvider = class ResourcePropertyViewWidgetProvider extends property_view_widget_provider_1.DefaultPropertyViewWidgetProvider {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
this.id = 'resources';
|
|
41
|
+
this.label = 'ResourcePropertyViewWidgetProvider';
|
|
42
|
+
}
|
|
43
|
+
canHandle(selection) {
|
|
44
|
+
return (this.isFileSelection(selection) || this.isNavigatableSelection(selection)) ? 1 : 0;
|
|
45
|
+
}
|
|
46
|
+
isFileSelection(selection) {
|
|
47
|
+
return !!selection && Array.isArray(selection) && file_selection_1.FileSelection.is(selection[0]);
|
|
48
|
+
}
|
|
49
|
+
isNavigatableSelection(selection) {
|
|
50
|
+
return !!selection && browser_1.Navigatable.is(selection);
|
|
51
|
+
}
|
|
52
|
+
provideWidget(selection) {
|
|
53
|
+
return Promise.resolve(this.treeWidget);
|
|
54
|
+
}
|
|
55
|
+
updateContentWidget(selection) {
|
|
56
|
+
this.getPropertyDataService(selection).then(service => this.treeWidget.updatePropertyViewContent(service, selection));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, inversify_1.inject)(resource_property_view_tree_widget_1.ResourcePropertyViewTreeWidget),
|
|
61
|
+
__metadata("design:type", resource_property_view_tree_widget_1.ResourcePropertyViewTreeWidget)
|
|
62
|
+
], ResourcePropertyViewWidgetProvider.prototype, "treeWidget", void 0);
|
|
63
|
+
ResourcePropertyViewWidgetProvider = __decorate([
|
|
64
|
+
(0, inversify_1.injectable)()
|
|
65
|
+
], ResourcePropertyViewWidgetProvider);
|
|
66
|
+
exports.ResourcePropertyViewWidgetProvider = ResourcePropertyViewWidgetProvider;
|
|
67
67
|
//# sourceMappingURL=resource-property-view-widget-provider.js.map
|
package/lib/package.spec.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('property-view package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
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
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('property-view package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
26
|
//# sourceMappingURL=package.spec.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/property-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0-next.72+4a275b29d",
|
|
4
4
|
"description": "Theia - Property View Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/filesystem": "1.
|
|
6
|
+
"@theia/core": "1.46.0-next.72+4a275b29d",
|
|
7
|
+
"@theia/filesystem": "1.46.0-next.72+4a275b29d"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"watch": "theiaext watch"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@theia/ext-scripts": "1.
|
|
42
|
+
"@theia/ext-scripts": "1.46.0"
|
|
43
43
|
},
|
|
44
44
|
"nyc": {
|
|
45
45
|
"extends": "../../configs/nyc.json"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4a275b29d0db6c81190488c7f76cb667da05ef19"
|
|
48
48
|
}
|