@theia/getting-started 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.
@@ -1,69 +1,69 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 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 { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
26
- import { nls } from '@theia/core/lib/common/nls';
27
-
28
- export const GettingStartedPreferenceSchema: PreferenceSchema = {
29
- 'type': 'object',
30
- properties: {
31
- 'workbench.startupEditor': {
32
- type: 'string',
33
- enum: ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench'],
34
- enumDescriptions: [
35
- nls.localizeByDefault('Start without an editor.'),
36
- nls.localize('theia/getting-started/startup-editor/welcomePage', 'Open the Welcome page, with content to aid in getting started with {0} and extensions.',
37
- FrontendApplicationConfigProvider.get().applicationName),
38
- // eslint-disable-next-line max-len
39
- nls.localizeByDefault("Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise. Note: This is only observed as a global configuration, it will be ignored if set in a workspace or folder configuration."),
40
- nls.localizeByDefault('Open a new untitled text file (only applies when opening an empty window).'),
41
- nls.localizeByDefault('Open the Welcome page when opening an empty workbench.'),
42
- ],
43
- default: 'welcomePage',
44
- description: nls.localizeByDefault('Controls which editor is shown at startup, if none are restored from the previous session.')
45
- },
46
- }
47
- };
48
-
49
- export interface GettingStartedConfiguration {
50
- 'workbench.startupEditor': string;
51
- }
52
-
53
- export const GettingStartedPreferenceContribution = Symbol('GettingStartedPreferenceContribution');
54
- export const GettingStartedPreferences = Symbol('GettingStartedPreferences');
55
- export type GettingStartedPreferences = PreferenceProxy<GettingStartedConfiguration>;
56
-
57
- export function createGettingStartedPreferences(preferences: PreferenceService, schema: PreferenceSchema = GettingStartedPreferenceSchema): GettingStartedPreferences {
58
- return createPreferenceProxy(preferences, schema);
59
- }
60
-
61
- export function bindGettingStartedPreferences(bind: interfaces.Bind): void {
62
- bind(GettingStartedPreferences).toDynamicValue(ctx => {
63
- const preferences = ctx.container.get<PreferenceService>(PreferenceService);
64
- const contribution = ctx.container.get<PreferenceContribution>(GettingStartedPreferenceContribution);
65
- return createGettingStartedPreferences(preferences, contribution.schema);
66
- }).inSingletonScope();
67
- bind(GettingStartedPreferenceContribution).toConstantValue({ schema: GettingStartedPreferenceSchema });
68
- bind(PreferenceContribution).toService(GettingStartedPreferenceContribution);
69
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 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 { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
26
+ import { nls } from '@theia/core/lib/common/nls';
27
+
28
+ export const GettingStartedPreferenceSchema: PreferenceSchema = {
29
+ 'type': 'object',
30
+ properties: {
31
+ 'workbench.startupEditor': {
32
+ type: 'string',
33
+ enum: ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench'],
34
+ enumDescriptions: [
35
+ nls.localizeByDefault('Start without an editor.'),
36
+ nls.localize('theia/getting-started/startup-editor/welcomePage', 'Open the Welcome page, with content to aid in getting started with {0} and extensions.',
37
+ FrontendApplicationConfigProvider.get().applicationName),
38
+ // eslint-disable-next-line max-len
39
+ nls.localizeByDefault("Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise. Note: This is only observed as a global configuration, it will be ignored if set in a workspace or folder configuration."),
40
+ nls.localizeByDefault('Open a new untitled text file (only applies when opening an empty window).'),
41
+ nls.localizeByDefault('Open the Welcome page when opening an empty workbench.'),
42
+ ],
43
+ default: 'welcomePage',
44
+ description: nls.localizeByDefault('Controls which editor is shown at startup, if none are restored from the previous session.')
45
+ },
46
+ }
47
+ };
48
+
49
+ export interface GettingStartedConfiguration {
50
+ 'workbench.startupEditor': string;
51
+ }
52
+
53
+ export const GettingStartedPreferenceContribution = Symbol('GettingStartedPreferenceContribution');
54
+ export const GettingStartedPreferences = Symbol('GettingStartedPreferences');
55
+ export type GettingStartedPreferences = PreferenceProxy<GettingStartedConfiguration>;
56
+
57
+ export function createGettingStartedPreferences(preferences: PreferenceService, schema: PreferenceSchema = GettingStartedPreferenceSchema): GettingStartedPreferences {
58
+ return createPreferenceProxy(preferences, schema);
59
+ }
60
+
61
+ export function bindGettingStartedPreferences(bind: interfaces.Bind): void {
62
+ bind(GettingStartedPreferences).toDynamicValue(ctx => {
63
+ const preferences = ctx.container.get<PreferenceService>(PreferenceService);
64
+ const contribution = ctx.container.get<PreferenceContribution>(GettingStartedPreferenceContribution);
65
+ return createGettingStartedPreferences(preferences, contribution.schema);
66
+ }).inSingletonScope();
67
+ bind(GettingStartedPreferenceContribution).toConstantValue({ schema: GettingStartedPreferenceSchema });
68
+ bind(PreferenceContribution).toService(GettingStartedPreferenceContribution);
69
+ }