@hydranium/glsp-client-theia 1.0.0-next.10
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 +21 -0
- package/README.md +134 -0
- package/lib/browser/action-dispatcher.d.ts +85 -0
- package/lib/browser/action-dispatcher.d.ts.map +1 -0
- package/lib/browser/action-dispatcher.js +238 -0
- package/lib/browser/action-dispatcher.js.map +1 -0
- package/lib/browser/client-contribution.d.ts +53 -0
- package/lib/browser/client-contribution.d.ts.map +1 -0
- package/lib/browser/client-contribution.js +111 -0
- package/lib/browser/client-contribution.js.map +1 -0
- package/lib/browser/diagram-loader.d.ts +123 -0
- package/lib/browser/diagram-loader.d.ts.map +1 -0
- package/lib/browser/diagram-loader.js +153 -0
- package/lib/browser/diagram-loader.js.map +1 -0
- package/lib/browser/diagram-only-marker-manager.d.ts +28 -0
- package/lib/browser/diagram-only-marker-manager.d.ts.map +1 -0
- package/lib/browser/diagram-only-marker-manager.js +44 -0
- package/lib/browser/diagram-only-marker-manager.js.map +1 -0
- package/lib/browser/diagram-widget.d.ts +97 -0
- package/lib/browser/diagram-widget.d.ts.map +1 -0
- package/lib/browser/diagram-widget.js +172 -0
- package/lib/browser/diagram-widget.js.map +1 -0
- package/lib/browser/glsp-client-theia-module.d.ts +40 -0
- package/lib/browser/glsp-client-theia-module.d.ts.map +1 -0
- package/lib/browser/glsp-client-theia-module.js +46 -0
- package/lib/browser/glsp-client-theia-module.js.map +1 -0
- package/lib/browser/glsp-diagram-manager.d.ts +46 -0
- package/lib/browser/glsp-diagram-manager.d.ts.map +1 -0
- package/lib/browser/glsp-diagram-manager.js +66 -0
- package/lib/browser/glsp-diagram-manager.js.map +1 -0
- package/lib/browser/glsp-message-service.d.ts +59 -0
- package/lib/browser/glsp-message-service.d.ts.map +1 -0
- package/lib/browser/glsp-message-service.js +97 -0
- package/lib/browser/glsp-message-service.js.map +1 -0
- package/lib/browser/glsp-theia-frontend-module.d.ts +110 -0
- package/lib/browser/glsp-theia-frontend-module.d.ts.map +1 -0
- package/lib/browser/glsp-theia-frontend-module.js +133 -0
- package/lib/browser/glsp-theia-frontend-module.js.map +1 -0
- package/lib/browser/hidden-bounds-updater.d.ts +122 -0
- package/lib/browser/hidden-bounds-updater.d.ts.map +1 -0
- package/lib/browser/hidden-bounds-updater.js +207 -0
- package/lib/browser/hidden-bounds-updater.js.map +1 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts +52 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.d.ts.map +1 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.js +72 -0
- package/lib/browser/hydranium-glsp-diagram-configuration.js.map +1 -0
- package/lib/browser/index.d.ts +20 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +38 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +39 -0
- package/lib/index.js.map +1 -0
- package/lib/node/connection-container-module.d.ts +22 -0
- package/lib/node/connection-container-module.d.ts.map +1 -0
- package/lib/node/connection-container-module.js +36 -0
- package/lib/node/connection-container-module.js.map +1 -0
- package/lib/node/glsp-server-connection-handler.d.ts +49 -0
- package/lib/node/glsp-server-connection-handler.d.ts.map +1 -0
- package/lib/node/glsp-server-connection-handler.js +64 -0
- package/lib/node/glsp-server-connection-handler.js.map +1 -0
- package/lib/node/index.d.ts +11 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +28 -0
- package/lib/node/index.js.map +1 -0
- package/lib/testing/bind-recorder.d.ts +67 -0
- package/lib/testing/bind-recorder.d.ts.map +1 -0
- package/lib/testing/bind-recorder.js +72 -0
- package/lib/testing/bind-recorder.js.map +1 -0
- package/lib/testing/index.d.ts +10 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +30 -0
- package/lib/testing/index.js.map +1 -0
- package/package.json +114 -0
- package/src/browser/action-dispatcher.ts +257 -0
- package/src/browser/client-contribution.ts +100 -0
- package/src/browser/diagram-loader.ts +173 -0
- package/src/browser/diagram-only-marker-manager.ts +33 -0
- package/src/browser/diagram-widget.ts +178 -0
- package/src/browser/glsp-client-theia-module.ts +54 -0
- package/src/browser/glsp-diagram-manager.ts +67 -0
- package/src/browser/glsp-message-service.ts +90 -0
- package/src/browser/glsp-theia-frontend-module.ts +157 -0
- package/src/browser/hidden-bounds-updater.ts +212 -0
- package/src/browser/hydranium-glsp-diagram-configuration.ts +63 -0
- package/src/browser/index.ts +22 -0
- package/src/index.ts +23 -0
- package/src/node/connection-container-module.ts +34 -0
- package/src/node/glsp-server-connection-handler.ts +69 -0
- package/src/node/index.ts +12 -0
- package/src/testing/bind-recorder.ts +126 -0
- package/src/testing/index.ts +15 -0
- package/style/diagram-loading.css +67 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
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;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HydraniumGlspDiagramWidget = exports.DIAGRAM_LOADING_FAILED_CLASS = exports.DIAGRAM_LOADING_CLASS = void 0;
|
|
18
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
19
|
+
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const diagram_loader_1 = require("./diagram-loader");
|
|
22
|
+
// Shipped by this package rather than left to adopters: an overlay whose
|
|
23
|
+
// stylesheet was forgotten is an unstyled div in normal flow, which is a silent
|
|
24
|
+
// failure. Adopters override individual rules from their own stylesheet.
|
|
25
|
+
require("../../style/diagram-loading.css");
|
|
26
|
+
/** Class on the overlay root. Adopters style / override via this contract. */
|
|
27
|
+
exports.DIAGRAM_LOADING_CLASS = 'hydranium-diagram-loading';
|
|
28
|
+
/** Added to the overlay root when it switches from pending to reporting a
|
|
29
|
+
* failure, so the spinner can be hidden and the text restyled from CSS alone. */
|
|
30
|
+
exports.DIAGRAM_LOADING_FAILED_CLASS = `${exports.DIAGRAM_LOADING_CLASS}-failed`;
|
|
31
|
+
/**
|
|
32
|
+
* `GLSPDiagramWidget` that covers the canvas with a spinner until the diagram
|
|
33
|
+
* load reaches a terminal state.
|
|
34
|
+
*
|
|
35
|
+
* **Why.** GLSP renders nothing until the first model arrives, so opening a
|
|
36
|
+
* diagram shows a blank tab for the whole round trip — long enough on a large
|
|
37
|
+
* model to read as a broken editor rather than a slow one.
|
|
38
|
+
*
|
|
39
|
+
* **How the pending state is sourced.** From {@link HydraniumDiagramLoader}, not
|
|
40
|
+
* from `actionDispatcher.onceModelInitialized()`. The loader settles on failure
|
|
41
|
+
* as well as on success, and it does so even when its own error-reporting
|
|
42
|
+
* dispatch throws; `onceModelInitialized()` simply never settles on a failed
|
|
43
|
+
* load. That distinction is not academic here: this overlay is opaque and covers
|
|
44
|
+
* the widget node, while GLSP's `StatusOverlay` — where the loader reports the
|
|
45
|
+
* failure — mounts *inside* the diagram's base div. Keyed on model
|
|
46
|
+
* initialization, a failed load would leave a spinner turning on top of the
|
|
47
|
+
* error message explaining it. Keyed on the loader, exactly one component decides
|
|
48
|
+
* whether the canvas is pending and the two mechanisms compose instead of
|
|
49
|
+
* competing.
|
|
50
|
+
*
|
|
51
|
+
* **The one case where this overlay reports the failure itself.** When
|
|
52
|
+
* `DiagramLoadFailure.surfaced` is `false` the loader could not dispatch its
|
|
53
|
+
* `StatusAction` — the action dispatcher was what failed — so the status overlay
|
|
54
|
+
* shows nothing. Uncovering the canvas would then leave a blank diagram whose only
|
|
55
|
+
* explanation is a line in the Output channel. In that case, and only that case,
|
|
56
|
+
* the overlay stays up and swaps the spinner for the error text.
|
|
57
|
+
*
|
|
58
|
+
* Bound unconditionally by `AbstractHydraniumGlspTheiaFrontendModule`. To opt out,
|
|
59
|
+
* override {@link showLoadingOverlay} to a no-op; to change what is rendered,
|
|
60
|
+
* override {@link createLoadingOverlay} or {@link loadingLabel}.
|
|
61
|
+
*/
|
|
62
|
+
let HydraniumGlspDiagramWidget = class HydraniumGlspDiagramWidget extends theia_integration_1.GLSPDiagramWidget {
|
|
63
|
+
loadingOverlay;
|
|
64
|
+
onAfterAttach(msg) {
|
|
65
|
+
// Before `super`, which is what starts the load on first attach — so the
|
|
66
|
+
// overlay is already up when the round trip begins.
|
|
67
|
+
this.showLoadingOverlay();
|
|
68
|
+
super.onAfterAttach(msg);
|
|
69
|
+
}
|
|
70
|
+
dispose() {
|
|
71
|
+
this.hideLoadingOverlay();
|
|
72
|
+
super.dispose();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Cover the canvas until the load settles.
|
|
76
|
+
*
|
|
77
|
+
* Nothing is created unless there is a signal to take it down again: no
|
|
78
|
+
* overlay without a framework loader, and none when the load has already
|
|
79
|
+
* settled — re-attaching a loaded diagram (a tab switch) skips it entirely
|
|
80
|
+
* rather than creating and immediately removing one, so there is no flash.
|
|
81
|
+
*/
|
|
82
|
+
showLoadingOverlay() {
|
|
83
|
+
if (this.loadingOverlay) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const loader = this.hydraniumDiagramLoader;
|
|
87
|
+
if (!loader || loader.loadOutcome !== undefined) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.loadingOverlay = this.createLoadingOverlay();
|
|
91
|
+
this.node.appendChild(this.loadingOverlay);
|
|
92
|
+
// Both arms: `onceLoadSettled` never rejects, but a widget must not be able
|
|
93
|
+
// to strand an overlay if that ever changes — a rejection is treated as an
|
|
94
|
+
// outcome it cannot report, which is the safe reading.
|
|
95
|
+
loader.onceLoadSettled().then(outcome => this.onLoadSettled(outcome), () => this.hideLoadingOverlay());
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Take the overlay down, or keep it as the failure's only reporter.
|
|
99
|
+
*
|
|
100
|
+
* The overlay is retained ONLY for a failure the loader could not surface;
|
|
101
|
+
* anything else uncovers the canvas, so a load that failed *and was reported*
|
|
102
|
+
* reveals GLSP's status overlay rather than double-reporting on top of it.
|
|
103
|
+
*/
|
|
104
|
+
onLoadSettled(outcome) {
|
|
105
|
+
if (outcome.status === 'failed' && !outcome.surfaced) {
|
|
106
|
+
this.showLoadFailure(outcome.error);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.hideLoadingOverlay();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Repurpose the pending overlay in place as a failure report: same node, so
|
|
113
|
+
* there is no removal-then-insertion flicker, plus a marker class so the
|
|
114
|
+
* spinner can be hidden from CSS.
|
|
115
|
+
*
|
|
116
|
+
* The wording is {@link HydraniumDiagramLoader.loadFailureLabel}'s, so an
|
|
117
|
+
* adopter rewording a load failure reaches every surface that reports it.
|
|
118
|
+
* Without the framework loader there is no failure to render, so its absence
|
|
119
|
+
* is a no-op rather than a fallback wording.
|
|
120
|
+
*/
|
|
121
|
+
showLoadFailure(error) {
|
|
122
|
+
const overlay = this.loadingOverlay;
|
|
123
|
+
const loader = this.hydraniumDiagramLoader;
|
|
124
|
+
if (!overlay || !loader) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
overlay.classList.add(exports.DIAGRAM_LOADING_FAILED_CLASS);
|
|
128
|
+
const label = overlay.querySelector(`.${exports.DIAGRAM_LOADING_CLASS}-label`);
|
|
129
|
+
if (label) {
|
|
130
|
+
label.textContent = loader.loadFailureLabel(error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
hideLoadingOverlay() {
|
|
134
|
+
this.loadingOverlay?.remove();
|
|
135
|
+
this.loadingOverlay = undefined;
|
|
136
|
+
}
|
|
137
|
+
/** Build the overlay DOM. Override to change the wording or add content; the
|
|
138
|
+
* root must carry {@link DIAGRAM_LOADING_CLASS} for the shipped styling, and
|
|
139
|
+
* the label element its `-label` class so {@link showLoadFailure} finds it. */
|
|
140
|
+
createLoadingOverlay() {
|
|
141
|
+
const overlay = document.createElement('div');
|
|
142
|
+
overlay.className = exports.DIAGRAM_LOADING_CLASS;
|
|
143
|
+
const spinner = document.createElement('div');
|
|
144
|
+
spinner.className = `${exports.DIAGRAM_LOADING_CLASS}-spinner`;
|
|
145
|
+
const label = document.createElement('div');
|
|
146
|
+
label.className = `${exports.DIAGRAM_LOADING_CLASS}-label`;
|
|
147
|
+
label.textContent = this.loadingLabel;
|
|
148
|
+
overlay.appendChild(spinner);
|
|
149
|
+
overlay.appendChild(label);
|
|
150
|
+
return overlay;
|
|
151
|
+
}
|
|
152
|
+
/** Text shown under the spinner. Override for a domain-specific wording; the
|
|
153
|
+
* failure text that replaces it is {@link showLoadFailure}'s. */
|
|
154
|
+
get loadingLabel() {
|
|
155
|
+
return 'Loading diagram...';
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The framework loader for this diagram, or `undefined` when the container
|
|
159
|
+
* binds a plain `DiagramLoader`. Absence degrades to "no overlay" rather than
|
|
160
|
+
* an error: a head that opted out of the framework loader has no settle signal
|
|
161
|
+
* to key on, and an overlay that never comes down is worse than none.
|
|
162
|
+
*/
|
|
163
|
+
get hydraniumDiagramLoader() {
|
|
164
|
+
const loader = this.diContainer.get(client_1.DiagramLoader);
|
|
165
|
+
return loader instanceof diagram_loader_1.HydraniumDiagramLoader ? loader : undefined;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
exports.HydraniumGlspDiagramWidget = HydraniumGlspDiagramWidget;
|
|
169
|
+
exports.HydraniumGlspDiagramWidget = HydraniumGlspDiagramWidget = __decorate([
|
|
170
|
+
(0, inversify_1.injectable)()
|
|
171
|
+
], HydraniumGlspDiagramWidget);
|
|
172
|
+
//# sourceMappingURL=diagram-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagram-widget.js","sourceRoot":"","sources":["../../src/browser/diagram-widget.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type ChannelLoggerOptions } from '@hydranium/client-theia/lib/browser';
|
|
10
|
+
import { type BindingContext } from '@eclipse-glsp/client';
|
|
11
|
+
/** Options for `createGlspClientTheiaModule`. The adopter supplies the channel
|
|
12
|
+
* logger configuration ({@link ChannelLoggerOptions} — a `channelName`, and
|
|
13
|
+
* optionally a `component` label); the framework owns the dispatcher type and
|
|
14
|
+
* the `ChannelLogger` binding. The log threshold is not configured here — it
|
|
15
|
+
* is process-global, driven by `bindLogLevelPreference` or by
|
|
16
|
+
* `AbstractHydraniumGlspTheiaFrontendModule.logLevelPreference`. */
|
|
17
|
+
export interface GlspClientTheiaModuleOptions {
|
|
18
|
+
readonly channelLogger: ChannelLoggerOptions;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Composes the standard framework client bindings: the cross-head Output-channel
|
|
22
|
+
* logger, the instrumented action dispatcher, the failure-reporting diagram
|
|
23
|
+
* loader, the instrumented hidden-bounds updater, and the message service that
|
|
24
|
+
* drops the duplicate model-loading notification.
|
|
25
|
+
*
|
|
26
|
+
* Takes the whole {@link BindingContext} rather than `(bind, rebind)`: the
|
|
27
|
+
* message-service rebind has to know whether GLSP's `theiaNotificationModule`
|
|
28
|
+
* already bound its token, and a container-module body has the full context to
|
|
29
|
+
* hand anyway.
|
|
30
|
+
*
|
|
31
|
+
* Every binding is unconditional, with no per-feature flags. Each replaces a
|
|
32
|
+
* GLSP default with a strict superset of its behaviour, so a head that wants
|
|
33
|
+
* the original rebinds that one token back — the same one-line move this
|
|
34
|
+
* function makes.
|
|
35
|
+
*
|
|
36
|
+
* Adopter composition roots call this first; adopter-specific bindings
|
|
37
|
+
* (diagram-module rebinds, custom tools, etc.) layer on top.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createGlspClientTheiaModule(context: BindingContext, options: GlspClientTheiaModuleOptions): void;
|
|
40
|
+
//# sourceMappingURL=glsp-client-theia-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-client-theia-module.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,KAAK,cAAc,EAAgE,MAAM,sBAAsB,CAAC;AAMzH;;;;;qEAKqE;AACrE,MAAM,WAAW,4BAA4B;IAC1C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAQhH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createGlspClientTheiaModule = createGlspClientTheiaModule;
|
|
12
|
+
const browser_1 = require("@hydranium/client-theia/lib/browser");
|
|
13
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
14
|
+
const action_dispatcher_1 = require("./action-dispatcher");
|
|
15
|
+
const diagram_loader_1 = require("./diagram-loader");
|
|
16
|
+
const glsp_message_service_1 = require("./glsp-message-service");
|
|
17
|
+
const hidden_bounds_updater_1 = require("./hidden-bounds-updater");
|
|
18
|
+
/**
|
|
19
|
+
* Composes the standard framework client bindings: the cross-head Output-channel
|
|
20
|
+
* logger, the instrumented action dispatcher, the failure-reporting diagram
|
|
21
|
+
* loader, the instrumented hidden-bounds updater, and the message service that
|
|
22
|
+
* drops the duplicate model-loading notification.
|
|
23
|
+
*
|
|
24
|
+
* Takes the whole {@link BindingContext} rather than `(bind, rebind)`: the
|
|
25
|
+
* message-service rebind has to know whether GLSP's `theiaNotificationModule`
|
|
26
|
+
* already bound its token, and a container-module body has the full context to
|
|
27
|
+
* hand anyway.
|
|
28
|
+
*
|
|
29
|
+
* Every binding is unconditional, with no per-feature flags. Each replaces a
|
|
30
|
+
* GLSP default with a strict superset of its behaviour, so a head that wants
|
|
31
|
+
* the original rebinds that one token back — the same one-line move this
|
|
32
|
+
* function makes.
|
|
33
|
+
*
|
|
34
|
+
* Adopter composition roots call this first; adopter-specific bindings
|
|
35
|
+
* (diagram-module rebinds, custom tools, etc.) layer on top.
|
|
36
|
+
*/
|
|
37
|
+
function createGlspClientTheiaModule(context, options) {
|
|
38
|
+
const { bind, isBound, rebind } = context;
|
|
39
|
+
(0, browser_1.bindChannelLogger)(bind, options.channelLogger);
|
|
40
|
+
bind(action_dispatcher_1.HydraniumGlspActionDispatcher).toSelf().inSingletonScope();
|
|
41
|
+
rebind(client_1.GLSPActionDispatcher).toService(action_dispatcher_1.HydraniumGlspActionDispatcher);
|
|
42
|
+
rebind(client_1.DiagramLoader).to(diagram_loader_1.HydraniumDiagramLoader).inSingletonScope();
|
|
43
|
+
rebind(client_1.GLSPHiddenBoundsUpdater).to(hidden_bounds_updater_1.HydraniumHiddenBoundsUpdater).inSingletonScope();
|
|
44
|
+
(0, glsp_message_service_1.bindHydraniumGlspMessageService)(bind, isBound, rebind);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=glsp-client-theia-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-client-theia-module.js","sourceRoot":"","sources":["../../src/browser/glsp-client-theia-module.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAsClF,kEAQC;AA5CD,iEAAmG;AACnG,iDAAyH;AACzH,2DAAoE;AACpE,qDAA0D;AAC1D,iEAAyE;AACzE,mEAAuE;AAYvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,2BAA2B,CAAC,OAAuB,EAAE,OAAqC;IACvG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1C,IAAA,2BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/C,IAAI,CAAC,iDAA6B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAChE,MAAM,CAAC,6BAAoB,CAAC,CAAC,SAAS,CAAC,iDAA6B,CAAC,CAAC;IACtE,MAAM,CAAC,sBAAa,CAAC,CAAC,EAAE,CAAC,uCAAsB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,MAAM,CAAC,gCAAuB,CAAC,CAAC,EAAE,CAAC,oDAA4B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpF,IAAA,sDAA+B,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { GLSPDiagramManager } from '@eclipse-glsp/theia-integration';
|
|
10
|
+
import { type GLSPDiagramLanguage } from '@eclipse-glsp/theia-integration/lib/common';
|
|
11
|
+
/**
|
|
12
|
+
* `GLSPDiagramManager` subclass that derives the language-correlated getters
|
|
13
|
+
* (`fileExtensions`, `diagramType`, `contributionId`, `iconClass`) from a
|
|
14
|
+
* {@link GLSPDiagramLanguage} descriptor and the human-readable `label` from a
|
|
15
|
+
* separate adopter field — so adopters override two abstract members per
|
|
16
|
+
* manager rather than a getter apiece.
|
|
17
|
+
*
|
|
18
|
+
* Adopters subclass and provide:
|
|
19
|
+
* - {@link diagramLanguage} — wire-format identifiers + file routing
|
|
20
|
+
* - {@link managerLabel} — human-readable label shown in the open-with menu
|
|
21
|
+
*
|
|
22
|
+
* Optional override:
|
|
23
|
+
* - {@link customIconClass} — overrides the language's `iconClass`
|
|
24
|
+
* - `get id()` — manager id; defaults to nothing because manager id is
|
|
25
|
+
* typically `static readonly ID = '…'` referenced by external callers
|
|
26
|
+
* (Theia `WidgetManager` lookups). Adopter subclasses set `static ID`
|
|
27
|
+
* and override `get id()` to return it.
|
|
28
|
+
*
|
|
29
|
+
* Abstract base class with hook fields, adopter subclasses with concrete
|
|
30
|
+
* values, following the GLSP module convention. The container always
|
|
31
|
+
* constructs the adopter subclass, never the abstract base directly.
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class AbstractHydraniumGlspDiagramManager extends GLSPDiagramManager {
|
|
34
|
+
/** Wire-format identifiers + file routing for this manager's diagram type. */
|
|
35
|
+
protected abstract readonly diagramLanguage: GLSPDiagramLanguage;
|
|
36
|
+
/** Human-readable label shown in the open-with menu and editor tabs. */
|
|
37
|
+
protected abstract readonly managerLabel: string;
|
|
38
|
+
/** Optional icon-class override; takes precedence over the language's `iconClass`. */
|
|
39
|
+
protected readonly customIconClass?: string;
|
|
40
|
+
get fileExtensions(): string[];
|
|
41
|
+
get diagramType(): string;
|
|
42
|
+
get contributionId(): string;
|
|
43
|
+
get iconClass(): string;
|
|
44
|
+
get label(): string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=glsp-diagram-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-diagram-manager.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGtF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,8BACsB,mCAAoC,SAAQ,kBAAkB;IACjF,8EAA8E;IAC9E,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,mBAAmB,CAAC;IAEjE,wEAAwE;IACxE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAEjD,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAE5C,IAAa,cAAc,IAAI,MAAM,EAAE,CAEtC;IAED,IAAa,WAAW,IAAI,MAAM,CAEjC;IAED,IAAa,cAAc,IAAI,MAAM,CAEpC;IAED,IAAa,SAAS,IAAI,MAAM,CAE/B;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;CACH"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
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;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AbstractHydraniumGlspDiagramManager = void 0;
|
|
18
|
+
const client_1 = require("@eclipse-glsp/client");
|
|
19
|
+
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
/**
|
|
22
|
+
* `GLSPDiagramManager` subclass that derives the language-correlated getters
|
|
23
|
+
* (`fileExtensions`, `diagramType`, `contributionId`, `iconClass`) from a
|
|
24
|
+
* {@link GLSPDiagramLanguage} descriptor and the human-readable `label` from a
|
|
25
|
+
* separate adopter field — so adopters override two abstract members per
|
|
26
|
+
* manager rather than a getter apiece.
|
|
27
|
+
*
|
|
28
|
+
* Adopters subclass and provide:
|
|
29
|
+
* - {@link diagramLanguage} — wire-format identifiers + file routing
|
|
30
|
+
* - {@link managerLabel} — human-readable label shown in the open-with menu
|
|
31
|
+
*
|
|
32
|
+
* Optional override:
|
|
33
|
+
* - {@link customIconClass} — overrides the language's `iconClass`
|
|
34
|
+
* - `get id()` — manager id; defaults to nothing because manager id is
|
|
35
|
+
* typically `static readonly ID = '…'` referenced by external callers
|
|
36
|
+
* (Theia `WidgetManager` lookups). Adopter subclasses set `static ID`
|
|
37
|
+
* and override `get id()` to return it.
|
|
38
|
+
*
|
|
39
|
+
* Abstract base class with hook fields, adopter subclasses with concrete
|
|
40
|
+
* values, following the GLSP module convention. The container always
|
|
41
|
+
* constructs the adopter subclass, never the abstract base directly.
|
|
42
|
+
*/
|
|
43
|
+
let AbstractHydraniumGlspDiagramManager = class AbstractHydraniumGlspDiagramManager extends theia_integration_1.GLSPDiagramManager {
|
|
44
|
+
/** Optional icon-class override; takes precedence over the language's `iconClass`. */
|
|
45
|
+
customIconClass;
|
|
46
|
+
get fileExtensions() {
|
|
47
|
+
return [...this.diagramLanguage.fileExtensions];
|
|
48
|
+
}
|
|
49
|
+
get diagramType() {
|
|
50
|
+
return this.diagramLanguage.diagramType;
|
|
51
|
+
}
|
|
52
|
+
get contributionId() {
|
|
53
|
+
return this.diagramLanguage.contributionId;
|
|
54
|
+
}
|
|
55
|
+
get iconClass() {
|
|
56
|
+
return this.customIconClass ?? this.diagramLanguage.iconClass ?? (0, client_1.codiconCSSString)('type-hierarchy-sub');
|
|
57
|
+
}
|
|
58
|
+
get label() {
|
|
59
|
+
return this.managerLabel;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.AbstractHydraniumGlspDiagramManager = AbstractHydraniumGlspDiagramManager;
|
|
63
|
+
exports.AbstractHydraniumGlspDiagramManager = AbstractHydraniumGlspDiagramManager = __decorate([
|
|
64
|
+
(0, inversify_1.injectable)()
|
|
65
|
+
], AbstractHydraniumGlspDiagramManager);
|
|
66
|
+
//# sourceMappingURL=glsp-diagram-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-diagram-manager.js","sourceRoot":"","sources":["../../src/browser/glsp-diagram-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAElF,iDAAwD;AACxD,uEAAqE;AAErE,4DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAe,mCAAmC,GAAlD,MAAe,mCAAoC,SAAQ,sCAAkB;IAOjF,sFAAsF;IACnE,eAAe,CAAU;IAE5C,IAAa,cAAc;QACxB,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,IAAa,WAAW;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;IAC3C,CAAC;IAED,IAAa,cAAc;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC;IAC9C,CAAC;IAED,IAAa,SAAS;QACnB,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,IAAI,IAAA,yBAAgB,EAAC,oBAAoB,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,KAAK;QACN,OAAO,IAAI,CAAC,YAAY,CAAC;IAC5B,CAAC;CACH,CAAA;AA7BqB,kFAAmC;8CAAnC,mCAAmC;IADxD,IAAA,sBAAU,GAAE;GACS,mCAAmC,CA6BxD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type EndProgressAction, type StartProgressAction, type UpdateProgressAction } from '@eclipse-glsp/client';
|
|
10
|
+
import { TheiaGLSPMessageService } from '@eclipse-glsp/theia-integration';
|
|
11
|
+
import { type interfaces } from '@theia/core/shared/inversify';
|
|
12
|
+
/**
|
|
13
|
+
* Title of the model-loading progress report. Emitted by
|
|
14
|
+
* `@eclipse-glsp/server`'s `RequestModelActionHandler`, so it is a GLSP-protocol
|
|
15
|
+
* constant every server shares, not an adopter string — which is what makes
|
|
16
|
+
* matching on it a framework-level concern.
|
|
17
|
+
*
|
|
18
|
+
* Matched by title because `StartProgressAction` carries no kind or category to
|
|
19
|
+
* key on; the `progressId` is generated per report, so it can only be correlated
|
|
20
|
+
* after the fact (see {@link HydraniumGlspMessageService.suppressedProgressIds}).
|
|
21
|
+
*
|
|
22
|
+
* Matching an English literal fails silently — no error, no log line, just the
|
|
23
|
+
* duplicate progress popup back — so this needs keeping in step with
|
|
24
|
+
* `RequestModelActionHandler` on every GLSP bump.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MODEL_LOADING_PROGRESS_TITLE = "Model loading in progress";
|
|
27
|
+
/**
|
|
28
|
+
* Drops the Theia progress notification for diagram model loading, and only that
|
|
29
|
+
* one.
|
|
30
|
+
*
|
|
31
|
+
* `HydraniumGlspDiagramWidget`'s loading overlay already reports model loading,
|
|
32
|
+
* on the canvas the user is looking at; the notification says the same thing in a
|
|
33
|
+
* corner popup. Every other progress report is forwarded untouched, so a
|
|
34
|
+
* long-running server operation still surfaces normally.
|
|
35
|
+
*
|
|
36
|
+
* Bound unconditionally by `createGlspClientTheiaModule`, because the overlay it
|
|
37
|
+
* defers to is likewise unconditional. A head that no-ops the overlay and wants
|
|
38
|
+
* the notification back rebinds `TheiaGLSPMessageService` to GLSP's own.
|
|
39
|
+
*/
|
|
40
|
+
export declare class HydraniumGlspMessageService extends TheiaGLSPMessageService {
|
|
41
|
+
/** Ids of reports that were swallowed, so their updates and completion are
|
|
42
|
+
* dropped as well — otherwise Theia sees an update for a progress it never
|
|
43
|
+
* started. */
|
|
44
|
+
protected suppressedProgressIds: Set<string>;
|
|
45
|
+
protected startProgress(action: StartProgressAction): void;
|
|
46
|
+
protected updateProgress(action: UpdateProgressAction): void;
|
|
47
|
+
protected endProgress(action: EndProgressAction): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Replace the message service bound by GLSP's `theiaNotificationModule`.
|
|
51
|
+
*
|
|
52
|
+
* Called by `createGlspClientTheiaModule`, whose module the adopter registers
|
|
53
|
+
* after the Theia default modules — so the token is normally already bound and
|
|
54
|
+
* this rebinds. The `isBound` branch keeps it correct regardless of module order
|
|
55
|
+
* and if GLSP's default composition changes: it degrades to "we bind it
|
|
56
|
+
* ourselves" instead of an inversify error at diagram-open time.
|
|
57
|
+
*/
|
|
58
|
+
export declare function bindHydraniumGlspMessageService(bind: interfaces.Bind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void;
|
|
59
|
+
//# sourceMappingURL=glsp-message-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-message-service.d.ts","sourceRoot":"","sources":["../../src/browser/glsp-message-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,8BAA8B,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,qBACa,2BAA4B,SAAQ,uBAAuB;IACrE;;mBAEe;IACf,SAAS,CAAC,qBAAqB,cAAqB;cAEjC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;cAQhD,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;cAOlD,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAQjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,IAAI,CAMnI"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
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;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HydraniumGlspMessageService = exports.MODEL_LOADING_PROGRESS_TITLE = void 0;
|
|
18
|
+
exports.bindHydraniumGlspMessageService = bindHydraniumGlspMessageService;
|
|
19
|
+
const theia_integration_1 = require("@eclipse-glsp/theia-integration");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
/**
|
|
22
|
+
* Title of the model-loading progress report. Emitted by
|
|
23
|
+
* `@eclipse-glsp/server`'s `RequestModelActionHandler`, so it is a GLSP-protocol
|
|
24
|
+
* constant every server shares, not an adopter string — which is what makes
|
|
25
|
+
* matching on it a framework-level concern.
|
|
26
|
+
*
|
|
27
|
+
* Matched by title because `StartProgressAction` carries no kind or category to
|
|
28
|
+
* key on; the `progressId` is generated per report, so it can only be correlated
|
|
29
|
+
* after the fact (see {@link HydraniumGlspMessageService.suppressedProgressIds}).
|
|
30
|
+
*
|
|
31
|
+
* Matching an English literal fails silently — no error, no log line, just the
|
|
32
|
+
* duplicate progress popup back — so this needs keeping in step with
|
|
33
|
+
* `RequestModelActionHandler` on every GLSP bump.
|
|
34
|
+
*/
|
|
35
|
+
exports.MODEL_LOADING_PROGRESS_TITLE = 'Model loading in progress';
|
|
36
|
+
/**
|
|
37
|
+
* Drops the Theia progress notification for diagram model loading, and only that
|
|
38
|
+
* one.
|
|
39
|
+
*
|
|
40
|
+
* `HydraniumGlspDiagramWidget`'s loading overlay already reports model loading,
|
|
41
|
+
* on the canvas the user is looking at; the notification says the same thing in a
|
|
42
|
+
* corner popup. Every other progress report is forwarded untouched, so a
|
|
43
|
+
* long-running server operation still surfaces normally.
|
|
44
|
+
*
|
|
45
|
+
* Bound unconditionally by `createGlspClientTheiaModule`, because the overlay it
|
|
46
|
+
* defers to is likewise unconditional. A head that no-ops the overlay and wants
|
|
47
|
+
* the notification back rebinds `TheiaGLSPMessageService` to GLSP's own.
|
|
48
|
+
*/
|
|
49
|
+
let HydraniumGlspMessageService = class HydraniumGlspMessageService extends theia_integration_1.TheiaGLSPMessageService {
|
|
50
|
+
/** Ids of reports that were swallowed, so their updates and completion are
|
|
51
|
+
* dropped as well — otherwise Theia sees an update for a progress it never
|
|
52
|
+
* started. */
|
|
53
|
+
suppressedProgressIds = new Set();
|
|
54
|
+
startProgress(action) {
|
|
55
|
+
if (action.title === exports.MODEL_LOADING_PROGRESS_TITLE) {
|
|
56
|
+
this.suppressedProgressIds.add(action.progressId);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
super.startProgress(action);
|
|
60
|
+
}
|
|
61
|
+
updateProgress(action) {
|
|
62
|
+
if (this.suppressedProgressIds.has(action.progressId)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
super.updateProgress(action);
|
|
66
|
+
}
|
|
67
|
+
endProgress(action) {
|
|
68
|
+
// `delete` reports whether the id was suppressed and cleans the entry up in
|
|
69
|
+
// one step, so the set cannot grow across reloads.
|
|
70
|
+
if (this.suppressedProgressIds.delete(action.progressId)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
super.endProgress(action);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.HydraniumGlspMessageService = HydraniumGlspMessageService;
|
|
77
|
+
exports.HydraniumGlspMessageService = HydraniumGlspMessageService = __decorate([
|
|
78
|
+
(0, inversify_1.injectable)()
|
|
79
|
+
], HydraniumGlspMessageService);
|
|
80
|
+
/**
|
|
81
|
+
* Replace the message service bound by GLSP's `theiaNotificationModule`.
|
|
82
|
+
*
|
|
83
|
+
* Called by `createGlspClientTheiaModule`, whose module the adopter registers
|
|
84
|
+
* after the Theia default modules — so the token is normally already bound and
|
|
85
|
+
* this rebinds. The `isBound` branch keeps it correct regardless of module order
|
|
86
|
+
* and if GLSP's default composition changes: it degrades to "we bind it
|
|
87
|
+
* ourselves" instead of an inversify error at diagram-open time.
|
|
88
|
+
*/
|
|
89
|
+
function bindHydraniumGlspMessageService(bind, isBound, rebind) {
|
|
90
|
+
if (isBound(theia_integration_1.TheiaGLSPMessageService)) {
|
|
91
|
+
rebind(theia_integration_1.TheiaGLSPMessageService).to(HydraniumGlspMessageService).inSingletonScope();
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
bind(theia_integration_1.TheiaGLSPMessageService).to(HydraniumGlspMessageService).inSingletonScope();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=glsp-message-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-message-service.js","sourceRoot":"","sources":["../../src/browser/glsp-message-service.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AA4ElF,0EAMC;AA/ED,uEAA0E;AAC1E,4DAA2E;AAE3E;;;;;;;;;;;;;GAaG;AACU,QAAA,4BAA4B,GAAG,2BAA2B,CAAC;AAExE;;;;;;;;;;;;GAYG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,2CAAuB;IACrE;;mBAEe;IACL,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjC,aAAa,CAAC,MAA2B;QACzD,IAAI,MAAM,CAAC,KAAK,KAAK,oCAA4B,EAAE,CAAC;YACjD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAClD,OAAO;QACV,CAAC;QACD,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEkB,cAAc,CAAC,MAA4B;QAC3D,IAAI,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACrD,OAAO;QACV,CAAC;QACD,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAEkB,WAAW,CAAC,MAAyB;QACrD,4EAA4E;QAC5E,mDAAmD;QACnD,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACxD,OAAO;QACV,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACH,CAAA;AA7BY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CA6BvC;AAED;;;;;;;;GAQG;AACH,SAAgB,+BAA+B,CAAC,IAAqB,EAAE,OAA2B,EAAE,MAAyB;IAC1H,IAAI,OAAO,CAAC,2CAAuB,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,2CAAuB,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACtF,CAAC;SAAM,CAAC;QACL,IAAI,CAAC,2CAAuB,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpF,CAAC;AACJ,CAAC"}
|