项目:che
文件:ShowMessageJsonRpcTransmitter.java
public CompletableFuture<MessageActionItem> sendShowMessageRequest(
ShowMessageRequestParams requestParams) {
CompletableFuture<MessageActionItem> result = new CompletableFuture<>();
if (showMessageRequestEndpointIds.isEmpty()) {
result.complete(null);
}
for (String endpointId : endpointIds) {
requestTransmitter
.newRequest()
.endpointId(endpointId)
.methodName("window/showMessageRequest")
.paramsAsDto(requestParams)
.sendAndReceiveResultAsDto(MessageActionItem.class)
.onSuccess(
actionItem -> {
if (!result.isDone()) {
result.complete(actionItem);
}
})
.onFailure(
jsonRpcError ->
result.completeExceptionally(new Exception(jsonRpcError.getMessage())));
}
return result;
}
项目:che
文件:ShowMessageRequestTest.java
@Test
public void testName() throws Exception {
CompletableFuture<MessageActionItem> future = new CompletableFuture<>();
when(transmitter.sendShowMessageRequest(any())).thenReturn(future);
ServerInitializerImpl initializer = new ServerInitializerImpl();
CheLanguageClient client = new CheLanguageClient(eventService,transmitter,"id");
CompletableFuture<Pair<LanguageServer,InitializeResult>> initialize =
initializer.initialize(launcher,client,"/tmp");
Pair<LanguageServer,InitializeResult> resultPair = initialize.get();
server = resultPair.first;
ArgumentCaptor<ShowMessageRequestParams> captor =
ArgumentCaptor.forClass(ShowMessageRequestParams.class);
verify(transmitter,timeout(1500)).sendShowMessageRequest(captor.capture());
ShowMessageRequestParams value = captor.getValue();
assertNotNull(value);
assertEquals(value.getType(),MessageType.Error);
assertEquals(value.getMessage(),"Error Message!!!!");
}
项目:che
文件:ShowMessageRequestProcessor.java
public JsonRpcPromise<MessageActionItem> processNotificationRequest(
ShowMessageRequestParams params) {
JsonRpcPromise<MessageActionItem> result = new JsonRpcPromise<>();
MessageDialogPresenter dialogPresenter = provider.get();
dialogPresenter.show(
params.getMessage(),params.getType().toString(),params.getActions(),actionItem -> {
result
.getSuccessConsumer()
.ifPresent(consumer -> consumer.accept("ws-agent",actionItem));
});
return result;
}
项目:che
文件:ShowMessageJsonRpcReceiver.java
@Inject
private void configureReceiver(
Provider<ShowMessageProcessor> provider,RequestHandlerConfigurator configurator) {
configurator
.newConfiguration()
.methodName("window/showMessage")
.paramsAsDto(ShowMessageRequestParams.class)
.noresult()
.withConsumer(params -> provider.get().processNotification(params));
}
项目:che
文件:ShowMessageJsonRpcReceiver.java
@Inject
private void configureShowMessageRequestReceiver(
Provider<ShowMessageRequestProcessor> provider,RequestHandlerConfigurator configurator) {
configurator
.newConfiguration()
.methodName("window/showMessageRequest")
.paramsAsDto(ShowMessageRequestParams.class)
.resultAsPromiseDto(MessageActionItem.class)
.withPromise(params -> provider.get().processNotificationRequest(params));
}
项目:camel-language-server
文件:AbstractCamelLanguageServerTest.java
@Override
public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams requestParams) {
return null;
}
项目:xtext-core
文件:CommandRegistryTest.java
public CompletableFuture<MessageActionItem> showMessageRequest(final ShowMessageRequestParams requestParams) {
return this.noImpl3.showMessageRequest(requestParams);
}
项目:lsp4j
文件:MockLanguageClient.java
@Override
public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams requestParams) {
throw new UnsupportedOperationException();
}
项目:che
文件:CheLanguageClient.java
@Override
public CompletableFuture<MessageActionItem> showMessageRequest(
ShowMessageRequestParams requestParams) {
return transmitter.sendShowMessageRequest(requestParams);
}
项目:eclipse.jdt.ls
文件:JavaClientConnection.java
/**
* Sends the message to the client,to be displayed on a UI element.
* Waits for an answer from the user and returns the selected
* action.
*
* @param type
* @param msg
* @return
*/
public MessageActionItem showNotificationMessageRequest(MessageType type,String msg,List<MessageActionItem> actions){
ShowMessageRequestParams $ = new ShowMessageRequestParams();
$.setMessage(msg);
$.setType(type);
$.setActions(actions);
return client.showMessageRequest($).join();
}
项目:SOMns-vscode
文件:LanguageClient.java
/**
* The show message request is sent from a server to a client to ask the
* client to display a particular message in the user interface. In addition
* to the show message notification the request allows to pass actions and
* to wait for an answer from the client.
*/
@JsonRequest("window/showMessageRequest")
CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams requestParams);
项目:lsp4j
文件:LanguageClient.java
/**
* The show message request is sent from a server to a client to ask the
* client to display a particular message in the user interface. In addition
* to the show message notification the request allows to pass actions and
* to wait for an answer from the client.
*/
@JsonRequest("window/showMessageRequest")
CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams requestParams);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。