@theia/workspace 1.53.0-next.55 → 1.53.0-next.64

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 (45) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/workspace-trust-preferences.d.ts.map +1 -1
  3. package/lib/browser/workspace-trust-preferences.js +1 -0
  4. package/lib/browser/workspace-trust-preferences.js.map +1 -1
  5. package/lib/browser/workspace-trust-service.d.ts.map +1 -1
  6. package/lib/browser/workspace-trust-service.js +11 -9
  7. package/lib/browser/workspace-trust-service.js.map +1 -1
  8. package/package.json +5 -5
  9. package/src/browser/canonical-uri-service.ts +57 -57
  10. package/src/browser/diff-service.ts +62 -62
  11. package/src/browser/index.ts +23 -23
  12. package/src/browser/quick-open-workspace.ts +112 -112
  13. package/src/browser/untitled-workspace-exit-dialog.ts +70 -70
  14. package/src/browser/workspace-breadcrumbs-contribution.ts +56 -56
  15. package/src/browser/workspace-commands.spec.ts +153 -153
  16. package/src/browser/workspace-commands.ts +557 -557
  17. package/src/browser/workspace-compare-handler.ts +56 -56
  18. package/src/browser/workspace-delete-handler.ts +212 -212
  19. package/src/browser/workspace-duplicate-handler.ts +75 -75
  20. package/src/browser/workspace-frontend-contribution.ts +537 -537
  21. package/src/browser/workspace-frontend-module.ts +118 -118
  22. package/src/browser/workspace-input-dialog.ts +61 -61
  23. package/src/browser/workspace-preferences.ts +58 -58
  24. package/src/browser/workspace-schema-updater.ts +150 -150
  25. package/src/browser/workspace-service.ts +780 -780
  26. package/src/browser/workspace-storage-service.ts +67 -67
  27. package/src/browser/workspace-trust-preferences.ts +77 -76
  28. package/src/browser/workspace-trust-service.ts +154 -152
  29. package/src/browser/workspace-uri-contribution.spec.ts +191 -191
  30. package/src/browser/workspace-uri-contribution.ts +97 -97
  31. package/src/browser/workspace-user-working-directory-provider.ts +49 -49
  32. package/src/browser/workspace-utils.ts +45 -45
  33. package/src/browser/workspace-variable-contribution.ts +222 -222
  34. package/src/browser/workspace-window-title-updater.ts +45 -45
  35. package/src/browser-only/browser-only-workspace-server.ts +69 -69
  36. package/src/browser-only/workspace-frontend-only-module.ts +28 -28
  37. package/src/common/index.ts +19 -19
  38. package/src/common/test/mock-workspace-server.ts +29 -29
  39. package/src/common/untitled-workspace-service.ts +50 -50
  40. package/src/common/workspace-file-service.ts +72 -72
  41. package/src/common/workspace-protocol.ts +47 -47
  42. package/src/node/default-workspace-server.spec.ts +100 -100
  43. package/src/node/default-workspace-server.ts +244 -244
  44. package/src/node/index.ts +18 -18
  45. package/src/node/workspace-backend-module.ts +38 -38
