use of org.springframework.ide.vscode.commons.languageserver.java.CompositeProjectOvserver in project sts4 by spring-projects.
the class BootLanguageServerParams method createFallbackProjectCache.
private static JavaProjectsService createFallbackProjectCache(SimpleLanguageServer server) {
CompositeJavaProjectFinder javaProjectFinder = new CompositeJavaProjectFinder();
MavenProjectCache mavenProjectCache = new MavenProjectCache(server, MavenCore.getDefault(), true, Paths.get(IJavaProject.PROJECT_CACHE_FOLDER));
javaProjectFinder.addJavaProjectFinder(new MavenProjectFinder(mavenProjectCache));
GradleProjectCache gradleProjectCache = new GradleProjectCache(server, GradleCore.getDefault(), true, Paths.get(IJavaProject.PROJECT_CACHE_FOLDER));
javaProjectFinder.addJavaProjectFinder(new GradleProjectFinder(gradleProjectCache));
CompositeProjectOvserver projectObserver = new CompositeProjectOvserver(Arrays.asList(mavenProjectCache, gradleProjectCache));
return new JavaProjectsService() {
@Override
public void removeListener(Listener listener) {
projectObserver.removeListener(listener);
}
@Override
public void addListener(Listener listener) {
projectObserver.addListener(listener);
}
@Override
public Optional<IJavaProject> find(TextDocumentIdentifier doc) {
return javaProjectFinder.find(doc);
}
};
}
Aggregations