@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.
Files changed (56) hide show
  1. package/README.md +44 -44
  2. package/lib/browser/empty-property-view-widget-provider.d.ts +32 -32
  3. package/lib/browser/empty-property-view-widget-provider.js +83 -83
  4. package/lib/browser/property-data-service.d.ts +28 -28
  5. package/lib/browser/property-data-service.js +19 -19
  6. package/lib/browser/property-view-content-widget.d.ts +10 -10
  7. package/lib/browser/property-view-content-widget.js +17 -17
  8. package/lib/browser/property-view-contribution.d.ts +5 -5
  9. package/lib/browser/property-view-contribution.js +48 -48
  10. package/lib/browser/property-view-frontend-module.d.ts +4 -4
  11. package/lib/browser/property-view-frontend-module.js +42 -42
  12. package/lib/browser/property-view-service.d.ts +17 -17
  13. package/lib/browser/property-view-service.js +81 -81
  14. package/lib/browser/property-view-widget-provider.d.ts +57 -57
  15. package/lib/browser/property-view-widget-provider.js +84 -84
  16. package/lib/browser/property-view-widget.d.ts +26 -26
  17. package/lib/browser/property-view-widget.js +130 -130
  18. package/lib/browser/resource-property-view/index.d.ts +1 -1
  19. package/lib/browser/resource-property-view/index.js +28 -28
  20. package/lib/browser/resource-property-view/resource-property-data-service.d.ts +17 -17
  21. package/lib/browser/resource-property-view/resource-property-data-service.js +72 -72
  22. package/lib/browser/resource-property-view/resource-property-data-service.spec.d.ts +1 -1
  23. package/lib/browser/resource-property-view/resource-property-data-service.spec.js +101 -101
  24. package/lib/browser/resource-property-view/resource-property-view-label-provider.d.ts +10 -10
  25. package/lib/browser/resource-property-view/resource-property-view-label-provider.js +60 -60
  26. package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.d.ts +1 -1
  27. package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.js +129 -129
  28. package/lib/browser/resource-property-view/resource-property-view-tree-container.d.ts +2 -2
  29. package/lib/browser/resource-property-view/resource-property-view-tree-container.js +43 -43
  30. package/lib/browser/resource-property-view/resource-property-view-tree-items.d.ts +27 -27
  31. package/lib/browser/resource-property-view/resource-property-view-tree-items.js +41 -41
  32. package/lib/browser/resource-property-view/resource-property-view-tree-widget.d.ts +40 -40
  33. package/lib/browser/resource-property-view/resource-property-view-tree-widget.js +191 -191
  34. package/lib/browser/resource-property-view/resource-property-view-widget-provider.d.ts +16 -16
  35. package/lib/browser/resource-property-view/resource-property-view-widget-provider.js +66 -66
  36. package/lib/package.spec.js +25 -25
  37. package/package.json +5 -5
  38. package/src/browser/empty-property-view-widget-provider.tsx +83 -83
  39. package/src/browser/property-data-service.ts +48 -48
  40. package/src/browser/property-view-content-widget.ts +27 -27
  41. package/src/browser/property-view-contribution.ts +36 -36
  42. package/src/browser/property-view-frontend-module.ts +47 -47
  43. package/src/browser/property-view-service.ts +62 -62
  44. package/src/browser/property-view-widget-provider.ts +112 -112
  45. package/src/browser/property-view-widget.tsx +118 -118
  46. package/src/browser/resource-property-view/index.ts +17 -17
  47. package/src/browser/resource-property-view/resource-property-data-service.spec.ts +127 -127
  48. package/src/browser/resource-property-view/resource-property-data-service.ts +64 -64
  49. package/src/browser/resource-property-view/resource-property-view-label-provider.spec.ts +153 -153
  50. package/src/browser/resource-property-view/resource-property-view-label-provider.ts +49 -49
  51. package/src/browser/resource-property-view/resource-property-view-tree-container.ts +47 -47
  52. package/src/browser/resource-property-view/resource-property-view-tree-items.ts +53 -53
  53. package/src/browser/resource-property-view/resource-property-view-tree-widget.tsx +219 -219
  54. package/src/browser/resource-property-view/resource-property-view-widget-provider.ts +55 -55
  55. package/src/browser/style/property-view.css +51 -51
  56. package/src/package.spec.ts +29 -29
