@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,83 +1,83 @@
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 { nls } from '@theia/core/lib/common/nls';
18
- import { ReactWidget } from '@theia/core/lib/browser';
19
- import { injectable } from '@theia/core/shared/inversify';
20
- import * as React from '@theia/core/shared/react';
21
- import { PropertyViewContentWidget } from './property-view-content-widget';
22
- import { DefaultPropertyViewWidgetProvider } from './property-view-widget-provider';
23
-
24
- /**
25
- * Property view widget that is shown if no property data or selection is available.
26
- * This widget is provided by the {@link EmptyPropertyViewWidgetProvider}.
27
- */
28
- class EmptyPropertyViewWidget extends ReactWidget implements PropertyViewContentWidget {
29
-
30
- static readonly ID = 'theia-empty-property-view';
31
- static readonly LABEL = 'No Properties';
32
-
33
- constructor() {
34
- super();
35
- this.id = EmptyPropertyViewWidget.ID;
36
- this.title.label = EmptyPropertyViewWidget.LABEL;
37
- this.title.caption = EmptyPropertyViewWidget.LABEL;
38
- this.title.closable = false;
39
- this.node.tabIndex = 0;
40
- }
41
-
42
- updatePropertyViewContent(): void {
43
- this.update();
44
- }
45
-
46
- protected render(): React.ReactNode {
47
- return this.emptyComponent;
48
- }
49
-
50
- protected emptyComponent: JSX.Element = <div className={'theia-widget-noInfo'}>{nls.localize('theia/property-view/noProperties', 'No properties available.')}</div>;
51
-
52
- }
53
-
54
- /**
55
- * `EmptyPropertyViewWidgetProvider` is implemented to provide the {@link EmptyPropertyViewWidget}
56
- * if the given selection is undefined or no other provider can handle the given selection.
57
- */
58
- @injectable()
59
- export class EmptyPropertyViewWidgetProvider extends DefaultPropertyViewWidgetProvider {
60
-
61
- static readonly ID = 'no-properties';
62
- override readonly id = EmptyPropertyViewWidgetProvider.ID;
63
- override readonly label = 'DefaultPropertyViewWidgetProvider';
64
-
65
- private emptyWidget: EmptyPropertyViewWidget;
66
-
67
- constructor() {
68
- super();
69
- this.emptyWidget = new EmptyPropertyViewWidget();
70
- }
71
-
72
- override canHandle(selection: Object | undefined): number {
73
- return selection === undefined ? 1 : 0;
74
- }
75
-
76
- override provideWidget(selection: Object | undefined): Promise<EmptyPropertyViewWidget> {
77
- return Promise.resolve(this.emptyWidget);
78
- }
79
-
80
- override updateContentWidget(selection: Object | undefined): void {
81
- this.emptyWidget.updatePropertyViewContent();
82
- }
83
- }
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 { nls } from '@theia/core/lib/common/nls';
18
+ import { ReactWidget } from '@theia/core/lib/browser';
19
+ import { injectable } from '@theia/core/shared/inversify';
20
+ import * as React from '@theia/core/shared/react';
21
+ import { PropertyViewContentWidget } from './property-view-content-widget';
22
+ import { DefaultPropertyViewWidgetProvider } from './property-view-widget-provider';
23
+
24
+ /**
25
+ * Property view widget that is shown if no property data or selection is available.
26
+ * This widget is provided by the {@link EmptyPropertyViewWidgetProvider}.
27
+ */
28
+ class EmptyPropertyViewWidget extends ReactWidget implements PropertyViewContentWidget {
29
+
30
+ static readonly ID = 'theia-empty-property-view';
31
+ static readonly LABEL = 'No Properties';
32
+
33
+ constructor() {
34
+ super();
35
+ this.id = EmptyPropertyViewWidget.ID;
36
+ this.title.label = EmptyPropertyViewWidget.LABEL;
37
+ this.title.caption = EmptyPropertyViewWidget.LABEL;
38
+ this.title.closable = false;
39
+ this.node.tabIndex = 0;
40
+ }
41
+
42
+ updatePropertyViewContent(): void {
43
+ this.update();
44
+ }
45
+
46
+ protected render(): React.ReactNode {
47
+ return this.emptyComponent;
48
+ }
49
+
50
+ protected emptyComponent: JSX.Element = <div className={'theia-widget-noInfo'}>{nls.localize('theia/property-view/noProperties', 'No properties available.')}</div>;
51
+
52
+ }
53
+
54
+ /**
55
+ * `EmptyPropertyViewWidgetProvider` is implemented to provide the {@link EmptyPropertyViewWidget}
56
+ * if the given selection is undefined or no other provider can handle the given selection.
57
+ */
58
+ @injectable()
59
+ export class EmptyPropertyViewWidgetProvider extends DefaultPropertyViewWidgetProvider {
60
+
61
+ static readonly ID = 'no-properties';
62
+ override readonly id = EmptyPropertyViewWidgetProvider.ID;
63
+ override readonly label = 'DefaultPropertyViewWidgetProvider';
64
+
65
+ private emptyWidget: EmptyPropertyViewWidget;
66
+
67
+ constructor() {
68
+ super();
69
+ this.emptyWidget = new EmptyPropertyViewWidget();
70
+ }
71
+
72
+ override canHandle(selection: Object | undefined): number {
73
+ return selection === undefined ? 1 : 0;
74
+ }
75
+
76
+ override provideWidget(selection: Object | undefined): Promise<EmptyPropertyViewWidget> {
77
+ return Promise.resolve(this.emptyWidget);
78
+ }
79
+
80
+ override updateContentWidget(selection: Object | undefined): void {
81
+ this.emptyWidget.updatePropertyViewContent();
82
+ }
83
+ }
@@ -1,48 +1,48 @@
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
- export const PropertyDataService = Symbol('PropertyDataService');
18
- /**
19
- * `PropertyDataService` should be implemented to provide property data for the given selection.
20
- */
21
- export interface PropertyDataService {
22
-
23
- /**
24
- * A unique id for this provider.
25
- */
26
- readonly id: string;
27
- /**
28
- * A human-readable name for this provider.
29
- */
30
- readonly label?: string;
31
-
32
- /**
33
- * Test whether this provider can provide property data for the given selection.
34
- * Return a nonzero number if this provider can provide; otherwise it cannot.
35
- * Never reject.
36
- *
37
- * A returned value indicating a priority of this provider.
38
- */
39
- canHandleSelection(selection: Object | undefined): number;
40
-
41
- /**
42
- * Provide property data for the given selection.
43
- * Resolve to a property view content widget.
44
- * Never reject if `canHandle` returns a positive number; otherwise should reject.
45
- */
46
- providePropertyData(selection: Object | undefined): Promise<Object | undefined>;
47
-
48
- }
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
+ export const PropertyDataService = Symbol('PropertyDataService');
18
+ /**
19
+ * `PropertyDataService` should be implemented to provide property data for the given selection.
20
+ */
21
+ export interface PropertyDataService {
22
+
23
+ /**
24
+ * A unique id for this provider.
25
+ */
26
+ readonly id: string;
27
+ /**
28
+ * A human-readable name for this provider.
29
+ */
30
+ readonly label?: string;
31
+
32
+ /**
33
+ * Test whether this provider can provide property data for the given selection.
34
+ * Return a nonzero number if this provider can provide; otherwise it cannot.
35
+ * Never reject.
36
+ *
37
+ * A returned value indicating a priority of this provider.
38
+ */
39
+ canHandleSelection(selection: Object | undefined): number;
40
+
41
+ /**
42
+ * Provide property data for the given selection.
43
+ * Resolve to a property view content widget.
44
+ * Never reject if `canHandle` returns a positive number; otherwise should reject.
45
+ */
46
+ providePropertyData(selection: Object | undefined): Promise<Object | undefined>;
47
+
48
+ }
@@ -1,27 +1,27 @@
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 { Widget } from '@theia/core/lib/browser/widgets/widget';
18
- import { PropertyDataService } from './property-data-service';
19
-
20
- /**
21
- * A widget that fetches the property data via the given {@link PropertyDataService} and the given selection
22
- * and renders that property data.
23
- * This widget can be provided by a registered `PropertyViewWidgetProvider`.
24
- */
25
- export interface PropertyViewContentWidget extends Widget {
26
- updatePropertyViewContent(propertyDataService?: PropertyDataService, selection?: Object): void;
27
- }
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 { Widget } from '@theia/core/lib/browser/widgets/widget';
18
+ import { PropertyDataService } from './property-data-service';
19
+
20
+ /**
21
+ * A widget that fetches the property data via the given {@link PropertyDataService} and the given selection
22
+ * and renders that property data.
23
+ * This widget can be provided by a registered `PropertyViewWidgetProvider`.
24
+ */
25
+ export interface PropertyViewContentWidget extends Widget {
26
+ updatePropertyViewContent(propertyDataService?: PropertyDataService, selection?: Object): void;
27
+ }
@@ -1,36 +1,36 @@
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 { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
18
- import { injectable } from '@theia/core/shared/inversify';
19
- import { PropertyViewWidget } from './property-view-widget';
20
-
21
- @injectable()
22
- export class PropertyViewContribution extends AbstractViewContribution<PropertyViewWidget> {
23
-
24
- constructor() {
25
- super({
26
- widgetId: PropertyViewWidget.ID,
27
- widgetName: PropertyViewWidget.LABEL,
28
- defaultWidgetOptions: {
29
- area: 'bottom'
30
- },
31
- toggleCommandId: 'property-view:toggle',
32
- toggleKeybinding: 'shift+alt+p'
33
- });
34
- }
35
-
36
- }
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 { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { PropertyViewWidget } from './property-view-widget';
20
+
21
+ @injectable()
22
+ export class PropertyViewContribution extends AbstractViewContribution<PropertyViewWidget> {
23
+
24
+ constructor() {
25
+ super({
26
+ widgetId: PropertyViewWidget.ID,
27
+ widgetName: PropertyViewWidget.LABEL,
28
+ defaultWidgetOptions: {
29
+ area: 'bottom'
30
+ },
31
+ toggleCommandId: 'property-view:toggle',
32
+ toggleKeybinding: 'shift+alt+p'
33
+ });
34
+ }
35
+
36
+ }
@@ -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 { bindViewContribution, WidgetFactory } from '@theia/core/lib/browser';
18
- import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
19
- import { ContainerModule } from '@theia/core/shared/inversify';
20
- import { EmptyPropertyViewWidgetProvider } from './empty-property-view-widget-provider';
21
- import { PropertyDataService } from './property-data-service';
22
- import { PropertyViewContribution } from './property-view-contribution';
23
- import { PropertyViewService } from './property-view-service';
24
- import { PropertyViewWidget } from './property-view-widget';
25
- import { PropertyViewWidgetProvider } from './property-view-widget-provider';
26
- import { bindResourcePropertyView } from './resource-property-view';
27
- import '../../src/browser/style/property-view.css';
28
-
29
- export default new ContainerModule(bind => {
30
- bind(PropertyViewService).toSelf().inSingletonScope();
31
-
32
- bindContributionProvider(bind, PropertyDataService);
33
- bindContributionProvider(bind, PropertyViewWidgetProvider);
34
-
35
- bind(EmptyPropertyViewWidgetProvider).toSelf().inSingletonScope();
36
- bind(PropertyViewWidgetProvider).to(EmptyPropertyViewWidgetProvider);
37
-
38
- bind(PropertyViewWidget).toSelf();
39
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
40
- id: PropertyViewWidget.ID,
41
- createWidget: () => container.get(PropertyViewWidget)
42
- })).inSingletonScope();
43
-
44
- bindViewContribution(bind, PropertyViewContribution);
45
-
46
- bindResourcePropertyView(bind);
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 { bindViewContribution, WidgetFactory } from '@theia/core/lib/browser';
18
+ import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
19
+ import { ContainerModule } from '@theia/core/shared/inversify';
20
+ import { EmptyPropertyViewWidgetProvider } from './empty-property-view-widget-provider';
21
+ import { PropertyDataService } from './property-data-service';
22
+ import { PropertyViewContribution } from './property-view-contribution';
23
+ import { PropertyViewService } from './property-view-service';
24
+ import { PropertyViewWidget } from './property-view-widget';
25
+ import { PropertyViewWidgetProvider } from './property-view-widget-provider';
26
+ import { bindResourcePropertyView } from './resource-property-view';
27
+ import '../../src/browser/style/property-view.css';
28
+
29
+ export default new ContainerModule(bind => {
30
+ bind(PropertyViewService).toSelf().inSingletonScope();
31
+
32
+ bindContributionProvider(bind, PropertyDataService);
33
+ bindContributionProvider(bind, PropertyViewWidgetProvider);
34
+
35
+ bind(EmptyPropertyViewWidgetProvider).toSelf().inSingletonScope();
36
+ bind(PropertyViewWidgetProvider).to(EmptyPropertyViewWidgetProvider);
37
+
38
+ bind(PropertyViewWidget).toSelf();
39
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
40
+ id: PropertyViewWidget.ID,
41
+ createWidget: () => container.get(PropertyViewWidget)
42
+ })).inSingletonScope();
43
+
44
+ bindViewContribution(bind, PropertyViewContribution);
45
+
46
+ bindResourcePropertyView(bind);
47
+ });
@@ -1,62 +1,62 @@
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 { ContributionProvider, Prioritizeable } from '@theia/core';
18
- import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
19
- import { EmptyPropertyViewWidgetProvider } from './empty-property-view-widget-provider';
20
- import { PropertyViewWidgetProvider } from './property-view-widget-provider';
21
-
22
- /**
23
- * `PropertyViewService` provides an access to existing property view widget providers.
24
- */
25
- @injectable()
26
- export class PropertyViewService {
27
-
28
- @inject(ContributionProvider) @named(PropertyViewWidgetProvider)
29
- private readonly contributions: ContributionProvider<PropertyViewWidgetProvider>;
30
-
31
- @inject(EmptyPropertyViewWidgetProvider)
32
- private readonly emptyWidgetProvider: EmptyPropertyViewWidgetProvider;
33
-
34
- private providers: PropertyViewWidgetProvider[] = [];
35
-
36
- @postConstruct()
37
- init(): void {
38
- this.providers = this.providers.concat(this.contributions.getContributions());
39
- }
40
-
41
- /**
42
- * Return a property view widget provider with the highest priority for the given selection.
43
- * Never reject, return the default provider ({@link EmptyPropertyViewWidgetProvider};
44
- * displays `No properties available`) if there are no other matches.
45
- */
46
- async getProvider(selection: Object | undefined): Promise<PropertyViewWidgetProvider> {
47
- const provider = await this.prioritize(selection);
48
- return provider ?? this.emptyWidgetProvider;
49
- }
50
-
51
- protected async prioritize(selection: Object | undefined): Promise<PropertyViewWidgetProvider | undefined> {
52
- const prioritized = await Prioritizeable.prioritizeAll(this.providers, async (provider: PropertyViewWidgetProvider) => {
53
- try {
54
- return await provider.canHandle(selection);
55
- } catch {
56
- return 0;
57
- }
58
- });
59
- return prioritized.length !== 0 ? prioritized[0].value : undefined;
60
- }
61
-
62
- }
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 { ContributionProvider, Prioritizeable } from '@theia/core';
18
+ import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
19
+ import { EmptyPropertyViewWidgetProvider } from './empty-property-view-widget-provider';
20
+ import { PropertyViewWidgetProvider } from './property-view-widget-provider';
21
+
22
+ /**
23
+ * `PropertyViewService` provides an access to existing property view widget providers.
24
+ */
25
+ @injectable()
26
+ export class PropertyViewService {
27
+
28
+ @inject(ContributionProvider) @named(PropertyViewWidgetProvider)
29
+ private readonly contributions: ContributionProvider<PropertyViewWidgetProvider>;
30
+
31
+ @inject(EmptyPropertyViewWidgetProvider)
32
+ private readonly emptyWidgetProvider: EmptyPropertyViewWidgetProvider;
33
+
34
+ private providers: PropertyViewWidgetProvider[] = [];
35
+
36
+ @postConstruct()
37
+ init(): void {
38
+ this.providers = this.providers.concat(this.contributions.getContributions());
39
+ }
40
+
41
+ /**
42
+ * Return a property view widget provider with the highest priority for the given selection.
43
+ * Never reject, return the default provider ({@link EmptyPropertyViewWidgetProvider};
44
+ * displays `No properties available`) if there are no other matches.
45
+ */
46
+ async getProvider(selection: Object | undefined): Promise<PropertyViewWidgetProvider> {
47
+ const provider = await this.prioritize(selection);
48
+ return provider ?? this.emptyWidgetProvider;
49
+ }
50
+
51
+ protected async prioritize(selection: Object | undefined): Promise<PropertyViewWidgetProvider | undefined> {
52
+ const prioritized = await Prioritizeable.prioritizeAll(this.providers, async (provider: PropertyViewWidgetProvider) => {
53
+ try {
54
+ return await provider.canHandle(selection);
55
+ } catch {
56
+ return 0;
57
+ }
58
+ });
59
+ return prioritized.length !== 0 ? prioritized[0].value : undefined;
60
+ }
61
+
62
+ }