Class ProjectManager

java.lang.Object
com.vaadin.copilot.ProjectManager

public class ProjectManager extends Object
Handles reading and writing files in the project
  • Constructor Details

    • ProjectManager

      public ProjectManager(ApplicationConfiguration applicationConfiguration) throws IOException
      Creates a new project manager
      Parameters:
      applicationConfiguration - the application configuration
      Throws:
      IOException - if the project folder cannot be resolved
  • Method Details

    • readFile

      public String readFile(String filename) throws IOException
      Throws:
      IOException
    • readFile

      public String readFile(File file) throws IOException
      Throws:
      IOException
    • readLines

      public List<String> readLines(File file) throws IOException
      Throws:
      IOException
    • writeFile

      public void writeFile(String filename, String undoLabel, String content) throws IOException
      Throws:
      IOException
    • writeFile

      public void writeFile(File file, String undoLabel, String content) throws IOException
      Throws:
      IOException
    • makeAbsolute

      public String makeAbsolute(String projectRelativeFilename) throws IOException
      Throws:
      IOException
    • makeRelative

      public String makeRelative(String filename) throws IOException
      Throws:
      IOException
    • getRelativeName

      public String getRelativeName(File projectFile)
      Returns the name of the file, relative to the project root.
      Parameters:
      projectFile - the file
      Returns:
      the relative name of the file
    • getFileForClass

      public File getFileForClass(Class<?> cls)
      Returns the Java file for the given class.
      Parameters:
      cls - the class
      Returns:
      the file for the class
    • getFileForClass

      public File getFileForClass(String cls)
      Returns the Java file for the given class.
      Parameters:
      cls - the class
      Returns:
      the file for the class
    • getSourceFile

      public File getSourceFile(ComponentTracker.Location location)
      Returns the Java file for the given component location.
      Parameters:
      location - the component location
      Returns:
      the file for the class where the component is used
    • getJavaSourceFolder

      public File getJavaSourceFolder()
      Returns the Java source folder.
      Returns:
      the Java source folder
    • getProjectRoot

      public File getProjectRoot()
      Returns the project root folder.
      Returns:
      the project root folder
    • getFrontendFolder

      public File getFrontendFolder()
      Returns the frontend folder.
      Returns:
      the frontend folder
    • getThemeName

      public Optional<String> getThemeName()
      Gets current theme name
      Returns:
      optional theme name
    • getThemeFolder

      public Optional<File> getThemeFolder()
      Gets current theme folder
      Returns:
      optional theme folder