@@ -1,131 +1,131 @@
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 PropertyViewWidget_1;
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.PropertyViewWidget = void 0;
29
- const core_1 = require("@theia/core");
30
- const widget_1 = require("@theia/core/lib/browser/widgets/widget");
31
- const disposable_1 = require("@theia/core/lib/common/disposable");
32
- const inversify_1 = require("@theia/core/shared/inversify");
33
- const property_view_service_1 = require("./property-view-service");
34
- const nls_1 = require("@theia/core/lib/common/nls");
35
- /**
36
- * The main container for the selection-specific property widgets.
37
- * Based on the given selection, the registered `PropertyViewWidgetProvider` provides the
38
- * content widget that displays the corresponding properties.
39
- */
40
- let PropertyViewWidget = PropertyViewWidget_1 = class PropertyViewWidget extends widget_1.BaseWidget {
41
- constructor() {
42
- super(...arguments);
43
- this.toDisposeOnDetach = new disposable_1.DisposableCollection();
44
- }
45
- init() {
46
- this.id = PropertyViewWidget_1.ID;
47
- this.title.label = PropertyViewWidget_1.LABEL;
48
- this.title.caption = PropertyViewWidget_1.LABEL;
49
- this.title.iconClass = (0, widget_1.codicon)('table');
50
- this.title.closable = true;
51
- this.addClass('theia-property-view-widget');
52
- this.node.tabIndex = 0;
53
- let disposed = false;
54
- this.toDispose.push(core_1.Disposable.create(() => disposed = true));
55
- this.toDispose.push(this.selectionService.onSelectionChanged((selection) => {
56
- this.propertyViewService.getProvider(selection).then(provider => {
57
- provider.provideWidget(selection).then(contentWidget => {
58
- if (!disposed) {
59
- this.replaceContentWidget(contentWidget);
60
- provider.updateContentWidget(selection);
61
- }
62
- });
63
- });
64
- }));
65
- }
66
- initializeContentWidget(selection) {
67
- this.propertyViewService.getProvider(selection).then(provider => {
68
- provider.provideWidget(selection).then(contentWidget => {
69
- this.attachContentWidget(contentWidget);
70
- provider.updateContentWidget(selection);
71
- });
72
- });
73
- }
74
- replaceContentWidget(newContentWidget) {
75
- if (this.contentWidget.id !== newContentWidget.id) {
76
- if (this.contentWidget) {
77
- widget_1.Widget.detach(this.contentWidget);
78
- }
79
- this.attachContentWidget(newContentWidget);
80
- }
81
- }
82
- attachContentWidget(newContentWidget) {
83
- this.contentWidget = newContentWidget;
84
- widget_1.Widget.attach(this.contentWidget, this.node);
85
- this.toDisposeOnDetach = new disposable_1.DisposableCollection();
86
- this.toDisposeOnDetach.push(core_1.Disposable.create(() => {
87
- if (this.contentWidget) {
88
- widget_1.Widget.detach(this.contentWidget);
89
- }
90
- }));
91
- this.update();
92
- }
93
- onAfterAttach(msg) {
94
- super.onAfterAttach(msg);
95
- this.initializeContentWidget(this.selectionService.selection);
96
- }
97
- onActivateRequest(msg) {
98
- super.onActivateRequest(msg);
99
- this.node.focus();
100
- if (this.contentWidget) {
101
- this.contentWidget.activate();
102
- }
103
- }
104
- onResize(msg) {
105
- super.onResize(msg);
106
- if (this.contentWidget) {
107
- widget_1.MessageLoop.sendMessage(this.contentWidget, msg);
108
- }
109
- }
110
- };
111
- PropertyViewWidget.ID = 'property-view';
112
- PropertyViewWidget.LABEL = nls_1.nls.localize('theia/property-view/properties', 'Properties');
113
- __decorate([
114
- (0, inversify_1.inject)(property_view_service_1.PropertyViewService),
115
- __metadata("design:type", property_view_service_1.PropertyViewService)
116
- ], PropertyViewWidget.prototype, "propertyViewService", void 0);
117
- __decorate([
118
- (0, inversify_1.inject)(core_1.SelectionService),
119
- __metadata("design:type", core_1.SelectionService)
120
- ], PropertyViewWidget.prototype, "selectionService", void 0);
121
- __decorate([
122
- (0, inversify_1.postConstruct)(),
123
- __metadata("design:type", Function),
124
- __metadata("design:paramtypes", []),
125
- __metadata("design:returntype", void 0)
126
- ], PropertyViewWidget.prototype, "init", null);
127
- PropertyViewWidget = PropertyViewWidget_1 = __decorate([
128
- (0, inversify_1.injectable)()
129
- ], PropertyViewWidget);
130
- exports.PropertyViewWidget = PropertyViewWidget;
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 PropertyViewWidget_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.PropertyViewWidget = void 0;
29
+ const core_1 = require("@theia/core");
30
+ const widget_1 = require("@theia/core/lib/browser/widgets/widget");
31
+ const disposable_1 = require("@theia/core/lib/common/disposable");
32
+ const inversify_1 = require("@theia/core/shared/inversify");
33
+ const property_view_service_1 = require("./property-view-service");
34
+ const nls_1 = require("@theia/core/lib/common/nls");
35
+ /**
36
+ * The main container for the selection-specific property widgets.
37
+ * Based on the given selection, the registered `PropertyViewWidgetProvider` provides the
38
+ * content widget that displays the corresponding properties.
39
+ */
40
+ let PropertyViewWidget = PropertyViewWidget_1 = class PropertyViewWidget extends widget_1.BaseWidget {
41
+ constructor() {
42
+ super(...arguments);
43
+ this.toDisposeOnDetach = new disposable_1.DisposableCollection();
44
+ }
45
+ init() {
46
+ this.id = PropertyViewWidget_1.ID;
47
+ this.title.label = PropertyViewWidget_1.LABEL;
48
+ this.title.caption = PropertyViewWidget_1.LABEL;
49
+ this.title.iconClass = (0, widget_1.codicon)('table');
50
+ this.title.closable = true;
51
+ this.addClass('theia-property-view-widget');
52
+ this.node.tabIndex = 0;
53
+ let disposed = false;
54
+ this.toDispose.push(core_1.Disposable.create(() => disposed = true));
55
+ this.toDispose.push(this.selectionService.onSelectionChanged((selection) => {
56
+ this.propertyViewService.getProvider(selection).then(provider => {
57
+ provider.provideWidget(selection).then(contentWidget => {
58
+ if (!disposed) {
59
+ this.replaceContentWidget(contentWidget);
60
+ provider.updateContentWidget(selection);
61
+ }
62
+ });
63
+ });
64
+ }));
65
+ }
66
+ initializeContentWidget(selection) {
67
+ this.propertyViewService.getProvider(selection).then(provider => {
68
+ provider.provideWidget(selection).then(contentWidget => {
69
+ this.attachContentWidget(contentWidget);
70
+ provider.updateContentWidget(selection);
71
+ });
72
+ });
73
+ }
74
+ replaceContentWidget(newContentWidget) {
75
+ if (this.contentWidget.id !== newContentWidget.id) {
76
+ if (this.contentWidget) {
77
+ widget_1.Widget.detach(this.contentWidget);
78
+ }
79
+ this.attachContentWidget(newContentWidget);
80
+ }
81
+ }
82
+ attachContentWidget(newContentWidget) {
83
+ this.contentWidget = newContentWidget;
84
+ widget_1.Widget.attach(this.contentWidget, this.node);
85
+ this.toDisposeOnDetach = new disposable_1.DisposableCollection();
86
+ this.toDisposeOnDetach.push(core_1.Disposable.create(() => {
87
+ if (this.contentWidget) {
88
+ widget_1.Widget.detach(this.contentWidget);
89
+ }
90
+ }));
91
+ this.update();
92
+ }
93
+ onAfterAttach(msg) {
94
+ super.onAfterAttach(msg);
95
+ this.initializeContentWidget(this.selectionService.selection);
96
+ }
97
+ onActivateRequest(msg) {
98
+ super.onActivateRequest(msg);
99
+ this.node.focus();
100
+ if (this.contentWidget) {
101
+ this.contentWidget.activate();
102
+ }
103
+ }
104
+ onResize(msg) {
105
+ super.onResize(msg);
106
+ if (this.contentWidget) {
107
+ widget_1.MessageLoop.sendMessage(this.contentWidget, msg);
108
+ }
109
+ }
110
+ };
111
+ PropertyViewWidget.ID = 'property-view';
112
+ PropertyViewWidget.LABEL = nls_1.nls.localize('theia/property-view/properties', 'Properties');
113
+ __decorate([
114
+ (0, inversify_1.inject)(property_view_service_1.PropertyViewService),
115
+ __metadata("design:type", property_view_service_1.PropertyViewService)
116
+ ], PropertyViewWidget.prototype, "propertyViewService", void 0);
117
+ __decorate([
118
+ (0, inversify_1.inject)(core_1.SelectionService),
119
+ __metadata("design:type", core_1.SelectionService)
120
+ ], PropertyViewWidget.prototype, "selectionService", void 0);
121
+ __decorate([
122
+ (0, inversify_1.postConstruct)(),
123
+ __metadata("design:type", Function),
124
+ __metadata("design:paramtypes", []),
125
+ __metadata("design:returntype", void 0)
126
+ ], PropertyViewWidget.prototype, "init", null);
127
+ PropertyViewWidget = PropertyViewWidget_1 = __decorate([
128
+ (0, inversify_1.injectable)()
129
+ ], PropertyViewWidget);
130
+ exports.PropertyViewWidget = PropertyViewWidget;
131
131
  //# sourceMappingURL=property-view-widget.js.map
