Search in sources :

Example 1 with ProjectInfo

use of com.redhat.qute.commons.ProjectInfo in project quarkus-ls by redhat-developer.

the class QuteIndexerTest method createProject.

private static QuteProject createProject() {
    ProjectInfo projectInfo = new ProjectInfo("test-qute", "src/test/resources/templates");
    MockQuteProjectRegistry registry = new MockQuteProjectRegistry();
    return new QuteProject(projectInfo, registry, registry);
}
Also used : ProjectInfo(com.redhat.qute.commons.ProjectInfo) QuteProject(com.redhat.qute.project.QuteProject) MockQuteProjectRegistry(com.redhat.qute.project.MockQuteProjectRegistry)

Example 2 with ProjectInfo

use of com.redhat.qute.commons.ProjectInfo in project quarkus-ls by redhat-developer.

the class QuteGenerateTemplateContentCommandHandlerTest method createJavaDataModelCache.

private JavaDataModelCache createJavaDataModelCache() {
    QuteProjectRegistry projectRegistry = new MockQuteProjectRegistry();
    projectRegistry.getProject(new ProjectInfo(PROJECT_URI, TEMPLATE_BASE_DIR));
    return new JavaDataModelCache(projectRegistry);
}
Also used : JavaDataModelCache(com.redhat.qute.project.datamodel.JavaDataModelCache) QuteProjectRegistry(com.redhat.qute.project.QuteProjectRegistry) MockQuteProjectRegistry(com.redhat.qute.project.MockQuteProjectRegistry) ProjectInfo(com.redhat.qute.commons.ProjectInfo) MockQuteProjectRegistry(com.redhat.qute.project.MockQuteProjectRegistry)

Example 3 with ProjectInfo

use of com.redhat.qute.commons.ProjectInfo in project quarkus-ls by redhat-developer.

the class JDTQuteProjectUtils method getProjectInfo.

public static ProjectInfo getProjectInfo(IJavaProject javaProject) {
    IProject project = javaProject.getProject();
    String projectUri = getProjectURI(project);
    String templateBaseDir = project.getFile(TEMPLATES_BASE_DIR).getLocationURI().toString();
    return new ProjectInfo(projectUri, templateBaseDir);
}
Also used : ProjectInfo(com.redhat.qute.commons.ProjectInfo) IProject(org.eclipse.core.resources.IProject)

Example 4 with ProjectInfo

use of com.redhat.qute.commons.ProjectInfo in project quarkus-ls by redhat-developer.

the class QuteTextDocument method getProjectInfoFuture.

public CompletableFuture<ProjectInfo> getProjectInfoFuture() {
    if (projectInfoFuture == null || projectInfoFuture.isCompletedExceptionally() || projectInfoFuture.isCancelled()) {
        QuteProjectParams params = new QuteProjectParams(super.getUri());
        projectInfoFuture = // 
        projectInfoProvider.getProjectInfo(params).thenApply(projectInfo -> {
            if (projectInfo != null && this.projectUri == null) {
                QuteProject project = projectRegistry.getProject(projectInfo);
                this.projectUri = projectInfo.getUri();
                this.templateId = project.getTemplateId(templatePath);
                projectRegistry.onDidOpenTextDocument(this);
            }
            return projectInfo;
        });
    }
    return projectInfoFuture;
}
Also used : Template(com.redhat.qute.parser.template.Template) BiFunction(java.util.function.BiFunction) QuteProjectParams(com.redhat.qute.commons.QuteProjectParams) TemplateProvider(com.redhat.qute.project.TemplateProvider) CompletableFuture(java.util.concurrent.CompletableFuture) QuteProject(com.redhat.qute.project.QuteProject) ProjectInfo(com.redhat.qute.commons.ProjectInfo) TextDocument(com.redhat.qute.ls.commons.TextDocument) CancelChecker(org.eclipse.lsp4j.jsonrpc.CancelChecker) QuteProjectRegistry(com.redhat.qute.project.QuteProjectRegistry) TextDocumentItem(org.eclipse.lsp4j.TextDocumentItem) ModelTextDocument(com.redhat.qute.ls.commons.ModelTextDocument) FileUtils.createPath(com.redhat.qute.utils.FileUtils.createPath) QuteProjectInfoProvider(com.redhat.qute.ls.api.QuteProjectInfoProvider) Path(java.nio.file.Path) QuteProjectParams(com.redhat.qute.commons.QuteProjectParams) QuteProject(com.redhat.qute.project.QuteProject)

Example 5 with ProjectInfo

use of com.redhat.qute.commons.ProjectInfo in project quarkus-ls by redhat-developer.

the class QuteAssert method createTemplate.

private static Template createTemplate(String value, String fileUri, String projectUri, String templateBaseDir, QuteProjectRegistry projectRegistry) {
    Template template = TemplateParser.parse(value, fileUri != null ? fileUri : FILE_URI);
    template.setProjectUri(projectUri);
    projectRegistry.getProject(new ProjectInfo(projectUri, templateBaseDir));
    template.setProjectRegistry(projectRegistry);
    return template;
}
Also used : ProjectInfo(com.redhat.qute.commons.ProjectInfo) Template(com.redhat.qute.parser.template.Template)

Aggregations

ProjectInfo (com.redhat.qute.commons.ProjectInfo)6 QuteProject (com.redhat.qute.project.QuteProject)3 Template (com.redhat.qute.parser.template.Template)2 MockQuteProjectRegistry (com.redhat.qute.project.MockQuteProjectRegistry)2 QuteProjectRegistry (com.redhat.qute.project.QuteProjectRegistry)2 QuteProjectParams (com.redhat.qute.commons.QuteProjectParams)1 QuteProjectInfoProvider (com.redhat.qute.ls.api.QuteProjectInfoProvider)1 ModelTextDocument (com.redhat.qute.ls.commons.ModelTextDocument)1 TextDocument (com.redhat.qute.ls.commons.TextDocument)1 TemplateProvider (com.redhat.qute.project.TemplateProvider)1 JavaDataModelCache (com.redhat.qute.project.datamodel.JavaDataModelCache)1 FileUtils.createPath (com.redhat.qute.utils.FileUtils.createPath)1 Path (java.nio.file.Path)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 BiFunction (java.util.function.BiFunction)1 IProject (org.eclipse.core.resources.IProject)1 TextDocumentItem (org.eclipse.lsp4j.TextDocumentItem)1 CancelChecker (org.eclipse.lsp4j.jsonrpc.CancelChecker)1