blob: 4c9135c81f538f1f4d0800402f5ad91fdc0e5338 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.language.web.xtext.server.push;
import org.eclipse.xtext.web.server.IServiceContext;
import org.eclipse.xtext.web.server.XtextServiceDispatcher;
import org.eclipse.xtext.web.server.model.XtextWebDocument;
import com.google.inject.Singleton;
import tools.refinery.language.web.xtext.server.SubscribingServiceContext;
@Singleton
public class PushServiceDispatcher extends XtextServiceDispatcher {
@Override
protected XtextWebDocument getFullTextDocument(String fullText, String resourceId, IServiceContext context) {
var document = super.getFullTextDocument(fullText, resourceId, context);
if (document instanceof PushWebDocument pushWebDocument
&& context instanceof SubscribingServiceContext subscribingContext) {
pushWebDocument.addPrecomputationListener(subscribingContext.subscriber());
}
return document;
}
}
|