@@ -1,2 +1,2 @@
1
- export * from './resource-property-view-tree-container';
1
+ export * from './resource-property-view-tree-container';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,29 +1,29 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- __exportStar(require("./resource-property-view-tree-container"), exports);
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ __exportStar(require("./resource-property-view-tree-container"), exports);
29
29
  //# sourceMappingURL=index.js.map
@@ -1,18 +1,18 @@
1
- import URI from '@theia/core/lib/common/uri';
2
- import { FileService } from '@theia/filesystem/lib/browser/file-service';
3
- import { FileStat } from '@theia/filesystem/lib/common/files';
4
- import { PropertyDataService } from '../property-data-service';
5
- /**
6
- * This data service provides property data for {@link FileSelection}s and selections of {@link Navigatable}s.
7
- */
8
- export declare class ResourcePropertyDataService implements PropertyDataService {
9
- readonly id = "resources";
10
- readonly label = "ResourcePropertyDataService";
11
- protected readonly fileService: FileService;
12
- canHandleSelection(selection: Object | undefined): number;
13
- protected isFileSelection(selection: Object | undefined): boolean;
14
- protected isNavigatableSelection(selection: Object | undefined): boolean;
15
- protected getFileStat(uri: URI): Promise<FileStat>;
16
- providePropertyData(selection: Object | undefined): Promise<FileStat | undefined>;
17
- }
1
+ import URI from '@theia/core/lib/common/uri';
2
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
3
+ import { FileStat } from '@theia/filesystem/lib/common/files';
4
+ import { PropertyDataService } from '../property-data-service';
5
+ /**
6
+ * This data service provides property data for {@link FileSelection}s and selections of {@link Navigatable}s.
7
+ */
8
+ export declare class ResourcePropertyDataService implements PropertyDataService {
9
+ readonly id = "resources";
10
+ readonly label = "ResourcePropertyDataService";
11
+ protected readonly fileService: FileService;
12
+ canHandleSelection(selection: Object | undefined): number;
13
+ protected isFileSelection(selection: Object | undefined): boolean;
14
+ protected isNavigatableSelection(selection: Object | undefined): boolean;
15
+ protected getFileStat(uri: URI): Promise<FileStat>;
16
+ providePropertyData(selection: Object | undefined): Promise<FileStat | undefined>;
17
+ }
18
18
  //# sourceMappingURL=resource-property-data-service.d.ts.map
