use of org.eclipse.lsp4j.WorkspaceFolder in project eclipse.jdt.ls by eclipse.
the class WorkspaceFolderChangeHandler method update.
public void update(DidChangeWorkspaceFoldersParams params) {
final Collection<IPath> addedRootPaths = new ArrayList<>();
final Collection<IPath> removedRootPaths = new ArrayList<>();
for (WorkspaceFolder folder : params.getEvent().getAdded()) {
IPath rootPath = ResourceUtils.filePathFromURI(folder.getUri());
if (rootPath != null) {
addedRootPaths.add(rootPath);
}
}
for (WorkspaceFolder folder : params.getEvent().getRemoved()) {
IPath rootPath = ResourceUtils.filePathFromURI(folder.getUri());
if (rootPath != null) {
removedRootPaths.add(rootPath);
}
}
projectManager.updateWorkspaceFolders(addedRootPaths, removedRootPaths);
}
use of org.eclipse.lsp4j.WorkspaceFolder in project sts4 by spring-projects.
the class SpringIndexer method scanFiles.
private void scanFiles(WorkspaceFolder directory) {
try {
Map<Optional<IJavaProject>, List<String>> projects = Files.walk(Paths.get(new URI(directory.getUri()))).filter(path -> path.getFileName().toString().endsWith(".java")).filter(Files::isRegularFile).map(path -> path.toAbsolutePath().toString()).collect(Collectors.groupingBy((javaFile) -> projectFinder.find(new TextDocumentIdentifier(new File(javaFile).toURI().toString()))));
projects.forEach((maybeProject, files) -> maybeProject.ifPresent(project -> scanProject(project, files.toArray(new String[0]))));
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.eclipse.lsp4j.WorkspaceFolder in project sts4 by spring-projects.
the class SpringIndexerHarness method wsFolder.
public Collection<WorkspaceFolder> wsFolder(File directory) {
if (directory != null) {
WorkspaceFolder folder = new WorkspaceFolder();
folder.setName(directory.getName());
folder.setUri(directory.toURI().toString());
return ImmutableList.of(folder);
}
return ImmutableList.of();
}
use of org.eclipse.lsp4j.WorkspaceFolder in project xtext-core by eclipse.
the class IndexOnlyProjectTest method getServerModule.
@Override
public com.google.inject.Module getServerModule() {
return Modules2.mixin(new ServerModule(), new Module() {
@Override
public void configure(Binder binder) {
binder.bind(IMultiRootWorkspaceConfigFactory.class).toInstance(new MultiRootWorkspaceConfigFactory() {
@Override
public void addProjectsForWorkspaceFolder(WorkspaceConfig workspaceConfig, WorkspaceFolder workspaceFolder, Set<String> existingNames) {
String uri = null;
if (workspaceFolder != null) {
uri = workspaceFolder.getUri();
}
if (uri != null) {
FileProjectConfig project = new FileProjectConfig(getUriExtensions().toUri(workspaceFolder.getUri()), getUniqueProjectName(workspaceFolder.getName(), existingNames)) {
@Override
public boolean isIndexOnly() {
return true;
}
};
project.addSourceFolder(".");
workspaceConfig.addProject(project);
}
}
});
}
});
}
use of org.eclipse.lsp4j.WorkspaceFolder in project xtext-core by eclipse.
the class WorkspaceManager method initialize.
/**
* Initialize a workspace at the given location.
*
* @param baseDir
* the location
* @param issueAcceptor
* the issue acceptor
* @param cancelIndicator
* allows to cancel the initialization
*/
public void initialize(URI baseDir, Procedure2<? super URI, ? super Iterable<Issue>> issueAcceptor, CancelIndicator cancelIndicator) {
WorkspaceFolder workspaceFolder = new WorkspaceFolder(uriExtensions.toUriString(baseDir), "");
initialize(Collections.singletonList(workspaceFolder), issueAcceptor, cancelIndicator);
}
Aggregations