Java 类org.eclipse.lsp4j.ExecuteCommandParams 实例源码

项目:xtext-core    文件:ExecutableCommandRegistry.java   
public Object executeCommand(final ExecuteCommandParams params, final ILanguageServerAccess access, final CancelIndicator cancelIndicator) {
  Object result = null;
  Collection<IExecutableCommandService> _get = this.registeredCommands.get(params.getCommand());
  for (final IExecutableCommandService service : _get) {
    {
      final Object localResult = service.execute(params, access, cancelIndicator);
      if ((localResult != null)) {
        if ((result != null)) {
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("Multiple commands \'");
          String _command = params.getCommand();
          _builder.append(_command);
          _builder.append("\' have been registered. All are executed but only one result will be send back.");
          ExecutableCommandRegistry.LOG.error(_builder);
        } else {
          result = localResult;
        }
      }
    }
  }
  return result;
}
项目:SOMns-vscode    文件:SomWorkspace.java   
@Override
public CompletableFuture<Object> executeCommand(final ExecuteCommandParams params) {
  if (params.getCommand().equals(params.getCommand())) {
    SomMinitest.executeTest(som, params.getArguments());
  }
  return CompletableFuture.completedFuture(new Object());
}
项目:eclipse.jdt.ls    文件:JDTLanguageServer.java   
@Override
public CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
    logInfo(">> workspace/executeCommand");
    WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
    return computeAsync((cc) -> {
        return handler.executeCommand(params, toMonitor(cc));
    });
}
项目:eclipse.jdt.ls    文件:WorkspaceExecuteCommandHandlerTest.java   
@Test
public void testExecuteCommand() {
    WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
    ExecuteCommandParams params = new ExecuteCommandParams();
    params.setCommand("testcommand1");
    params.setArguments(Arrays.asList("hello", "world"));
    Object result = handler.executeCommand(params, monitor);
    assertEquals("testcommand1: helloworld0", result);

    params.setCommand("testcommand2");
    result = handler.executeCommand(params, monitor);
    assertEquals("testcommand2: helloworld1", result);
}
项目:eclipse.jdt.ls    文件:WorkspaceExecuteCommandHandlerTest.java   
@Test
public void testExecuteCommandNonexistingCommand() {
    expectedEx.expect(ResponseErrorException.class);
    expectedEx.expectMessage("No delegateCommandHandler for testcommand.not.existing");

    WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
    ExecuteCommandParams params = new ExecuteCommandParams();
    params.setCommand("testcommand.not.existing");
    params.setArguments(Arrays.asList("hello", "world"));
    Object result = handler.executeCommand(params, monitor);
}
项目:eclipse.jdt.ls    文件:WorkspaceExecuteCommandHandlerTest.java   
@Test
public void testExecuteCommandThrowsExceptionCommand() {
    expectedEx.expect(ResponseErrorException.class);
    expectedEx.expectMessage("Unsupported");

    WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
    ExecuteCommandParams params = new ExecuteCommandParams();
    params.setCommand("testcommand.throwexception");
    handler.executeCommand(params, monitor);
}
项目:eclipse.jdt.ls    文件:WorkspaceExecuteCommandHandlerTest.java   
@Test
public void testExecuteCommandInvalidParameters() {
    expectedEx.expect(ResponseErrorException.class);
    expectedEx.expectMessage("The workspace/executeCommand has empty params or command");

    WorkspaceExecuteCommandHandler handler = new WorkspaceExecuteCommandHandler();
    ExecuteCommandParams params = null;
    handler.executeCommand(params, monitor);
}
项目:xtext-core    文件:LanguageServerImpl.java   
@Override
public CompletableFuture<Object> executeCommand(final ExecuteCommandParams params) {
  final Function1<CancelIndicator, Object> _function = (CancelIndicator cancelIndicator) -> {
    return this.commandRegistry.executeCommand(params, this.access, cancelIndicator);
  };
  return this.requestManager.<Object>runRead(_function);
}
项目:xtext-core    文件:CommandRegistryTest.java   
@Override
public Object execute(final ExecuteCommandParams params, final ILanguageServerAccess access, final CancelIndicator cancelIndicator) {
  return Boolean.valueOf(this.commandsExecuted.add(params.getCommand()));
}
项目:SOMns-vscode    文件:WorkspaceService.java   
/**
 * The workspace/executeCommand request is sent from the client to the
 * server to trigger command execution on the server. In most cases the
 * server creates a WorkspaceEdit structure and applies the changes to the
 * workspace using the request workspace/applyEdit which is sent from the
 * server to the client.
 *
 * Registration Options: ExecuteCommandRegistrationOptions
 */
@JsonRequest
default CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
    throw new UnsupportedOperationException();
}
项目:xtext-core    文件:IExecutableCommandService.java   
/**
 * Called when the client wants to execute a registered command.
 */
public abstract Object execute(final ExecuteCommandParams params, final ILanguageServerAccess access, final CancelIndicator cancelIndicator);
项目:lsp4j    文件:WorkspaceService.java   
/**
 * The workspace/executeCommand request is sent from the client to the
 * server to trigger command execution on the server. In most cases the
 * server creates a WorkspaceEdit structure and applies the changes to the
 * workspace using the request workspace/applyEdit which is sent from the
 * server to the client.
 *
 * Registration Options: ExecuteCommandRegistrationOptions
 */
@JsonRequest
default CompletableFuture<Object> executeCommand(ExecuteCommandParams params) {
    throw new UnsupportedOperationException();
}