@@ -1,73 +1,73 @@
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.ResourcePropertyDataService = 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 file_service_1 = require("@theia/filesystem/lib/browser/file-service");
31
- const inversify_1 = require("@theia/core/shared/inversify");
32
- /**
33
- * This data service provides property data for {@link FileSelection}s and selections of {@link Navigatable}s.
34
- */
35
- let ResourcePropertyDataService = class ResourcePropertyDataService {
36
- constructor() {
37
- this.id = 'resources';
38
- this.label = 'ResourcePropertyDataService';
39
- }
40
- canHandleSelection(selection) {
41
- return (this.isFileSelection(selection) || this.isNavigatableSelection(selection)) ? 1 : 0;
42
- }
43
- isFileSelection(selection) {
44
- return !!selection && Array.isArray(selection) && file_selection_1.FileSelection.is(selection[0]);
45
- }
46
- isNavigatableSelection(selection) {
47
- return !!selection && browser_1.Navigatable.is(selection);
48
- }
49
- async getFileStat(uri) {
50
- return this.fileService.resolve(uri);
51
- }
52
- async providePropertyData(selection) {
53
- if (this.isFileSelection(selection) && Array.isArray(selection)) {
54
- return this.getFileStat(selection[0].fileStat.resource);
55
- }
56
- else if (this.isNavigatableSelection(selection)) {
57
- const navigatableUri = selection.getResourceUri();
58
- if (navigatableUri) {
59
- return this.getFileStat(navigatableUri);
60
- }
61
- }
62
- return undefined;
63
- }
64
- };
65
- __decorate([
66
- (0, inversify_1.inject)(file_service_1.FileService),
67
- __metadata("design:type", file_service_1.FileService)
68
- ], ResourcePropertyDataService.prototype, "fileService", void 0);
69
- ResourcePropertyDataService = __decorate([
70
- (0, inversify_1.injectable)()
71
- ], ResourcePropertyDataService);
72
- exports.ResourcePropertyDataService = ResourcePropertyDataService;
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.ResourcePropertyDataService = 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 file_service_1 = require("@theia/filesystem/lib/browser/file-service");
31
+ const inversify_1 = require("@theia/core/shared/inversify");
32
+ /**
33
+ * This data service provides property data for {@link FileSelection}s and selections of {@link Navigatable}s.
34
+ */
35
+ let ResourcePropertyDataService = class ResourcePropertyDataService {
36
+ constructor() {
37
+ this.id = 'resources';
38
+ this.label = 'ResourcePropertyDataService';
39
+ }
40
+ canHandleSelection(selection) {
41
+ return (this.isFileSelection(selection) || this.isNavigatableSelection(selection)) ? 1 : 0;
42
+ }
43
+ isFileSelection(selection) {
44
+ return !!selection && Array.isArray(selection) && file_selection_1.FileSelection.is(selection[0]);
45
+ }
46
+ isNavigatableSelection(selection) {
47
+ return !!selection && browser_1.Navigatable.is(selection);
48
+ }
49
+ async getFileStat(uri) {
50
+ return this.fileService.resolve(uri);
51
+ }
52
+ async providePropertyData(selection) {
53
+ if (this.isFileSelection(selection) && Array.isArray(selection)) {
54
+ return this.getFileStat(selection[0].fileStat.resource);
55
+ }
56
+ else if (this.isNavigatableSelection(selection)) {
57
+ const navigatableUri = selection.getResourceUri();
58
+ if (navigatableUri) {
59
+ return this.getFileStat(navigatableUri);
60
+ }
61
+ }
62
+ return undefined;
63
+ }
64
+ };
65
+ __decorate([
66
+ (0, inversify_1.inject)(file_service_1.FileService),
67
+ __metadata("design:type", file_service_1.FileService)
68
+ ], ResourcePropertyDataService.prototype, "fileService", void 0);
69
+ ResourcePropertyDataService = __decorate([
70
+ (0, inversify_1.injectable)()
71
+ ], ResourcePropertyDataService);
72
+ exports.ResourcePropertyDataService = ResourcePropertyDataService;
73
73
  //# sourceMappingURL=resource-property-data-service.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=resource-property-data-service.spec.d.ts.map