@@ -1,118 +1,118 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 TypeFox 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 { ContainerModule, interfaces } from '@theia/core/shared/inversify';
18
- import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
19
- import { WebSocketConnectionProvider, FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser';
20
- import {
21
- OpenFileDialogFactory,
22
- SaveFileDialogFactory,
23
- OpenFileDialogProps,
24
- SaveFileDialogProps,
25
- createOpenFileDialogContainer,
26
- createSaveFileDialogContainer,
27
- OpenFileDialog,
28
- SaveFileDialog,
29
- } from '@theia/filesystem/lib/browser';
30
- import { StorageService } from '@theia/core/lib/browser/storage-service';
31
- import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
32
- import { VariableContribution } from '@theia/variable-resolver/lib/browser';
33
- import { WorkspaceServer, workspacePath, UntitledWorkspaceService, WorkspaceFileService } from '../common';
34
- import { WorkspaceFrontendContribution } from './workspace-frontend-contribution';
35
- import { WorkspaceService } from './workspace-service';
36
- import { WorkspaceCommandContribution, FileMenuContribution, EditMenuContribution } from './workspace-commands';
37
- import { WorkspaceVariableContribution } from './workspace-variable-contribution';
38
- import { WorkspaceStorageService } from './workspace-storage-service';
39
- import { WorkspaceUriLabelProviderContribution } from './workspace-uri-contribution';
40
- import { bindWorkspacePreferences } from './workspace-preferences';
41
- import { QuickOpenWorkspace } from './quick-open-workspace';
42
- import { WorkspaceDeleteHandler } from './workspace-delete-handler';
43
- import { WorkspaceDuplicateHandler } from './workspace-duplicate-handler';
44
- import { WorkspaceUtils } from './workspace-utils';
45
- import { WorkspaceCompareHandler } from './workspace-compare-handler';
46
- import { DiffService } from './diff-service';
47
- import { JsonSchemaContribution } from '@theia/core/lib/browser/json-schema-store';
48
- import { WorkspaceSchemaUpdater } from './workspace-schema-updater';
49
- import { WorkspaceBreadcrumbsContribution } from './workspace-breadcrumbs-contribution';
50
- import { FilepathBreadcrumbsContribution } from '@theia/filesystem/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution';
51
- import { WorkspaceTrustService } from './workspace-trust-service';
52
- import { bindWorkspaceTrustPreferences } from './workspace-trust-preferences';
53
- import { UserWorkingDirectoryProvider } from '@theia/core/lib/browser/user-working-directory-provider';
54
- import { WorkspaceUserWorkingDirectoryProvider } from './workspace-user-working-directory-provider';
55
- import { WindowTitleUpdater } from '@theia/core/lib/browser/window/window-title-updater';
56
- import { WorkspaceWindowTitleUpdater } from './workspace-window-title-updater';
57
- import { CanonicalUriService } from './canonical-uri-service';
58
-
59
- export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {
60
- bindWorkspacePreferences(bind);
61
- bindWorkspaceTrustPreferences(bind);
62
-
63
- bind(WorkspaceService).toSelf().inSingletonScope();
64
- bind(FrontendApplicationContribution).toService(WorkspaceService);
65
- bind(CanonicalUriService).toSelf().inSingletonScope();
66
- bind(WorkspaceServer).toDynamicValue(ctx => {
67
- const provider = ctx.container.get(WebSocketConnectionProvider);
68
- return provider.createProxy<WorkspaceServer>(workspacePath);
69
- }).inSingletonScope();
70
-
71
- bind(WorkspaceFrontendContribution).toSelf().inSingletonScope();
72
- for (const identifier of [FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution]) {
73
- bind(identifier).toService(WorkspaceFrontendContribution);
74
- }
75
-
76
- bind(OpenFileDialogFactory).toFactory(ctx =>
77
- (props: OpenFileDialogProps) =>
78
- createOpenFileDialogContainer(ctx.container, props).get(OpenFileDialog)
79
- );
80
-
81
- bind(SaveFileDialogFactory).toFactory(ctx =>
82
- (props: SaveFileDialogProps) =>
83
- createSaveFileDialogContainer(ctx.container, props).get(SaveFileDialog)
84
- );
85
-
86
- bind(WorkspaceCommandContribution).toSelf().inSingletonScope();
87
- bind(CommandContribution).toService(WorkspaceCommandContribution);
88
- bind(FileMenuContribution).toSelf().inSingletonScope();
89
- bind(MenuContribution).toService(FileMenuContribution);
90
- bind(EditMenuContribution).toSelf().inSingletonScope();
91
- bind(MenuContribution).toService(EditMenuContribution);
92
- bind(WorkspaceDeleteHandler).toSelf().inSingletonScope();
93
- bind(WorkspaceDuplicateHandler).toSelf().inSingletonScope();
94
- bind(WorkspaceCompareHandler).toSelf().inSingletonScope();
95
- bind(DiffService).toSelf().inSingletonScope();
96
-
97
- bind(WorkspaceStorageService).toSelf().inSingletonScope();
98
- rebind(StorageService).toService(WorkspaceStorageService);
99
-
100
- bind(LabelProviderContribution).to(WorkspaceUriLabelProviderContribution).inSingletonScope();
101
- bind(WorkspaceVariableContribution).toSelf().inSingletonScope();
102
- bind(VariableContribution).toService(WorkspaceVariableContribution);
103
-
104
- bind(QuickOpenWorkspace).toSelf().inSingletonScope();
105
-
106
- bind(WorkspaceUtils).toSelf().inSingletonScope();
107
- bind(WorkspaceFileService).toSelf().inSingletonScope();
108
- bind(UntitledWorkspaceService).toSelf().inSingletonScope();
109
-
110
- bind(WorkspaceSchemaUpdater).toSelf().inSingletonScope();
111
- bind(JsonSchemaContribution).toService(WorkspaceSchemaUpdater);
112
- rebind(FilepathBreadcrumbsContribution).to(WorkspaceBreadcrumbsContribution).inSingletonScope();
113
-
114
- bind(WorkspaceTrustService).toSelf().inSingletonScope();
115
- rebind(UserWorkingDirectoryProvider).to(WorkspaceUserWorkingDirectoryProvider).inSingletonScope();
116
-
117
- rebind(WindowTitleUpdater).to(WorkspaceWindowTitleUpdater).inSingletonScope();
118
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 TypeFox 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 { ContainerModule, interfaces } from '@theia/core/shared/inversify';
18
+ import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
19
+ import { WebSocketConnectionProvider, FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser';
20
+ import {
21
+ OpenFileDialogFactory,
22
+ SaveFileDialogFactory,
23
+ OpenFileDialogProps,
24
+ SaveFileDialogProps,
25
+ createOpenFileDialogContainer,
26
+ createSaveFileDialogContainer,
27
+ OpenFileDialog,
28
+ SaveFileDialog,
29
+ } from '@theia/filesystem/lib/browser';
30
+ import { StorageService } from '@theia/core/lib/browser/storage-service';
31
+ import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
32
+ import { VariableContribution } from '@theia/variable-resolver/lib/browser';
33
+ import { WorkspaceServer, workspacePath, UntitledWorkspaceService, WorkspaceFileService } from '../common';
34
+ import { WorkspaceFrontendContribution } from './workspace-frontend-contribution';
35
+ import { WorkspaceService } from './workspace-service';
36
+ import { WorkspaceCommandContribution, FileMenuContribution, EditMenuContribution } from './workspace-commands';
37
+ import { WorkspaceVariableContribution } from './workspace-variable-contribution';
38
+ import { WorkspaceStorageService } from './workspace-storage-service';
39
+ import { WorkspaceUriLabelProviderContribution } from './workspace-uri-contribution';
40
+ import { bindWorkspacePreferences } from './workspace-preferences';
41
+ import { QuickOpenWorkspace } from './quick-open-workspace';
42
+ import { WorkspaceDeleteHandler } from './workspace-delete-handler';
43
+ import { WorkspaceDuplicateHandler } from './workspace-duplicate-handler';
44
+ import { WorkspaceUtils } from './workspace-utils';
45
+ import { WorkspaceCompareHandler } from './workspace-compare-handler';
46
+ import { DiffService } from './diff-service';
47
+ import { JsonSchemaContribution } from '@theia/core/lib/browser/json-schema-store';
48
+ import { WorkspaceSchemaUpdater } from './workspace-schema-updater';
49
+ import { WorkspaceBreadcrumbsContribution } from './workspace-breadcrumbs-contribution';
50
+ import { FilepathBreadcrumbsContribution } from '@theia/filesystem/lib/browser/breadcrumbs/filepath-breadcrumbs-contribution';
51
+ import { WorkspaceTrustService } from './workspace-trust-service';
52
+ import { bindWorkspaceTrustPreferences } from './workspace-trust-preferences';
53
+ import { UserWorkingDirectoryProvider } from '@theia/core/lib/browser/user-working-directory-provider';
54
+ import { WorkspaceUserWorkingDirectoryProvider } from './workspace-user-working-directory-provider';
55
+ import { WindowTitleUpdater } from '@theia/core/lib/browser/window/window-title-updater';
56
+ import { WorkspaceWindowTitleUpdater } from './workspace-window-title-updater';
57
+ import { CanonicalUriService } from './canonical-uri-service';
58
+
59
+ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {
60
+ bindWorkspacePreferences(bind);
61
+ bindWorkspaceTrustPreferences(bind);
62
+
63
+ bind(WorkspaceService).toSelf().inSingletonScope();
64
+ bind(FrontendApplicationContribution).toService(WorkspaceService);
65
+ bind(CanonicalUriService).toSelf().inSingletonScope();
66
+ bind(WorkspaceServer).toDynamicValue(ctx => {
67
+ const provider = ctx.container.get(WebSocketConnectionProvider);
68
+ return provider.createProxy<WorkspaceServer>(workspacePath);
69
+ }).inSingletonScope();
70
+
71
+ bind(WorkspaceFrontendContribution).toSelf().inSingletonScope();
72
+ for (const identifier of [FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution]) {
73
+ bind(identifier).toService(WorkspaceFrontendContribution);
74
+ }
75
+
76
+ bind(OpenFileDialogFactory).toFactory(ctx =>
77
+ (props: OpenFileDialogProps) =>
78
+ createOpenFileDialogContainer(ctx.container, props).get(OpenFileDialog)
79
+ );
80
+
81
+ bind(SaveFileDialogFactory).toFactory(ctx =>
82
+ (props: SaveFileDialogProps) =>
83
+ createSaveFileDialogContainer(ctx.container, props).get(SaveFileDialog)
84
+ );
85
+
86
+ bind(WorkspaceCommandContribution).toSelf().inSingletonScope();
87
+ bind(CommandContribution).toService(WorkspaceCommandContribution);
88
+ bind(FileMenuContribution).toSelf().inSingletonScope();
89
+ bind(MenuContribution).toService(FileMenuContribution);
90
+ bind(EditMenuContribution).toSelf().inSingletonScope();
91
+ bind(MenuContribution).toService(EditMenuContribution);
92
+ bind(WorkspaceDeleteHandler).toSelf().inSingletonScope();
93
+ bind(WorkspaceDuplicateHandler).toSelf().inSingletonScope();
94
+ bind(WorkspaceCompareHandler).toSelf().inSingletonScope();
95
+ bind(DiffService).toSelf().inSingletonScope();
96
+
97
+ bind(WorkspaceStorageService).toSelf().inSingletonScope();
98
+ rebind(StorageService).toService(WorkspaceStorageService);
99
+
100
+ bind(LabelProviderContribution).to(WorkspaceUriLabelProviderContribution).inSingletonScope();
101
+ bind(WorkspaceVariableContribution).toSelf().inSingletonScope();
102
+ bind(VariableContribution).toService(WorkspaceVariableContribution);
103
+
104
+ bind(QuickOpenWorkspace).toSelf().inSingletonScope();
105
+
106
+ bind(WorkspaceUtils).toSelf().inSingletonScope();
107
+ bind(WorkspaceFileService).toSelf().inSingletonScope();
108
+ bind(UntitledWorkspaceService).toSelf().inSingletonScope();
109
+
110
+ bind(WorkspaceSchemaUpdater).toSelf().inSingletonScope();
111
+ bind(JsonSchemaContribution).toService(WorkspaceSchemaUpdater);
112
+ rebind(FilepathBreadcrumbsContribution).to(WorkspaceBreadcrumbsContribution).inSingletonScope();
113
+
114
+ bind(WorkspaceTrustService).toSelf().inSingletonScope();
115
+ rebind(UserWorkingDirectoryProvider).to(WorkspaceUserWorkingDirectoryProvider).inSingletonScope();
116
+
117
+ rebind(WindowTitleUpdater).to(WorkspaceWindowTitleUpdater).inSingletonScope();
118
+ });
@@ -1,61 +1,61 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import URI from '@theia/core/lib/common/uri';
19
- import { SingleTextInputDialog, SingleTextInputDialogProps, LabelProvider, codiconArray } from '@theia/core/lib/browser';
20
-
21
- @injectable()
22
- export class WorkspaceInputDialogProps extends SingleTextInputDialogProps {
23
- /**
24
- * The parent `URI` for the selection present in the explorer.
25
- * Used to display the path in which the file/folder is created at.
26
- */
27
- parentUri: URI;
28
- }
29
-
30
- export class WorkspaceInputDialog extends SingleTextInputDialog {
31
-
32
- constructor(
33
- @inject(WorkspaceInputDialogProps) protected override readonly props: WorkspaceInputDialogProps,
34
- @inject(LabelProvider) protected readonly labelProvider: LabelProvider,
35
- ) {
36
- super(props);
37
- this.appendParentPath();
38
- }
39
-
40
- /**
41
- * Append the human-readable parent `path` to the dialog.
42
- * When possible, display the relative path, else display the full path (ex: workspace root).
43
- */
44
- protected appendParentPath(): void {
45
- // Compute the label for the parent URI.
46
- const label = this.labelProvider.getLongName(this.props.parentUri);
47
- const element = document.createElement('div');
48
- // Create the `folder` icon.
49
- const icon = document.createElement('i');
50
- icon.classList.add(...codiconArray('folder'));
51
- icon.style.marginRight = '0.5em';
52
- icon.style.verticalAlign = 'middle';
53
- element.style.verticalAlign = 'middle';
54
- element.style.paddingBottom = '1em';
55
- element.title = this.props.parentUri.path.fsPath();
56
- element.appendChild(icon);
57
- element.appendChild(document.createTextNode(label));
58
- // Add the path and icon div before the `inputField`.
59
- this.contentNode.insertBefore(element, this.inputField);
60
- }
61
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import URI from '@theia/core/lib/common/uri';
19
+ import { SingleTextInputDialog, SingleTextInputDialogProps, LabelProvider, codiconArray } from '@theia/core/lib/browser';
20
+
21
+ @injectable()
22
+ export class WorkspaceInputDialogProps extends SingleTextInputDialogProps {
23
+ /**
24
+ * The parent `URI` for the selection present in the explorer.
25
+ * Used to display the path in which the file/folder is created at.
26
+ */
27
+ parentUri: URI;
28
+ }
29
+
30
+ export class WorkspaceInputDialog extends SingleTextInputDialog {
31
+
32
+ constructor(
33
+ @inject(WorkspaceInputDialogProps) protected override readonly props: WorkspaceInputDialogProps,
34
+ @inject(LabelProvider) protected readonly labelProvider: LabelProvider,
35
+ ) {
36
+ super(props);
37
+ this.appendParentPath();
38
+ }
39
+
40
+ /**
41
+ * Append the human-readable parent `path` to the dialog.
42
+ * When possible, display the relative path, else display the full path (ex: workspace root).
43
+ */
44
+ protected appendParentPath(): void {
45
+ // Compute the label for the parent URI.
46
+ const label = this.labelProvider.getLongName(this.props.parentUri);
47
+ const element = document.createElement('div');
48
+ // Create the `folder` icon.
49
+ const icon = document.createElement('i');
50
+ icon.classList.add(...codiconArray('folder'));
51
+ icon.style.marginRight = '0.5em';
52
+ icon.style.verticalAlign = 'middle';
53
+ element.style.verticalAlign = 'middle';
54
+ element.style.paddingBottom = '1em';
55
+ element.title = this.props.parentUri.path.fsPath();
56
+ element.appendChild(icon);
57
+ element.appendChild(document.createTextNode(label));
58
+ // Add the path and icon div before the `inputField`.
59
+ this.contentNode.insertBefore(element, this.inputField);
60
+ }
61
+ }
@@ -1,58 +1,58 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { interfaces } from '@theia/core/shared/inversify';
18
- import {
19
- createPreferenceProxy,
20
- PreferenceProxy,
21
- PreferenceService,
22
- PreferenceSchema,
23
- PreferenceContribution
24
- } from '@theia/core/lib/browser/preferences';
25
- import { nls } from '@theia/core/lib/common/nls';
26
-
27
- export const workspacePreferenceSchema: PreferenceSchema = {
28
- type: 'object',
29
- properties: {
30
- 'workspace.preserveWindow': {
31
- description: nls.localize('theia/workspace/preserveWindow', 'Enable opening workspaces in current window.'),
32
- type: 'boolean',
33
- default: false
34
- },
35
- }
36
- };
37
-
38
- export interface WorkspaceConfiguration {
39
- 'workspace.preserveWindow': boolean,
40
- }
41
-
42
- export const WorkspacePreferenceContribution = Symbol('WorkspacePreferenceContribution');
43
- export const WorkspacePreferences = Symbol('WorkspacePreferences');
44
- export type WorkspacePreferences = PreferenceProxy<WorkspaceConfiguration>;
45
-
46
- export function createWorkspacePreferences(preferences: PreferenceService, schema: PreferenceSchema = workspacePreferenceSchema): WorkspacePreferences {
47
- return createPreferenceProxy(preferences, schema);
48
- }
49
-
50
- export function bindWorkspacePreferences(bind: interfaces.Bind): void {
51
- bind(WorkspacePreferences).toDynamicValue(ctx => {
52
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
- const contribution = ctx.container.get<PreferenceContribution>(WorkspacePreferenceContribution);
54
- return createWorkspacePreferences(preferences, contribution.schema);
55
- }).inSingletonScope();
56
- bind(WorkspacePreferenceContribution).toConstantValue({ schema: workspacePreferenceSchema });
57
- bind(PreferenceContribution).toService(WorkspacePreferenceContribution);
58
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { interfaces } from '@theia/core/shared/inversify';
18
+ import {
19
+ createPreferenceProxy,
20
+ PreferenceProxy,
21
+ PreferenceService,
22
+ PreferenceSchema,
23
+ PreferenceContribution
24
+ } from '@theia/core/lib/browser/preferences';
25
+ import { nls } from '@theia/core/lib/common/nls';
26
+
27
+ export const workspacePreferenceSchema: PreferenceSchema = {
28
+ type: 'object',
29
+ properties: {
30
+ 'workspace.preserveWindow': {
31
+ description: nls.localize('theia/workspace/preserveWindow', 'Enable opening workspaces in current window.'),
32
+ type: 'boolean',
33
+ default: false
34
+ },
35
+ }
36
+ };
37
+
38
+ export interface WorkspaceConfiguration {
39
+ 'workspace.preserveWindow': boolean,
40
+ }
41
+
42
+ export const WorkspacePreferenceContribution = Symbol('WorkspacePreferenceContribution');
43
+ export const WorkspacePreferences = Symbol('WorkspacePreferences');
44
+ export type WorkspacePreferences = PreferenceProxy<WorkspaceConfiguration>;
45
+
46
+ export function createWorkspacePreferences(preferences: PreferenceService, schema: PreferenceSchema = workspacePreferenceSchema): WorkspacePreferences {
47
+ return createPreferenceProxy(preferences, schema);
48
+ }
49
+
50
+ export function bindWorkspacePreferences(bind: interfaces.Bind): void {
51
+ bind(WorkspacePreferences).toDynamicValue(ctx => {
52
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
53
+ const contribution = ctx.container.get<PreferenceContribution>(WorkspacePreferenceContribution);
54
+ return createWorkspacePreferences(preferences, contribution.schema);
55
+ }).inSingletonScope();
56
+ bind(WorkspacePreferenceContribution).toConstantValue({ schema: workspacePreferenceSchema });
57
+ bind(PreferenceContribution).toService(WorkspacePreferenceContribution);
58
+ }