Class GenerateXMLFromGrammarCommand

java.lang.Object
org.eclipse.lemminx.extensions.contentmodel.commands.GenerateXMLFromGrammarCommand
All Implemented Interfaces:
IXMLCommandService.IDelegateCommandHandler

public class GenerateXMLFromGrammarCommand extends Object implements IXMLCommandService.IDelegateCommandHandler
XML Command "xml.grammar.generate" to generate an XML document from a given grammar (XSD, DTD, RelaxNG, etc.) and a root element name.

The command parameters ExecuteCommandParams must be filled with 2 or 3 parameters:

  • grammar URI (String) : the grammar file URI.
  • root element name (String) : the local name of the root element to generate.
  • generation settings (optional, XMLGenerationSettings) : non-persistent settings overriding the persistent ones (e.g. from a wizard). If not provided, persistent settings from client configuration are used, including profile resolution.
  • Field Details

  • Constructor Details

  • Method Details

    • updateContentModelSettings

      public void updateContentModelSettings(ContentModelSettings contentModelSettings)
      Updates the persistent content model settings (called when client configuration changes).
      Parameters:
      contentModelSettings - the content model settings.
    • executeCommand

      public Object executeCommand(org.eclipse.lsp4j.ExecuteCommandParams params, SharedSettings sharedSettings, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) throws Exception
      Description copied from interface: IXMLCommandService.IDelegateCommandHandler
      Executes a command. The return value can be either a direct result object, or a CompletableFuture for asynchronous commands (e.g. when downloading a remote resource). When a CompletableFuture is returned, the framework will resolve it before sending the response to the client.
      Specified by:
      executeCommand in interface IXMLCommandService.IDelegateCommandHandler
      Parameters:
      params - command execution parameters
      sharedSettings - the shared settings.
      cancelChecker - check if cancel has been requested
      Returns:
      the result of the command, or a CompletableFuture that resolves to the result for async commands
      Throws:
      Exception - the unhandled exception will be wrapped in org.eclipse.lsp4j.jsonrpc.ResponseErrorException and be wired back to the JSON-RPC protocol caller