@theia/plugin-ext 1.18.0-next.ed824933 → 1.21.0-next.11
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/LICENSE +642 -0
- package/README.md +5 -0
- package/lib/common/arrays.d.ts +4 -0
- package/lib/common/arrays.d.ts.map +1 -1
- package/lib/common/arrays.js +9 -1
- package/lib/common/arrays.js.map +1 -1
- package/lib/common/connection.d.ts +47 -34
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js +90 -28
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +4 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +30 -13
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +21 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +3 -1
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +20 -14
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +1 -0
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +5 -7
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.js +4 -52
- package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +3 -6
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +7 -40
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +6 -2
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/debug/debug-main.d.ts +3 -3
- package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
- package/lib/main/browser/debug/debug-main.js +2 -3
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +15 -0
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +6 -6
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.d.ts +3 -3
- package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.js +17 -6
- package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +3 -4
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/file-system-main-impl.js +1 -1
- package/lib/main/browser/file-system-main-impl.js.map +1 -1
- package/lib/main/browser/languages-main.js +1 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.js +2 -2
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/message-registry-main.js +1 -1
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +3 -6
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.js +48 -100
- package/lib/main/browser/quick-open-main.js.map +1 -1
- package/lib/main/browser/tasks-main.d.ts.map +1 -1
- package/lib/main/browser/tasks-main.js +6 -0
- package/lib/main/browser/tasks-main.js.map +1 -1
- package/lib/main/browser/timeline-main.d.ts.map +1 -1
- package/lib/main/browser/timeline-main.js +1 -1
- package/lib/main/browser/timeline-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +77 -26
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +3 -1
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +3 -7
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +26 -39
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
- package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
- package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-preferences.js +3 -2
- package/lib/main/browser/webview/webview-preferences.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -1
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +2 -2
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/plugin/comments.d.ts.map +1 -1
- package/lib/plugin/comments.js +2 -3
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts +1 -2
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -3
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/decorations.js +2 -3
- package/lib/plugin/decorations.js.map +1 -1
- package/lib/plugin/document-data.d.ts.map +1 -1
- package/lib/plugin/document-data.js +1 -1
- package/lib/plugin/document-data.js.map +1 -1
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/documents.js +1 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
- package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.js +12 -13
- package/lib/plugin/file-system-ext-impl.js.map +1 -1
- package/lib/plugin/known-commands.spec.js +1 -2
- package/lib/plugin/known-commands.spec.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +8 -3
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/languages/rename.d.ts +1 -2
- package/lib/plugin/languages/rename.d.ts.map +1 -1
- package/lib/plugin/languages/rename.js.map +1 -1
- package/lib/plugin/languages.d.ts +1 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +2 -1
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +3 -0
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +7 -6
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +37 -19
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +7 -7
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js +6 -6
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +8 -4
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +16 -13
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +10 -5
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +24 -3
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +4 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +6 -1
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.d.ts +2 -4
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +12 -29
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -3
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +3 -17
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/timeline.js +1 -2
- package/lib/plugin/timeline.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +18 -11
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +55 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +81 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webviews.d.ts +1 -2
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js.map +1 -1
- package/package.json +31 -27
- package/src/common/arrays.ts +8 -0
- package/src/common/connection.ts +98 -42
- package/src/common/plugin-api-rpc-model.ts +4 -0
- package/src/common/plugin-api-rpc.ts +31 -12
- package/src/common/plugin-protocol.ts +3 -1
- package/src/hosted/browser/hosted-plugin.ts +20 -13
- package/src/hosted/browser/worker/debug-stub.ts +1 -0
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
- package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -6
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
- package/src/hosted/node/plugin-manifest-loader.ts +4 -56
- package/src/hosted/node/plugin-service.ts +7 -40
- package/src/hosted/node/scanners/scanner-theia.ts +7 -3
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +8 -4
- package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
- package/src/main/browser/debug/debug-main.ts +4 -5
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
- package/src/main/browser/debug/plugin-debug-service.ts +23 -0
- package/src/main/browser/debug/plugin-debug-session-factory.ts +6 -6
- package/src/main/browser/dialogs/modal-notification.ts +18 -7
- package/src/main/browser/dialogs/style/modal-notification.css +17 -2
- package/src/main/browser/editors-and-documents-main.ts +1 -2
- package/src/main/browser/file-system-main-impl.ts +1 -1
- package/src/main/browser/languages-main.ts +1 -1
- package/src/main/browser/main-context.ts +3 -3
- package/src/main/browser/message-registry-main.ts +1 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
- package/src/main/browser/quick-open-main.ts +54 -109
- package/src/main/browser/style/tree.css +4 -0
- package/src/main/browser/tasks-main.ts +7 -0
- package/src/main/browser/timeline-main.ts +1 -2
- package/src/main/browser/view/plugin-view-registry.ts +83 -28
- package/src/main/browser/view/plugin-view-widget.ts +7 -2
- package/src/main/browser/view/tree-view-widget.tsx +43 -65
- package/src/main/browser/webview/pre/host.js +20 -12
- package/src/main/browser/webview/pre/main.js +1 -2
- package/src/main/browser/webview/pre/service-worker.js +1 -1
- package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
- package/src/main/browser/webview/webview-preferences.ts +3 -2
- package/src/main/browser/webview/webview.ts +2 -2
- package/src/plugin/comments.ts +1 -2
- package/src/plugin/custom-editors.ts +2 -4
- package/src/plugin/decorations.ts +1 -2
- package/src/plugin/document-data.ts +1 -2
- package/src/plugin/documents.ts +1 -2
- package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
- package/src/plugin/file-system-ext-impl.ts +1 -2
- package/src/plugin/known-commands.spec.ts +1 -2
- package/src/plugin/languages/call-hierarchy.ts +14 -5
- package/src/plugin/languages/rename.ts +1 -2
- package/src/plugin/languages.ts +5 -2
- package/src/plugin/message-registry.ts +3 -1
- package/src/plugin/node/debug/debug.ts +46 -26
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +9 -9
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +17 -14
- package/src/plugin/plugin-context.ts +24 -12
- package/src/plugin/plugin-manager.ts +26 -4
- package/src/plugin/plugin-storage.ts +7 -2
- package/src/plugin/preference-registry.spec.ts +1 -2
- package/src/plugin/quick-open.ts +16 -36
- package/src/plugin/tasks/tasks.ts +4 -18
- package/src/plugin/timeline.ts +1 -2
- package/src/plugin/type-converters.ts +20 -13
- package/src/plugin/types-impl.ts +77 -1
- package/src/plugin/webviews.ts +1 -2
- package/lib/common/plugin-message-reader.d.ts +0 -46
- package/lib/common/plugin-message-reader.d.ts.map +0 -1
- package/lib/common/plugin-message-reader.js +0 -116
- package/lib/common/plugin-message-reader.js.map +0 -1
- package/lib/common/plugin-message-writer.d.ts +0 -38
- package/lib/common/plugin-message-writer.d.ts.map +0 -1
- package/lib/common/plugin-message-writer.js +0 -67
- package/lib/common/plugin-message-writer.js.map +0 -1
- package/lib/main/browser/connection-main.d.ts +0 -59
- package/lib/main/browser/connection-main.d.ts.map +0 -1
- package/lib/main/browser/connection-main.js +0 -98
- package/lib/main/browser/connection-main.js.map +0 -1
- package/lib/plugin/connection-ext.d.ts +0 -56
- package/lib/plugin/connection-ext.d.ts.map +0 -1
- package/lib/plugin/connection-ext.js +0 -88
- package/lib/plugin/connection-ext.js.map +0 -1
- package/src/common/plugin-message-reader.ts +0 -111
- package/src/common/plugin-message-writer.ts +0 -65
- package/src/main/browser/connection-main.ts +0 -107
- package/src/plugin/connection-ext.ts +0 -95
|
@@ -1,107 +0,0 @@
|
|
|
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 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
18
|
-
import { MAIN_RPC_CONTEXT, ConnectionMain, ConnectionExt } from '../../common/plugin-api-rpc';
|
|
19
|
-
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
20
|
-
import { PluginConnection } from '../../common/connection';
|
|
21
|
-
import { PluginMessageReader } from '../../common/plugin-message-reader';
|
|
22
|
-
import { PluginMessageWriter } from '../../common/plugin-message-writer';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Implementation of connection system of the plugin API.
|
|
26
|
-
* Creates holds the connections to the plugins. Allows to send a message to the plugin by getting already created connection via id.
|
|
27
|
-
*/
|
|
28
|
-
export class ConnectionMainImpl implements ConnectionMain, Disposable {
|
|
29
|
-
|
|
30
|
-
private readonly proxy: ConnectionExt;
|
|
31
|
-
private readonly connections = new Map<string, PluginConnection>();
|
|
32
|
-
private readonly toDispose = new DisposableCollection();
|
|
33
|
-
constructor(rpc: RPCProtocol) {
|
|
34
|
-
this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.CONNECTION_EXT);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
dispose(): void {
|
|
38
|
-
this.toDispose.dispose();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Gets the connection between plugin by id and sends string message to it.
|
|
43
|
-
*
|
|
44
|
-
* @param id connection's id
|
|
45
|
-
* @param message incoming message
|
|
46
|
-
*/
|
|
47
|
-
async $sendMessage(id: string, message: string): Promise<void> {
|
|
48
|
-
if (this.connections.has(id)) {
|
|
49
|
-
this.connections.get(id)!.reader.readMessage(message);
|
|
50
|
-
} else {
|
|
51
|
-
console.warn('It is not possible to read message. Connection missed.');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Instantiates a new connection by the given id.
|
|
57
|
-
* @param id the connection id
|
|
58
|
-
*/
|
|
59
|
-
async $createConnection(id: string): Promise<void> {
|
|
60
|
-
await this.doEnsureConnection(id);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Deletes a connection.
|
|
65
|
-
* @param id the connection id
|
|
66
|
-
*/
|
|
67
|
-
async $deleteConnection(id: string): Promise<void> {
|
|
68
|
-
this.connections.delete(id);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Returns existed connection or creates a new one.
|
|
73
|
-
* @param id the connection id
|
|
74
|
-
*/
|
|
75
|
-
async ensureConnection(id: string): Promise<PluginConnection> {
|
|
76
|
-
const connection = await this.doEnsureConnection(id);
|
|
77
|
-
await this.proxy.$createConnection(id);
|
|
78
|
-
return connection;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Returns existed connection or creates a new one.
|
|
83
|
-
* @param id the connection id
|
|
84
|
-
*/
|
|
85
|
-
async doEnsureConnection(id: string): Promise<PluginConnection> {
|
|
86
|
-
const connection = this.connections.get(id) || await this.doCreateConnection(id);
|
|
87
|
-
this.connections.set(id, connection);
|
|
88
|
-
return connection;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
protected async doCreateConnection(id: string): Promise<PluginConnection> {
|
|
92
|
-
const reader = new PluginMessageReader();
|
|
93
|
-
const writer = new PluginMessageWriter(id, this.proxy);
|
|
94
|
-
const connection = new PluginConnection(
|
|
95
|
-
reader,
|
|
96
|
-
writer,
|
|
97
|
-
() => {
|
|
98
|
-
this.connections.delete(id);
|
|
99
|
-
if (!toClose.disposed) {
|
|
100
|
-
this.proxy.$deleteConnection(id);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
const toClose = new DisposableCollection(Disposable.create(() => reader.fireClose()));
|
|
104
|
-
this.toDispose.push(toClose);
|
|
105
|
-
return connection;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
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 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
import { ConnectionExt, PLUGIN_RPC_CONTEXT, ConnectionMain } from '../common/plugin-api-rpc';
|
|
18
|
-
import { RPCProtocol } from '../common/rpc-protocol';
|
|
19
|
-
import { PluginConnection } from '../common/connection';
|
|
20
|
-
import { PluginMessageReader } from '../common/plugin-message-reader';
|
|
21
|
-
import { PluginMessageWriter } from '../common/plugin-message-writer';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Implementation of connection system of the plugin API.
|
|
25
|
-
* It allows to communicate with main side to send and read messages.
|
|
26
|
-
*/
|
|
27
|
-
export class ConnectionExtImpl implements ConnectionExt {
|
|
28
|
-
private proxy: ConnectionMain;
|
|
29
|
-
private connections = new Map<string, PluginConnection>();
|
|
30
|
-
constructor(rpc: RPCProtocol) {
|
|
31
|
-
this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.CONNECTION_MAIN);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Gets the connection between plugin by id and sends string message to it.
|
|
36
|
-
*
|
|
37
|
-
* @param id connection's id
|
|
38
|
-
* @param message incoming message
|
|
39
|
-
*/
|
|
40
|
-
async $sendMessage(id: string, message: string): Promise<void> {
|
|
41
|
-
if (this.connections.has(id)) {
|
|
42
|
-
this.connections.get(id)!.reader.readMessage(message);
|
|
43
|
-
} else {
|
|
44
|
-
console.warn('It is not possible to read message. Connection missed.');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Instantiates a new connection by the given id.
|
|
50
|
-
* @param id the connection id
|
|
51
|
-
*/
|
|
52
|
-
async $createConnection(id: string): Promise<void> {
|
|
53
|
-
await this.doEnsureConnection(id);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Deletes a connection.
|
|
58
|
-
* @param id the connection id
|
|
59
|
-
*/
|
|
60
|
-
async $deleteConnection(id: string): Promise<void> {
|
|
61
|
-
this.connections.delete(id);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns existed connection or creates a new one.
|
|
66
|
-
* @param id the connection id
|
|
67
|
-
*/
|
|
68
|
-
async ensureConnection(id: string): Promise<PluginConnection> {
|
|
69
|
-
const connection = await this.doEnsureConnection(id);
|
|
70
|
-
this.proxy.$createConnection(id);
|
|
71
|
-
return connection;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Returns existed connection or creates a new one.
|
|
76
|
-
* @param id the connection id
|
|
77
|
-
*/
|
|
78
|
-
async doEnsureConnection(id: string): Promise<PluginConnection> {
|
|
79
|
-
const connection = this.connections.get(id) || await this.doCreateConnection(id);
|
|
80
|
-
this.connections.set(id, connection);
|
|
81
|
-
return connection;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
protected async doCreateConnection(id: string): Promise<PluginConnection> {
|
|
85
|
-
const reader = new PluginMessageReader();
|
|
86
|
-
const writer = new PluginMessageWriter(id, this.proxy);
|
|
87
|
-
return new PluginConnection(
|
|
88
|
-
reader,
|
|
89
|
-
writer,
|
|
90
|
-
() => {
|
|
91
|
-
this.connections.delete(id);
|
|
92
|
-
this.proxy.$deleteConnection(id);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|