@theia/getting-started 1.45.1 → 1.46.0-next.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -37
- package/lib/browser/getting-started-contribution.d.ts +29 -29
- package/lib/browser/getting-started-contribution.js +143 -143
- package/lib/browser/getting-started-frontend-module.d.ts +4 -4
- package/lib/browser/getting-started-frontend-module.js +33 -33
- package/lib/browser/getting-started-preferences.d.ts +11 -11
- package/lib/browser/getting-started-preferences.js +56 -56
- package/lib/browser/getting-started-widget.d.ts +156 -156
- package/lib/browser/getting-started-widget.js +380 -380
- package/lib/package.spec.js +25 -25
- package/package.json +9 -9
- package/src/browser/getting-started-contribution.ts +126 -126
- package/src/browser/getting-started-frontend-module.ts +33 -33
- package/src/browser/getting-started-preferences.ts +69 -69
- package/src/browser/getting-started-widget.tsx +529 -529
- package/src/browser/style/index.css +109 -109
- package/src/package.spec.ts +28 -28
|
@@ -1,381 +1,381 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Ericsson 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 GettingStartedWidget_1;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.GettingStartedWidget = void 0;
|
|
29
|
-
const React = require("@theia/core/shared/react");
|
|
30
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const common_1 = require("@theia/core/lib/common");
|
|
33
|
-
const browser_1 = require("@theia/workspace/lib/browser");
|
|
34
|
-
const browser_2 = require("@theia/keymaps/lib/browser");
|
|
35
|
-
const browser_3 = require("@theia/core/lib/browser");
|
|
36
|
-
const application_protocol_1 = require("@theia/core/lib/common/application-protocol");
|
|
37
|
-
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
38
|
-
const env_variables_1 = require("@theia/core/lib/common/env-variables");
|
|
39
|
-
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
40
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
41
|
-
/**
|
|
42
|
-
* Default implementation of the `GettingStartedWidget`.
|
|
43
|
-
* The widget is displayed when there are currently no workspaces present.
|
|
44
|
-
* Some of the features displayed include:
|
|
45
|
-
* - `open` commands.
|
|
46
|
-
* - `recently used workspaces`.
|
|
47
|
-
* - `settings` commands.
|
|
48
|
-
* - `help` commands.
|
|
49
|
-
* - helpful links.
|
|
50
|
-
*/
|
|
51
|
-
let GettingStartedWidget = GettingStartedWidget_1 = class GettingStartedWidget extends browser_3.ReactWidget {
|
|
52
|
-
constructor() {
|
|
53
|
-
super(...arguments);
|
|
54
|
-
/**
|
|
55
|
-
* The application name which is used for display purposes.
|
|
56
|
-
*/
|
|
57
|
-
this.applicationName = frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().applicationName;
|
|
58
|
-
/**
|
|
59
|
-
* The recently used workspaces limit.
|
|
60
|
-
* Used in order to limit the number of recently used workspaces to display.
|
|
61
|
-
*/
|
|
62
|
-
this.recentLimit = 5;
|
|
63
|
-
/**
|
|
64
|
-
* The list of recently used workspaces.
|
|
65
|
-
*/
|
|
66
|
-
this.recentWorkspaces = [];
|
|
67
|
-
/**
|
|
68
|
-
* Collection of useful links to display for end users.
|
|
69
|
-
*/
|
|
70
|
-
this.documentationUrl = 'https://www.theia-ide.org/docs/';
|
|
71
|
-
this.compatibilityUrl = 'https://eclipse-theia.github.io/vscode-theia-comparator/status.html';
|
|
72
|
-
this.extensionUrl = 'https://www.theia-ide.org/docs/authoring_extensions';
|
|
73
|
-
this.pluginUrl = 'https://www.theia-ide.org/docs/authoring_plugins';
|
|
74
|
-
/**
|
|
75
|
-
* Trigger the open command.
|
|
76
|
-
*/
|
|
77
|
-
this.doOpen = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN.id);
|
|
78
|
-
this.doOpenEnter = (e) => {
|
|
79
|
-
if (this.isEnterKey(e)) {
|
|
80
|
-
this.doOpen();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Trigger the open file command.
|
|
85
|
-
*/
|
|
86
|
-
this.doOpenFile = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_FILE.id);
|
|
87
|
-
this.doOpenFileEnter = (e) => {
|
|
88
|
-
if (this.isEnterKey(e)) {
|
|
89
|
-
this.doOpenFile();
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Trigger the open folder command.
|
|
94
|
-
*/
|
|
95
|
-
this.doOpenFolder = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_FOLDER.id);
|
|
96
|
-
this.doOpenFolderEnter = (e) => {
|
|
97
|
-
if (this.isEnterKey(e)) {
|
|
98
|
-
this.doOpenFolder();
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Trigger the open workspace command.
|
|
103
|
-
*/
|
|
104
|
-
this.doOpenWorkspace = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_WORKSPACE.id);
|
|
105
|
-
this.doOpenWorkspaceEnter = (e) => {
|
|
106
|
-
if (this.isEnterKey(e)) {
|
|
107
|
-
this.doOpenWorkspace();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Trigger the open recent workspace command.
|
|
112
|
-
*/
|
|
113
|
-
this.doOpenRecentWorkspace = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_RECENT_WORKSPACE.id);
|
|
114
|
-
this.doOpenRecentWorkspaceEnter = (e) => {
|
|
115
|
-
if (this.isEnterKey(e)) {
|
|
116
|
-
this.doOpenRecentWorkspace();
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Trigger the open preferences command.
|
|
121
|
-
* Used to open the preferences widget.
|
|
122
|
-
*/
|
|
123
|
-
this.doOpenPreferences = () => this.commandRegistry.executeCommand(browser_3.CommonCommands.OPEN_PREFERENCES.id);
|
|
124
|
-
this.doOpenPreferencesEnter = (e) => {
|
|
125
|
-
if (this.isEnterKey(e)) {
|
|
126
|
-
this.doOpenPreferences();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Trigger the open keyboard shortcuts command.
|
|
131
|
-
* Used to open the keyboard shortcuts widget.
|
|
132
|
-
*/
|
|
133
|
-
this.doOpenKeyboardShortcuts = () => this.commandRegistry.executeCommand(browser_2.KeymapsCommands.OPEN_KEYMAPS.id);
|
|
134
|
-
this.doOpenKeyboardShortcutsEnter = (e) => {
|
|
135
|
-
if (this.isEnterKey(e)) {
|
|
136
|
-
this.doOpenKeyboardShortcuts();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Open a workspace given its uri.
|
|
141
|
-
* @param uri {URI} the workspace uri.
|
|
142
|
-
*/
|
|
143
|
-
this.open = (uri) => this.workspaceService.open(uri);
|
|
144
|
-
this.openEnter = (e, uri) => {
|
|
145
|
-
if (this.isEnterKey(e)) {
|
|
146
|
-
this.open(uri);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Open a link in an external window.
|
|
151
|
-
* @param url the link.
|
|
152
|
-
*/
|
|
153
|
-
this.doOpenExternalLink = (url) => this.windowService.openNewWindow(url, { external: true });
|
|
154
|
-
this.doOpenExternalLinkEnter = (e, url) => {
|
|
155
|
-
if (this.isEnterKey(e)) {
|
|
156
|
-
this.doOpenExternalLink(url);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
init() {
|
|
161
|
-
this.doInit();
|
|
162
|
-
}
|
|
163
|
-
async doInit() {
|
|
164
|
-
this.id = GettingStartedWidget_1.ID;
|
|
165
|
-
this.title.label = GettingStartedWidget_1.LABEL;
|
|
166
|
-
this.title.caption = GettingStartedWidget_1.LABEL;
|
|
167
|
-
this.title.closable = true;
|
|
168
|
-
this.applicationInfo = await this.appServer.getApplicationInfo();
|
|
169
|
-
this.recentWorkspaces = await this.workspaceService.recentWorkspaces();
|
|
170
|
-
this.home = new uri_1.default(await this.environments.getHomeDirUri()).path.toString();
|
|
171
|
-
this.update();
|
|
172
|
-
}
|
|
173
|
-
onActivateRequest(msg) {
|
|
174
|
-
super.onActivateRequest(msg);
|
|
175
|
-
const elArr = this.node.getElementsByTagName('a');
|
|
176
|
-
if (elArr && elArr.length > 0) {
|
|
177
|
-
elArr[0].focus();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Render the content of the widget.
|
|
182
|
-
*/
|
|
183
|
-
render() {
|
|
184
|
-
return React.createElement("div", { className: 'gs-container' },
|
|
185
|
-
React.createElement("div", { className: 'gs-content-container' },
|
|
186
|
-
this.renderHeader(),
|
|
187
|
-
React.createElement("hr", { className: 'gs-hr' }),
|
|
188
|
-
React.createElement("div", { className: 'flex-grid' },
|
|
189
|
-
React.createElement("div", { className: 'col' }, this.renderOpen())),
|
|
190
|
-
React.createElement("div", { className: 'flex-grid' },
|
|
191
|
-
React.createElement("div", { className: 'col' }, this.renderRecentWorkspaces())),
|
|
192
|
-
React.createElement("div", { className: 'flex-grid' },
|
|
193
|
-
React.createElement("div", { className: 'col' }, this.renderSettings())),
|
|
194
|
-
React.createElement("div", { className: 'flex-grid' },
|
|
195
|
-
React.createElement("div", { className: 'col' }, this.renderHelp())),
|
|
196
|
-
React.createElement("div", { className: 'flex-grid' },
|
|
197
|
-
React.createElement("div", { className: 'col' }, this.renderVersion()))),
|
|
198
|
-
React.createElement("div", { className: 'gs-preference-container' }, this.renderPreferences()));
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Render the widget header.
|
|
202
|
-
* Renders the title `{applicationName} Getting Started`.
|
|
203
|
-
*/
|
|
204
|
-
renderHeader() {
|
|
205
|
-
return React.createElement("div", { className: 'gs-header' },
|
|
206
|
-
React.createElement("h1", null,
|
|
207
|
-
this.applicationName,
|
|
208
|
-
React.createElement("span", { className: 'gs-sub-header' }, ' ' + GettingStartedWidget_1.LABEL)));
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Render the `open` section.
|
|
212
|
-
* Displays a collection of `open` commands.
|
|
213
|
-
*/
|
|
214
|
-
renderOpen() {
|
|
215
|
-
const requireSingleOpen = common_1.isOSX || !common_1.environment.electron.is();
|
|
216
|
-
const open = requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
217
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpen, onKeyDown: this.doOpenEnter }, nls_1.nls.localizeByDefault('Open')));
|
|
218
|
-
const openFile = !requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
219
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFile, onKeyDown: this.doOpenFileEnter }, nls_1.nls.localizeByDefault('Open File')));
|
|
220
|
-
const openFolder = !requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
221
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFolder, onKeyDown: this.doOpenFolderEnter }, nls_1.nls.localizeByDefault('Open Folder')));
|
|
222
|
-
const openWorkspace = (React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenWorkspace, onKeyDown: this.doOpenWorkspaceEnter }, nls_1.nls.localizeByDefault('Open Workspace')));
|
|
223
|
-
return React.createElement("div", { className: 'gs-section' },
|
|
224
|
-
React.createElement("h3", { className: 'gs-section-header' },
|
|
225
|
-
React.createElement("i", { className: (0, browser_3.codicon)('folder-opened') }),
|
|
226
|
-
nls_1.nls.localizeByDefault('Open')),
|
|
227
|
-
open,
|
|
228
|
-
openFile,
|
|
229
|
-
openFolder,
|
|
230
|
-
openWorkspace);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Render the recently used workspaces section.
|
|
234
|
-
*/
|
|
235
|
-
renderRecentWorkspaces() {
|
|
236
|
-
const items = this.recentWorkspaces;
|
|
237
|
-
const paths = this.buildPaths(items);
|
|
238
|
-
const content = paths.slice(0, this.recentLimit).map((item, index) => React.createElement("div", { className: 'gs-action-container', key: index },
|
|
239
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.open(new uri_1.default(items[index])), onKeyDown: (e) => this.openEnter(e, new uri_1.default(items[index])) }, new uri_1.default(items[index]).path.base),
|
|
240
|
-
React.createElement("span", { className: 'gs-action-details' }, item)));
|
|
241
|
-
// If the recently used workspaces list exceeds the limit, display `More...` which triggers the recently used workspaces quick-open menu upon selection.
|
|
242
|
-
const more = paths.length > this.recentLimit && React.createElement("div", { className: 'gs-action-container' },
|
|
243
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenRecentWorkspace, onKeyDown: this.doOpenRecentWorkspaceEnter }, nls_1.nls.localizeByDefault('More...')));
|
|
244
|
-
return React.createElement("div", { className: 'gs-section' },
|
|
245
|
-
React.createElement("h3", { className: 'gs-section-header' },
|
|
246
|
-
React.createElement("i", { className: (0, browser_3.codicon)('history') }),
|
|
247
|
-
nls_1.nls.localizeByDefault('Recent')),
|
|
248
|
-
items.length > 0 ? content : React.createElement("p", { className: 'gs-no-recent' },
|
|
249
|
-
nls_1.nls.localizeByDefault('You have no recent folders,') + ' ',
|
|
250
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFolder, onKeyDown: this.doOpenFolderEnter }, nls_1.nls.localizeByDefault('open a folder')),
|
|
251
|
-
' ' + nls_1.nls.localizeByDefault('to start.')),
|
|
252
|
-
more);
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Render the settings section.
|
|
256
|
-
* Generally used to display useful links.
|
|
257
|
-
*/
|
|
258
|
-
renderSettings() {
|
|
259
|
-
return React.createElement("div", { className: 'gs-section' },
|
|
260
|
-
React.createElement("h3", { className: 'gs-section-header' },
|
|
261
|
-
React.createElement("i", { className: (0, browser_3.codicon)('settings-gear') }),
|
|
262
|
-
nls_1.nls.localizeByDefault('Settings')),
|
|
263
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
264
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenPreferences, onKeyDown: this.doOpenPreferencesEnter }, nls_1.nls.localizeByDefault('Open Settings'))),
|
|
265
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
266
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenKeyboardShortcuts, onKeyDown: this.doOpenKeyboardShortcutsEnter }, nls_1.nls.localizeByDefault('Open Keyboard Shortcuts'))));
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Render the help section.
|
|
270
|
-
*/
|
|
271
|
-
renderHelp() {
|
|
272
|
-
return React.createElement("div", { className: 'gs-section' },
|
|
273
|
-
React.createElement("h3", { className: 'gs-section-header' },
|
|
274
|
-
React.createElement("i", { className: (0, browser_3.codicon)('question') }),
|
|
275
|
-
nls_1.nls.localizeByDefault('Help')),
|
|
276
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
277
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.documentationUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.documentationUrl) }, nls_1.nls.localizeByDefault('Documentation'))),
|
|
278
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
279
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.compatibilityUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.compatibilityUrl) }, nls_1.nls.localize('theia/getting-started/apiComparator', '{0} API Compatibility', 'VS Code'))),
|
|
280
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
281
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.extensionUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.extensionUrl) }, nls_1.nls.localize('theia/getting-started/newExtension', 'Building a New Extension'))),
|
|
282
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
283
|
-
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.pluginUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.pluginUrl) }, nls_1.nls.localize('theia/getting-started/newPlugin', 'Building a New Plugin'))));
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Render the version section.
|
|
287
|
-
*/
|
|
288
|
-
renderVersion() {
|
|
289
|
-
return React.createElement("div", { className: 'gs-section' },
|
|
290
|
-
React.createElement("div", { className: 'gs-action-container' },
|
|
291
|
-
React.createElement("p", { className: 'gs-sub-header' }, this.applicationInfo ? nls_1.nls.localizeByDefault('Version: {0}', this.applicationInfo.version) : '')));
|
|
292
|
-
}
|
|
293
|
-
renderPreferences() {
|
|
294
|
-
return React.createElement(WelcomePreferences, { preferenceService: this.preferenceService });
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Build the list of workspace paths.
|
|
298
|
-
* @param workspaces {string[]} the list of workspaces.
|
|
299
|
-
* @returns {string[]} the list of workspace paths.
|
|
300
|
-
*/
|
|
301
|
-
buildPaths(workspaces) {
|
|
302
|
-
const paths = [];
|
|
303
|
-
workspaces.forEach(workspace => {
|
|
304
|
-
const uri = new uri_1.default(workspace);
|
|
305
|
-
const pathLabel = this.labelProvider.getLongName(uri);
|
|
306
|
-
const path = this.home ? common_1.Path.tildify(pathLabel, this.home) : pathLabel;
|
|
307
|
-
paths.push(path);
|
|
308
|
-
});
|
|
309
|
-
return paths;
|
|
310
|
-
}
|
|
311
|
-
isEnterKey(e) {
|
|
312
|
-
var _a;
|
|
313
|
-
return browser_3.Key.ENTER.keyCode === ((_a = browser_3.KeyCode.createKeyCode(e.nativeEvent).key) === null || _a === void 0 ? void 0 : _a.keyCode);
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* The widget `id`.
|
|
318
|
-
*/
|
|
319
|
-
GettingStartedWidget.ID = 'getting.started.widget';
|
|
320
|
-
/**
|
|
321
|
-
* The widget `label` which is used for display purposes.
|
|
322
|
-
*/
|
|
323
|
-
GettingStartedWidget.LABEL = nls_1.nls.localizeByDefault('Welcome');
|
|
324
|
-
__decorate([
|
|
325
|
-
(0, inversify_1.inject)(application_protocol_1.ApplicationServer),
|
|
326
|
-
__metadata("design:type", Object)
|
|
327
|
-
], GettingStartedWidget.prototype, "appServer", void 0);
|
|
328
|
-
__decorate([
|
|
329
|
-
(0, inversify_1.inject)(common_1.CommandRegistry),
|
|
330
|
-
__metadata("design:type", common_1.CommandRegistry)
|
|
331
|
-
], GettingStartedWidget.prototype, "commandRegistry", void 0);
|
|
332
|
-
__decorate([
|
|
333
|
-
(0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
|
|
334
|
-
__metadata("design:type", Object)
|
|
335
|
-
], GettingStartedWidget.prototype, "environments", void 0);
|
|
336
|
-
__decorate([
|
|
337
|
-
(0, inversify_1.inject)(browser_3.LabelProvider),
|
|
338
|
-
__metadata("design:type", browser_3.LabelProvider)
|
|
339
|
-
], GettingStartedWidget.prototype, "labelProvider", void 0);
|
|
340
|
-
__decorate([
|
|
341
|
-
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
342
|
-
__metadata("design:type", Object)
|
|
343
|
-
], GettingStartedWidget.prototype, "windowService", void 0);
|
|
344
|
-
__decorate([
|
|
345
|
-
(0, inversify_1.inject)(browser_1.WorkspaceService),
|
|
346
|
-
__metadata("design:type", browser_1.WorkspaceService)
|
|
347
|
-
], GettingStartedWidget.prototype, "workspaceService", void 0);
|
|
348
|
-
__decorate([
|
|
349
|
-
(0, inversify_1.inject)(browser_3.PreferenceService),
|
|
350
|
-
__metadata("design:type", Object)
|
|
351
|
-
], GettingStartedWidget.prototype, "preferenceService", void 0);
|
|
352
|
-
__decorate([
|
|
353
|
-
(0, inversify_1.postConstruct)(),
|
|
354
|
-
__metadata("design:type", Function),
|
|
355
|
-
__metadata("design:paramtypes", []),
|
|
356
|
-
__metadata("design:returntype", void 0)
|
|
357
|
-
], GettingStartedWidget.prototype, "init", null);
|
|
358
|
-
GettingStartedWidget = GettingStartedWidget_1 = __decorate([
|
|
359
|
-
(0, inversify_1.injectable)()
|
|
360
|
-
], GettingStartedWidget);
|
|
361
|
-
exports.GettingStartedWidget = GettingStartedWidget;
|
|
362
|
-
function WelcomePreferences(props) {
|
|
363
|
-
const [startupEditor, setStartupEditor] = React.useState(props.preferenceService.get('workbench.startupEditor', 'welcomePage'));
|
|
364
|
-
React.useEffect(() => {
|
|
365
|
-
const prefListener = props.preferenceService.onPreferenceChanged(change => {
|
|
366
|
-
if (change.preferenceName === 'workbench.startupEditor') {
|
|
367
|
-
const prefValue = change.newValue;
|
|
368
|
-
setStartupEditor(prefValue);
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
return () => prefListener.dispose();
|
|
372
|
-
}, [props.preferenceService]);
|
|
373
|
-
const handleChange = (e) => {
|
|
374
|
-
const newValue = e.target.checked ? 'welcomePage' : 'none';
|
|
375
|
-
props.preferenceService.updateValue('workbench.startupEditor', newValue);
|
|
376
|
-
};
|
|
377
|
-
return (React.createElement("div", { className: 'gs-preference' },
|
|
378
|
-
React.createElement("input", { type: "checkbox", className: "theia-input", id: "startupEditor", onChange: handleChange, checked: startupEditor === 'welcomePage' || startupEditor === 'welcomePageInEmptyWorkbench' }),
|
|
379
|
-
React.createElement("label", { htmlFor: "startupEditor" }, nls_1.nls.localizeByDefault('Show welcome page on startup'))));
|
|
380
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Ericsson 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 GettingStartedWidget_1;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.GettingStartedWidget = void 0;
|
|
29
|
+
const React = require("@theia/core/shared/react");
|
|
30
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const common_1 = require("@theia/core/lib/common");
|
|
33
|
+
const browser_1 = require("@theia/workspace/lib/browser");
|
|
34
|
+
const browser_2 = require("@theia/keymaps/lib/browser");
|
|
35
|
+
const browser_3 = require("@theia/core/lib/browser");
|
|
36
|
+
const application_protocol_1 = require("@theia/core/lib/common/application-protocol");
|
|
37
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
38
|
+
const env_variables_1 = require("@theia/core/lib/common/env-variables");
|
|
39
|
+
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
40
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
41
|
+
/**
|
|
42
|
+
* Default implementation of the `GettingStartedWidget`.
|
|
43
|
+
* The widget is displayed when there are currently no workspaces present.
|
|
44
|
+
* Some of the features displayed include:
|
|
45
|
+
* - `open` commands.
|
|
46
|
+
* - `recently used workspaces`.
|
|
47
|
+
* - `settings` commands.
|
|
48
|
+
* - `help` commands.
|
|
49
|
+
* - helpful links.
|
|
50
|
+
*/
|
|
51
|
+
let GettingStartedWidget = GettingStartedWidget_1 = class GettingStartedWidget extends browser_3.ReactWidget {
|
|
52
|
+
constructor() {
|
|
53
|
+
super(...arguments);
|
|
54
|
+
/**
|
|
55
|
+
* The application name which is used for display purposes.
|
|
56
|
+
*/
|
|
57
|
+
this.applicationName = frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().applicationName;
|
|
58
|
+
/**
|
|
59
|
+
* The recently used workspaces limit.
|
|
60
|
+
* Used in order to limit the number of recently used workspaces to display.
|
|
61
|
+
*/
|
|
62
|
+
this.recentLimit = 5;
|
|
63
|
+
/**
|
|
64
|
+
* The list of recently used workspaces.
|
|
65
|
+
*/
|
|
66
|
+
this.recentWorkspaces = [];
|
|
67
|
+
/**
|
|
68
|
+
* Collection of useful links to display for end users.
|
|
69
|
+
*/
|
|
70
|
+
this.documentationUrl = 'https://www.theia-ide.org/docs/';
|
|
71
|
+
this.compatibilityUrl = 'https://eclipse-theia.github.io/vscode-theia-comparator/status.html';
|
|
72
|
+
this.extensionUrl = 'https://www.theia-ide.org/docs/authoring_extensions';
|
|
73
|
+
this.pluginUrl = 'https://www.theia-ide.org/docs/authoring_plugins';
|
|
74
|
+
/**
|
|
75
|
+
* Trigger the open command.
|
|
76
|
+
*/
|
|
77
|
+
this.doOpen = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN.id);
|
|
78
|
+
this.doOpenEnter = (e) => {
|
|
79
|
+
if (this.isEnterKey(e)) {
|
|
80
|
+
this.doOpen();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Trigger the open file command.
|
|
85
|
+
*/
|
|
86
|
+
this.doOpenFile = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_FILE.id);
|
|
87
|
+
this.doOpenFileEnter = (e) => {
|
|
88
|
+
if (this.isEnterKey(e)) {
|
|
89
|
+
this.doOpenFile();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Trigger the open folder command.
|
|
94
|
+
*/
|
|
95
|
+
this.doOpenFolder = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_FOLDER.id);
|
|
96
|
+
this.doOpenFolderEnter = (e) => {
|
|
97
|
+
if (this.isEnterKey(e)) {
|
|
98
|
+
this.doOpenFolder();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Trigger the open workspace command.
|
|
103
|
+
*/
|
|
104
|
+
this.doOpenWorkspace = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_WORKSPACE.id);
|
|
105
|
+
this.doOpenWorkspaceEnter = (e) => {
|
|
106
|
+
if (this.isEnterKey(e)) {
|
|
107
|
+
this.doOpenWorkspace();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Trigger the open recent workspace command.
|
|
112
|
+
*/
|
|
113
|
+
this.doOpenRecentWorkspace = () => this.commandRegistry.executeCommand(browser_1.WorkspaceCommands.OPEN_RECENT_WORKSPACE.id);
|
|
114
|
+
this.doOpenRecentWorkspaceEnter = (e) => {
|
|
115
|
+
if (this.isEnterKey(e)) {
|
|
116
|
+
this.doOpenRecentWorkspace();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Trigger the open preferences command.
|
|
121
|
+
* Used to open the preferences widget.
|
|
122
|
+
*/
|
|
123
|
+
this.doOpenPreferences = () => this.commandRegistry.executeCommand(browser_3.CommonCommands.OPEN_PREFERENCES.id);
|
|
124
|
+
this.doOpenPreferencesEnter = (e) => {
|
|
125
|
+
if (this.isEnterKey(e)) {
|
|
126
|
+
this.doOpenPreferences();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Trigger the open keyboard shortcuts command.
|
|
131
|
+
* Used to open the keyboard shortcuts widget.
|
|
132
|
+
*/
|
|
133
|
+
this.doOpenKeyboardShortcuts = () => this.commandRegistry.executeCommand(browser_2.KeymapsCommands.OPEN_KEYMAPS.id);
|
|
134
|
+
this.doOpenKeyboardShortcutsEnter = (e) => {
|
|
135
|
+
if (this.isEnterKey(e)) {
|
|
136
|
+
this.doOpenKeyboardShortcuts();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Open a workspace given its uri.
|
|
141
|
+
* @param uri {URI} the workspace uri.
|
|
142
|
+
*/
|
|
143
|
+
this.open = (uri) => this.workspaceService.open(uri);
|
|
144
|
+
this.openEnter = (e, uri) => {
|
|
145
|
+
if (this.isEnterKey(e)) {
|
|
146
|
+
this.open(uri);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Open a link in an external window.
|
|
151
|
+
* @param url the link.
|
|
152
|
+
*/
|
|
153
|
+
this.doOpenExternalLink = (url) => this.windowService.openNewWindow(url, { external: true });
|
|
154
|
+
this.doOpenExternalLinkEnter = (e, url) => {
|
|
155
|
+
if (this.isEnterKey(e)) {
|
|
156
|
+
this.doOpenExternalLink(url);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
init() {
|
|
161
|
+
this.doInit();
|
|
162
|
+
}
|
|
163
|
+
async doInit() {
|
|
164
|
+
this.id = GettingStartedWidget_1.ID;
|
|
165
|
+
this.title.label = GettingStartedWidget_1.LABEL;
|
|
166
|
+
this.title.caption = GettingStartedWidget_1.LABEL;
|
|
167
|
+
this.title.closable = true;
|
|
168
|
+
this.applicationInfo = await this.appServer.getApplicationInfo();
|
|
169
|
+
this.recentWorkspaces = await this.workspaceService.recentWorkspaces();
|
|
170
|
+
this.home = new uri_1.default(await this.environments.getHomeDirUri()).path.toString();
|
|
171
|
+
this.update();
|
|
172
|
+
}
|
|
173
|
+
onActivateRequest(msg) {
|
|
174
|
+
super.onActivateRequest(msg);
|
|
175
|
+
const elArr = this.node.getElementsByTagName('a');
|
|
176
|
+
if (elArr && elArr.length > 0) {
|
|
177
|
+
elArr[0].focus();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Render the content of the widget.
|
|
182
|
+
*/
|
|
183
|
+
render() {
|
|
184
|
+
return React.createElement("div", { className: 'gs-container' },
|
|
185
|
+
React.createElement("div", { className: 'gs-content-container' },
|
|
186
|
+
this.renderHeader(),
|
|
187
|
+
React.createElement("hr", { className: 'gs-hr' }),
|
|
188
|
+
React.createElement("div", { className: 'flex-grid' },
|
|
189
|
+
React.createElement("div", { className: 'col' }, this.renderOpen())),
|
|
190
|
+
React.createElement("div", { className: 'flex-grid' },
|
|
191
|
+
React.createElement("div", { className: 'col' }, this.renderRecentWorkspaces())),
|
|
192
|
+
React.createElement("div", { className: 'flex-grid' },
|
|
193
|
+
React.createElement("div", { className: 'col' }, this.renderSettings())),
|
|
194
|
+
React.createElement("div", { className: 'flex-grid' },
|
|
195
|
+
React.createElement("div", { className: 'col' }, this.renderHelp())),
|
|
196
|
+
React.createElement("div", { className: 'flex-grid' },
|
|
197
|
+
React.createElement("div", { className: 'col' }, this.renderVersion()))),
|
|
198
|
+
React.createElement("div", { className: 'gs-preference-container' }, this.renderPreferences()));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Render the widget header.
|
|
202
|
+
* Renders the title `{applicationName} Getting Started`.
|
|
203
|
+
*/
|
|
204
|
+
renderHeader() {
|
|
205
|
+
return React.createElement("div", { className: 'gs-header' },
|
|
206
|
+
React.createElement("h1", null,
|
|
207
|
+
this.applicationName,
|
|
208
|
+
React.createElement("span", { className: 'gs-sub-header' }, ' ' + GettingStartedWidget_1.LABEL)));
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Render the `open` section.
|
|
212
|
+
* Displays a collection of `open` commands.
|
|
213
|
+
*/
|
|
214
|
+
renderOpen() {
|
|
215
|
+
const requireSingleOpen = common_1.isOSX || !common_1.environment.electron.is();
|
|
216
|
+
const open = requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
217
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpen, onKeyDown: this.doOpenEnter }, nls_1.nls.localizeByDefault('Open')));
|
|
218
|
+
const openFile = !requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
219
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFile, onKeyDown: this.doOpenFileEnter }, nls_1.nls.localizeByDefault('Open File')));
|
|
220
|
+
const openFolder = !requireSingleOpen && React.createElement("div", { className: 'gs-action-container' },
|
|
221
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFolder, onKeyDown: this.doOpenFolderEnter }, nls_1.nls.localizeByDefault('Open Folder')));
|
|
222
|
+
const openWorkspace = (React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenWorkspace, onKeyDown: this.doOpenWorkspaceEnter }, nls_1.nls.localizeByDefault('Open Workspace')));
|
|
223
|
+
return React.createElement("div", { className: 'gs-section' },
|
|
224
|
+
React.createElement("h3", { className: 'gs-section-header' },
|
|
225
|
+
React.createElement("i", { className: (0, browser_3.codicon)('folder-opened') }),
|
|
226
|
+
nls_1.nls.localizeByDefault('Open')),
|
|
227
|
+
open,
|
|
228
|
+
openFile,
|
|
229
|
+
openFolder,
|
|
230
|
+
openWorkspace);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Render the recently used workspaces section.
|
|
234
|
+
*/
|
|
235
|
+
renderRecentWorkspaces() {
|
|
236
|
+
const items = this.recentWorkspaces;
|
|
237
|
+
const paths = this.buildPaths(items);
|
|
238
|
+
const content = paths.slice(0, this.recentLimit).map((item, index) => React.createElement("div", { className: 'gs-action-container', key: index },
|
|
239
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.open(new uri_1.default(items[index])), onKeyDown: (e) => this.openEnter(e, new uri_1.default(items[index])) }, new uri_1.default(items[index]).path.base),
|
|
240
|
+
React.createElement("span", { className: 'gs-action-details' }, item)));
|
|
241
|
+
// If the recently used workspaces list exceeds the limit, display `More...` which triggers the recently used workspaces quick-open menu upon selection.
|
|
242
|
+
const more = paths.length > this.recentLimit && React.createElement("div", { className: 'gs-action-container' },
|
|
243
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenRecentWorkspace, onKeyDown: this.doOpenRecentWorkspaceEnter }, nls_1.nls.localizeByDefault('More...')));
|
|
244
|
+
return React.createElement("div", { className: 'gs-section' },
|
|
245
|
+
React.createElement("h3", { className: 'gs-section-header' },
|
|
246
|
+
React.createElement("i", { className: (0, browser_3.codicon)('history') }),
|
|
247
|
+
nls_1.nls.localizeByDefault('Recent')),
|
|
248
|
+
items.length > 0 ? content : React.createElement("p", { className: 'gs-no-recent' },
|
|
249
|
+
nls_1.nls.localizeByDefault('You have no recent folders,') + ' ',
|
|
250
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenFolder, onKeyDown: this.doOpenFolderEnter }, nls_1.nls.localizeByDefault('open a folder')),
|
|
251
|
+
' ' + nls_1.nls.localizeByDefault('to start.')),
|
|
252
|
+
more);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Render the settings section.
|
|
256
|
+
* Generally used to display useful links.
|
|
257
|
+
*/
|
|
258
|
+
renderSettings() {
|
|
259
|
+
return React.createElement("div", { className: 'gs-section' },
|
|
260
|
+
React.createElement("h3", { className: 'gs-section-header' },
|
|
261
|
+
React.createElement("i", { className: (0, browser_3.codicon)('settings-gear') }),
|
|
262
|
+
nls_1.nls.localizeByDefault('Settings')),
|
|
263
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
264
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenPreferences, onKeyDown: this.doOpenPreferencesEnter }, nls_1.nls.localizeByDefault('Open Settings'))),
|
|
265
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
266
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: this.doOpenKeyboardShortcuts, onKeyDown: this.doOpenKeyboardShortcutsEnter }, nls_1.nls.localizeByDefault('Open Keyboard Shortcuts'))));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Render the help section.
|
|
270
|
+
*/
|
|
271
|
+
renderHelp() {
|
|
272
|
+
return React.createElement("div", { className: 'gs-section' },
|
|
273
|
+
React.createElement("h3", { className: 'gs-section-header' },
|
|
274
|
+
React.createElement("i", { className: (0, browser_3.codicon)('question') }),
|
|
275
|
+
nls_1.nls.localizeByDefault('Help')),
|
|
276
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
277
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.documentationUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.documentationUrl) }, nls_1.nls.localizeByDefault('Documentation'))),
|
|
278
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
279
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.compatibilityUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.compatibilityUrl) }, nls_1.nls.localize('theia/getting-started/apiComparator', '{0} API Compatibility', 'VS Code'))),
|
|
280
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
281
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.extensionUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.extensionUrl) }, nls_1.nls.localize('theia/getting-started/newExtension', 'Building a New Extension'))),
|
|
282
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
283
|
+
React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(this.pluginUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, this.pluginUrl) }, nls_1.nls.localize('theia/getting-started/newPlugin', 'Building a New Plugin'))));
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Render the version section.
|
|
287
|
+
*/
|
|
288
|
+
renderVersion() {
|
|
289
|
+
return React.createElement("div", { className: 'gs-section' },
|
|
290
|
+
React.createElement("div", { className: 'gs-action-container' },
|
|
291
|
+
React.createElement("p", { className: 'gs-sub-header' }, this.applicationInfo ? nls_1.nls.localizeByDefault('Version: {0}', this.applicationInfo.version) : '')));
|
|
292
|
+
}
|
|
293
|
+
renderPreferences() {
|
|
294
|
+
return React.createElement(WelcomePreferences, { preferenceService: this.preferenceService });
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Build the list of workspace paths.
|
|
298
|
+
* @param workspaces {string[]} the list of workspaces.
|
|
299
|
+
* @returns {string[]} the list of workspace paths.
|
|
300
|
+
*/
|
|
301
|
+
buildPaths(workspaces) {
|
|
302
|
+
const paths = [];
|
|
303
|
+
workspaces.forEach(workspace => {
|
|
304
|
+
const uri = new uri_1.default(workspace);
|
|
305
|
+
const pathLabel = this.labelProvider.getLongName(uri);
|
|
306
|
+
const path = this.home ? common_1.Path.tildify(pathLabel, this.home) : pathLabel;
|
|
307
|
+
paths.push(path);
|
|
308
|
+
});
|
|
309
|
+
return paths;
|
|
310
|
+
}
|
|
311
|
+
isEnterKey(e) {
|
|
312
|
+
var _a;
|
|
313
|
+
return browser_3.Key.ENTER.keyCode === ((_a = browser_3.KeyCode.createKeyCode(e.nativeEvent).key) === null || _a === void 0 ? void 0 : _a.keyCode);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* The widget `id`.
|
|
318
|
+
*/
|
|
319
|
+
GettingStartedWidget.ID = 'getting.started.widget';
|
|
320
|
+
/**
|
|
321
|
+
* The widget `label` which is used for display purposes.
|
|
322
|
+
*/
|
|
323
|
+
GettingStartedWidget.LABEL = nls_1.nls.localizeByDefault('Welcome');
|
|
324
|
+
__decorate([
|
|
325
|
+
(0, inversify_1.inject)(application_protocol_1.ApplicationServer),
|
|
326
|
+
__metadata("design:type", Object)
|
|
327
|
+
], GettingStartedWidget.prototype, "appServer", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
(0, inversify_1.inject)(common_1.CommandRegistry),
|
|
330
|
+
__metadata("design:type", common_1.CommandRegistry)
|
|
331
|
+
], GettingStartedWidget.prototype, "commandRegistry", void 0);
|
|
332
|
+
__decorate([
|
|
333
|
+
(0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
|
|
334
|
+
__metadata("design:type", Object)
|
|
335
|
+
], GettingStartedWidget.prototype, "environments", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
(0, inversify_1.inject)(browser_3.LabelProvider),
|
|
338
|
+
__metadata("design:type", browser_3.LabelProvider)
|
|
339
|
+
], GettingStartedWidget.prototype, "labelProvider", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
342
|
+
__metadata("design:type", Object)
|
|
343
|
+
], GettingStartedWidget.prototype, "windowService", void 0);
|
|
344
|
+
__decorate([
|
|
345
|
+
(0, inversify_1.inject)(browser_1.WorkspaceService),
|
|
346
|
+
__metadata("design:type", browser_1.WorkspaceService)
|
|
347
|
+
], GettingStartedWidget.prototype, "workspaceService", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
(0, inversify_1.inject)(browser_3.PreferenceService),
|
|
350
|
+
__metadata("design:type", Object)
|
|
351
|
+
], GettingStartedWidget.prototype, "preferenceService", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
(0, inversify_1.postConstruct)(),
|
|
354
|
+
__metadata("design:type", Function),
|
|
355
|
+
__metadata("design:paramtypes", []),
|
|
356
|
+
__metadata("design:returntype", void 0)
|
|
357
|
+
], GettingStartedWidget.prototype, "init", null);
|
|
358
|
+
GettingStartedWidget = GettingStartedWidget_1 = __decorate([
|
|
359
|
+
(0, inversify_1.injectable)()
|
|
360
|
+
], GettingStartedWidget);
|
|
361
|
+
exports.GettingStartedWidget = GettingStartedWidget;
|
|
362
|
+
function WelcomePreferences(props) {
|
|
363
|
+
const [startupEditor, setStartupEditor] = React.useState(props.preferenceService.get('workbench.startupEditor', 'welcomePage'));
|
|
364
|
+
React.useEffect(() => {
|
|
365
|
+
const prefListener = props.preferenceService.onPreferenceChanged(change => {
|
|
366
|
+
if (change.preferenceName === 'workbench.startupEditor') {
|
|
367
|
+
const prefValue = change.newValue;
|
|
368
|
+
setStartupEditor(prefValue);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
return () => prefListener.dispose();
|
|
372
|
+
}, [props.preferenceService]);
|
|
373
|
+
const handleChange = (e) => {
|
|
374
|
+
const newValue = e.target.checked ? 'welcomePage' : 'none';
|
|
375
|
+
props.preferenceService.updateValue('workbench.startupEditor', newValue);
|
|
376
|
+
};
|
|
377
|
+
return (React.createElement("div", { className: 'gs-preference' },
|
|
378
|
+
React.createElement("input", { type: "checkbox", className: "theia-input", id: "startupEditor", onChange: handleChange, checked: startupEditor === 'welcomePage' || startupEditor === 'welcomePageInEmptyWorkbench' }),
|
|
379
|
+
React.createElement("label", { htmlFor: "startupEditor" }, nls_1.nls.localizeByDefault('Show welcome page on startup'))));
|
|
380
|
+
}
|
|
381
381
|
//# sourceMappingURL=getting-started-widget.js.map
|