@theia/plugin-dev 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.
- package/README.md +31 -31
- package/lib/browser/hosted-plugin-controller.d.ts +74 -74
- package/lib/browser/hosted-plugin-controller.js +352 -352
- package/lib/browser/hosted-plugin-frontend-contribution.d.ts +6 -6
- package/lib/browser/hosted-plugin-frontend-contribution.js +56 -56
- package/lib/browser/hosted-plugin-informer.d.ts +25 -25
- package/lib/browser/hosted-plugin-informer.js +102 -102
- package/lib/browser/hosted-plugin-log-viewer.d.ts +14 -14
- package/lib/browser/hosted-plugin-log-viewer.js +69 -69
- package/lib/browser/hosted-plugin-manager-client.d.ts +80 -80
- package/lib/browser/hosted-plugin-manager-client.js +410 -410
- package/lib/browser/hosted-plugin-preferences.d.ts +13 -13
- package/lib/browser/hosted-plugin-preferences.js +60 -60
- package/lib/browser/plugin-dev-frontend-module.d.ts +3 -3
- package/lib/browser/plugin-dev-frontend-module.js +42 -42
- package/lib/common/index.d.ts +2 -2
- package/lib/common/index.js +31 -31
- package/lib/common/plugin-dev-protocol.d.ts +24 -24
- package/lib/common/plugin-dev-protocol.js +20 -20
- package/lib/node/hosted-instance-manager.d.ts +104 -104
- package/lib/node/hosted-instance-manager.js +320 -320
- package/lib/node/hosted-instance-manager.js.map +1 -1
- package/lib/node/hosted-plugin-reader.d.ts +11 -11
- package/lib/node/hosted-plugin-reader.js +68 -68
- package/lib/node/hosted-plugin-reader.js.map +1 -1
- package/lib/node/hosted-plugin-uri-postprocessor.d.ts +6 -6
- package/lib/node/hosted-plugin-uri-postprocessor.js +27 -27
- package/lib/node/hosted-plugins-manager.d.ts +41 -41
- package/lib/node/hosted-plugins-manager.js +119 -119
- package/lib/node/plugin-dev-backend-module.d.ts +4 -4
- package/lib/node/plugin-dev-backend-module.js +53 -53
- package/lib/node/plugin-dev-service.d.ts +25 -25
- package/lib/node/plugin-dev-service.js +108 -108
- package/lib/node-electron/plugin-dev-electron-backend-module.d.ts +3 -3
- package/lib/node-electron/plugin-dev-electron-backend-module.js +28 -28
- package/lib/package.spec.js +25 -25
- package/package.json +9 -9
- package/src/browser/hosted-plugin-controller.ts +356 -356
- package/src/browser/hosted-plugin-frontend-contribution.ts +45 -45
- package/src/browser/hosted-plugin-informer.ts +93 -93
- package/src/browser/hosted-plugin-log-viewer.ts +52 -52
- package/src/browser/hosted-plugin-manager-client.ts +430 -430
- package/src/browser/hosted-plugin-preferences.ts +71 -71
- package/src/browser/plugin-dev-frontend-module.ts +45 -45
- package/src/common/index.ts +21 -21
- package/src/common/plugin-dev-protocol.ts +45 -45
- package/src/node/hosted-instance-manager.ts +382 -382
- package/src/node/hosted-plugin-reader.ts +58 -58
- package/src/node/hosted-plugin-uri-postprocessor.ts +32 -32
- package/src/node/hosted-plugins-manager.ts +146 -146
- package/src/node/plugin-dev-backend-module.ts +54 -54
- package/src/node/plugin-dev-service.ts +107 -107
- package/src/node-electron/plugin-dev-electron-backend-module.ts +29 -29
- package/src/package.spec.ts +28 -28
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. 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 { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
|
|
19
|
-
import { HostedPluginManagerClient, HostedPluginCommands } from './hosted-plugin-manager-client';
|
|
20
|
-
|
|
21
|
-
@injectable()
|
|
22
|
-
export class HostedPluginFrontendContribution implements CommandContribution {
|
|
23
|
-
|
|
24
|
-
@inject(HostedPluginManagerClient)
|
|
25
|
-
protected readonly hostedPluginManagerClient: HostedPluginManagerClient;
|
|
26
|
-
|
|
27
|
-
registerCommands(commands: CommandRegistry): void {
|
|
28
|
-
commands.registerCommand(HostedPluginCommands.START, {
|
|
29
|
-
execute: () => this.hostedPluginManagerClient.start()
|
|
30
|
-
});
|
|
31
|
-
commands.registerCommand(HostedPluginCommands.DEBUG, {
|
|
32
|
-
execute: () => this.hostedPluginManagerClient.debug()
|
|
33
|
-
});
|
|
34
|
-
commands.registerCommand(HostedPluginCommands.STOP, {
|
|
35
|
-
execute: () => this.hostedPluginManagerClient.stop()
|
|
36
|
-
});
|
|
37
|
-
commands.registerCommand(HostedPluginCommands.RESTART, {
|
|
38
|
-
execute: () => this.hostedPluginManagerClient.restart()
|
|
39
|
-
});
|
|
40
|
-
commands.registerCommand(HostedPluginCommands.SELECT_PATH, {
|
|
41
|
-
execute: () => this.hostedPluginManagerClient.selectPluginPath()
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. 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 { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
+
import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
|
|
19
|
+
import { HostedPluginManagerClient, HostedPluginCommands } from './hosted-plugin-manager-client';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class HostedPluginFrontendContribution implements CommandContribution {
|
|
23
|
+
|
|
24
|
+
@inject(HostedPluginManagerClient)
|
|
25
|
+
protected readonly hostedPluginManagerClient: HostedPluginManagerClient;
|
|
26
|
+
|
|
27
|
+
registerCommands(commands: CommandRegistry): void {
|
|
28
|
+
commands.registerCommand(HostedPluginCommands.START, {
|
|
29
|
+
execute: () => this.hostedPluginManagerClient.start()
|
|
30
|
+
});
|
|
31
|
+
commands.registerCommand(HostedPluginCommands.DEBUG, {
|
|
32
|
+
execute: () => this.hostedPluginManagerClient.debug()
|
|
33
|
+
});
|
|
34
|
+
commands.registerCommand(HostedPluginCommands.STOP, {
|
|
35
|
+
execute: () => this.hostedPluginManagerClient.stop()
|
|
36
|
+
});
|
|
37
|
+
commands.registerCommand(HostedPluginCommands.RESTART, {
|
|
38
|
+
execute: () => this.hostedPluginManagerClient.restart()
|
|
39
|
+
});
|
|
40
|
+
commands.registerCommand(HostedPluginCommands.SELECT_PATH, {
|
|
41
|
+
execute: () => this.hostedPluginManagerClient.selectPluginPath()
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 Red Hat, Inc. 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 { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
|
|
19
|
-
import { StatusBarAlignment, StatusBarEntry, FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
20
|
-
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
21
|
-
import { PluginDevServer } from '../common/plugin-dev-protocol';
|
|
22
|
-
import { ConnectionStatusService, ConnectionStatus } from '@theia/core/lib/browser/connection-status-service';
|
|
23
|
-
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
|
|
24
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
25
|
-
import { WindowTitleService } from '@theia/core/lib/browser/window/window-title-service';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Informs the user whether Theia is running with hosted plugin.
|
|
29
|
-
* Adds 'Development Host' status bar element and appends the same prefix to window title.
|
|
30
|
-
*/
|
|
31
|
-
@injectable()
|
|
32
|
-
export class HostedPluginInformer implements FrontendApplicationContribution {
|
|
33
|
-
|
|
34
|
-
public static readonly DEVELOPMENT_HOST_TITLE = nls.localize('theia/plugin-dev/devHost', 'Development Host');
|
|
35
|
-
|
|
36
|
-
public static readonly DEVELOPMENT_HOST = 'development-host';
|
|
37
|
-
|
|
38
|
-
public static readonly DEVELOPMENT_HOST_OFFLINE = 'development-host-offline';
|
|
39
|
-
|
|
40
|
-
private entry: StatusBarEntry;
|
|
41
|
-
|
|
42
|
-
@inject(StatusBar)
|
|
43
|
-
protected readonly statusBar: StatusBar;
|
|
44
|
-
|
|
45
|
-
@inject(WorkspaceService)
|
|
46
|
-
protected readonly workspaceService: WorkspaceService;
|
|
47
|
-
|
|
48
|
-
@inject(PluginDevServer)
|
|
49
|
-
protected readonly hostedPluginServer: PluginDevServer;
|
|
50
|
-
|
|
51
|
-
@inject(ConnectionStatusService)
|
|
52
|
-
protected readonly connectionStatusService: ConnectionStatusService;
|
|
53
|
-
|
|
54
|
-
@inject(FrontendApplicationStateService)
|
|
55
|
-
protected readonly frontendApplicationStateService: FrontendApplicationStateService;
|
|
56
|
-
|
|
57
|
-
@inject(WindowTitleService)
|
|
58
|
-
protected readonly windowTitleService: WindowTitleService;
|
|
59
|
-
|
|
60
|
-
public initialize(): void {
|
|
61
|
-
this.hostedPluginServer.getHostedPlugin().then(pluginMetadata => {
|
|
62
|
-
if (pluginMetadata) {
|
|
63
|
-
this.windowTitleService.update({
|
|
64
|
-
developmentHost: HostedPluginInformer.DEVELOPMENT_HOST_TITLE
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
this.entry = {
|
|
68
|
-
text: `$(cube) ${HostedPluginInformer.DEVELOPMENT_HOST_TITLE}`,
|
|
69
|
-
tooltip: `${nls.localize('theia/plugin-dev/hostedPlugin', 'Hosted Plugin')} '${pluginMetadata.model.name}'`,
|
|
70
|
-
alignment: StatusBarAlignment.LEFT,
|
|
71
|
-
priority: 100
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
this.frontendApplicationStateService.reachedState('ready').then(() => {
|
|
75
|
-
this.updateStatusBarElement();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
this.connectionStatusService.onStatusChange(() => this.updateStatusBarElement());
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private updateStatusBarElement(): void {
|
|
84
|
-
if (this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE) {
|
|
85
|
-
this.entry.className = HostedPluginInformer.DEVELOPMENT_HOST_OFFLINE;
|
|
86
|
-
} else {
|
|
87
|
-
this.entry.className = HostedPluginInformer.DEVELOPMENT_HOST;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
this.statusBar.setElement(HostedPluginInformer.DEVELOPMENT_HOST, this.entry);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
+
import { StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
|
|
19
|
+
import { StatusBarAlignment, StatusBarEntry, FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
20
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
21
|
+
import { PluginDevServer } from '../common/plugin-dev-protocol';
|
|
22
|
+
import { ConnectionStatusService, ConnectionStatus } from '@theia/core/lib/browser/connection-status-service';
|
|
23
|
+
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
|
|
24
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
25
|
+
import { WindowTitleService } from '@theia/core/lib/browser/window/window-title-service';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Informs the user whether Theia is running with hosted plugin.
|
|
29
|
+
* Adds 'Development Host' status bar element and appends the same prefix to window title.
|
|
30
|
+
*/
|
|
31
|
+
@injectable()
|
|
32
|
+
export class HostedPluginInformer implements FrontendApplicationContribution {
|
|
33
|
+
|
|
34
|
+
public static readonly DEVELOPMENT_HOST_TITLE = nls.localize('theia/plugin-dev/devHost', 'Development Host');
|
|
35
|
+
|
|
36
|
+
public static readonly DEVELOPMENT_HOST = 'development-host';
|
|
37
|
+
|
|
38
|
+
public static readonly DEVELOPMENT_HOST_OFFLINE = 'development-host-offline';
|
|
39
|
+
|
|
40
|
+
private entry: StatusBarEntry;
|
|
41
|
+
|
|
42
|
+
@inject(StatusBar)
|
|
43
|
+
protected readonly statusBar: StatusBar;
|
|
44
|
+
|
|
45
|
+
@inject(WorkspaceService)
|
|
46
|
+
protected readonly workspaceService: WorkspaceService;
|
|
47
|
+
|
|
48
|
+
@inject(PluginDevServer)
|
|
49
|
+
protected readonly hostedPluginServer: PluginDevServer;
|
|
50
|
+
|
|
51
|
+
@inject(ConnectionStatusService)
|
|
52
|
+
protected readonly connectionStatusService: ConnectionStatusService;
|
|
53
|
+
|
|
54
|
+
@inject(FrontendApplicationStateService)
|
|
55
|
+
protected readonly frontendApplicationStateService: FrontendApplicationStateService;
|
|
56
|
+
|
|
57
|
+
@inject(WindowTitleService)
|
|
58
|
+
protected readonly windowTitleService: WindowTitleService;
|
|
59
|
+
|
|
60
|
+
public initialize(): void {
|
|
61
|
+
this.hostedPluginServer.getHostedPlugin().then(pluginMetadata => {
|
|
62
|
+
if (pluginMetadata) {
|
|
63
|
+
this.windowTitleService.update({
|
|
64
|
+
developmentHost: HostedPluginInformer.DEVELOPMENT_HOST_TITLE
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
this.entry = {
|
|
68
|
+
text: `$(cube) ${HostedPluginInformer.DEVELOPMENT_HOST_TITLE}`,
|
|
69
|
+
tooltip: `${nls.localize('theia/plugin-dev/hostedPlugin', 'Hosted Plugin')} '${pluginMetadata.model.name}'`,
|
|
70
|
+
alignment: StatusBarAlignment.LEFT,
|
|
71
|
+
priority: 100
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
this.frontendApplicationStateService.reachedState('ready').then(() => {
|
|
75
|
+
this.updateStatusBarElement();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
this.connectionStatusService.onStatusChange(() => this.updateStatusBarElement());
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private updateStatusBarElement(): void {
|
|
84
|
+
if (this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE) {
|
|
85
|
+
this.entry.className = HostedPluginInformer.DEVELOPMENT_HOST_OFFLINE;
|
|
86
|
+
} else {
|
|
87
|
+
this.entry.className = HostedPluginInformer.DEVELOPMENT_HOST;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.statusBar.setElement(HostedPluginInformer.DEVELOPMENT_HOST, this.entry);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 Red Hat, Inc. 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 { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { OutputChannel, OutputChannelManager } from '@theia/output/lib/browser/output-channel';
|
|
19
|
-
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
|
|
20
|
-
import { LogPart } from '@theia/plugin-ext/lib/common/types';
|
|
21
|
-
import { HostedPluginWatcher } from '@theia/plugin-ext/lib/hosted/browser/hosted-plugin-watcher';
|
|
22
|
-
|
|
23
|
-
@injectable()
|
|
24
|
-
export class HostedPluginLogViewer {
|
|
25
|
-
public static OUTPUT_CHANNEL_NAME = 'hosted-instance-log';
|
|
26
|
-
|
|
27
|
-
@inject(HostedPluginWatcher)
|
|
28
|
-
protected readonly watcher: HostedPluginWatcher;
|
|
29
|
-
@inject(OutputChannelManager)
|
|
30
|
-
protected readonly outputChannelManager: OutputChannelManager;
|
|
31
|
-
@inject(OutputContribution)
|
|
32
|
-
protected readonly outputContribution: OutputContribution;
|
|
33
|
-
|
|
34
|
-
protected channel: OutputChannel;
|
|
35
|
-
|
|
36
|
-
showLogConsole(): void {
|
|
37
|
-
this.outputContribution.openView({ reveal: true }).then(view => {
|
|
38
|
-
view.activate();
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@postConstruct()
|
|
43
|
-
protected init(): void {
|
|
44
|
-
this.channel = this.outputChannelManager.getChannel(HostedPluginLogViewer.OUTPUT_CHANNEL_NAME);
|
|
45
|
-
this.watcher.onLogMessageEvent(event => this.logMessageEventHandler(event));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
protected logMessageEventHandler(event: LogPart): void {
|
|
49
|
-
this.channel.appendLine(event.data);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { OutputChannel, OutputChannelManager } from '@theia/output/lib/browser/output-channel';
|
|
19
|
+
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
|
|
20
|
+
import { LogPart } from '@theia/plugin-ext/lib/common/types';
|
|
21
|
+
import { HostedPluginWatcher } from '@theia/plugin-ext/lib/hosted/browser/hosted-plugin-watcher';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class HostedPluginLogViewer {
|
|
25
|
+
public static OUTPUT_CHANNEL_NAME = 'hosted-instance-log';
|
|
26
|
+
|
|
27
|
+
@inject(HostedPluginWatcher)
|
|
28
|
+
protected readonly watcher: HostedPluginWatcher;
|
|
29
|
+
@inject(OutputChannelManager)
|
|
30
|
+
protected readonly outputChannelManager: OutputChannelManager;
|
|
31
|
+
@inject(OutputContribution)
|
|
32
|
+
protected readonly outputContribution: OutputContribution;
|
|
33
|
+
|
|
34
|
+
protected channel: OutputChannel;
|
|
35
|
+
|
|
36
|
+
showLogConsole(): void {
|
|
37
|
+
this.outputContribution.openView({ reveal: true }).then(view => {
|
|
38
|
+
view.activate();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@postConstruct()
|
|
43
|
+
protected init(): void {
|
|
44
|
+
this.channel = this.outputChannelManager.getChannel(HostedPluginLogViewer.OUTPUT_CHANNEL_NAME);
|
|
45
|
+
this.watcher.onLogMessageEvent(event => this.logMessageEventHandler(event));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected logMessageEventHandler(event: LogPart): void {
|
|
49
|
+
this.channel.appendLine(event.data);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|