Class CopilotIDEPlugin

java.lang.Object
com.vaadin.copilot.ide.CopilotIDEPlugin

public class CopilotIDEPlugin extends Object
IDE plugin support utility
  • Method Details

    • getInstance

      public static CopilotIDEPlugin getInstance()
      Gets instance of CopilotIDEPlugin. Project root must be set before.
      Returns:
      gets or create new instance of CopilotIDEPlugin
    • setFolderInLaunchedModule

      public static void setFolderInLaunchedModule(Path folderInLaunchedModule)
      Sets a reference folder used to find the plugin metadata file.
      Parameters:
      folderInLaunchedModule - some folder inside the module containing the launched application
    • setDevToolsInterface

      public static void setDevToolsInterface(DevToolsInterface devToolsInterface)
      Sets dev tools interface for user notifications
      Parameters:
      devToolsInterface -
    • isActive

      public boolean isActive()
      Check if plugin is active based on existing properties file
      Returns:
      true if active, false otherwise
    • getProperties

      public CopilotIDEPluginProperties getProperties()
    • getPluginInfo

      public IDEPluginInfo getPluginInfo()
    • writeFile

      public elemental.json.JsonObject writeFile(File file, String undoLabel, String content) throws IOException
      Calls plugin write file operation
      Parameters:
      file - file to be written
      undoLabel - custom undo label
      content - file content
      Throws:
      IOException - exception if command cannot be serialized
    • writeBase64File

      public elemental.json.JsonObject writeBase64File(File file, String undoLabel, String content) throws IOException
      Calls plugin writeBase64 file operation
      Parameters:
      file - file to be written
      undoLabel - custom undo label
      content - file contents as base 64 encoded string
      Throws:
      IOException - exception if command cannot be serialized
    • undo

      public elemental.json.JsonObject undo(List<String> files) throws IOException
      Performs Undo for given files
      Parameters:
      files - list of files to perform undo
      Throws:
      IOException - thrown on exception
    • redo

      public elemental.json.JsonObject redo(List<String> files) throws IOException
      Performs Redo for given files
      Parameters:
      files - list of files to perform redo
      Throws:
      IOException - thrown on exception
    • showInIde

      public elemental.json.JsonObject showInIde(String file, Integer line, Integer column) throws IOException
      Opens editor and places caret on given line and column
      Parameters:
      line - line number, use 0 as first line
      column - column number to put caret before, 0 as first column
      Throws:
      IOException - thrown on exception
    • refresh

      public elemental.json.JsonObject refresh() throws IOException
      Sends request to synchronize project files with filesystem
      Throws:
      IOException - thrown on exception
    • getSourcePaths

      public elemental.json.JsonObject getSourcePaths()
    • supports

      public boolean supports(CopilotIDEPlugin.Commands command)
      Checks if given command is supported by plugin
      Parameters:
      command - command to be checked
      Returns:
      true if supported, false otherwise
    • undoLabel

      public static String undoLabel(String operation)