use of org.eclipse.lsp4j.FileChangeType in project xtext-core by eclipse.
the class LanguageServerImpl method didChangeWatchedFiles.
@Override
public void didChangeWatchedFiles(final DidChangeWatchedFilesParams params) {
final Function0<BuildManager.Buildable> _function = () -> {
BuildManager.Buildable _xblockexpression = null;
{
final ArrayList<URI> dirtyFiles = CollectionLiterals.<URI>newArrayList();
final ArrayList<URI> deletedFiles = CollectionLiterals.<URI>newArrayList();
List<FileEvent> _changes = params.getChanges();
for (final FileEvent fileEvent : _changes) {
FileChangeType _type = fileEvent.getType();
boolean _tripleEquals = (_type == FileChangeType.Deleted);
if (_tripleEquals) {
URI _uri = this._uriExtensions.toUri(fileEvent.getUri());
deletedFiles.add(_uri);
} else {
URI _uri_1 = this._uriExtensions.toUri(fileEvent.getUri());
dirtyFiles.add(_uri_1);
}
}
_xblockexpression = this.workspaceManager.didChangeFiles(dirtyFiles, deletedFiles);
}
return _xblockexpression;
};
final Function2<CancelIndicator, BuildManager.Buildable, List<IResourceDescription.Delta>> _function_1 = (CancelIndicator cancelIndicator, BuildManager.Buildable buildable) -> {
return buildable.build(cancelIndicator);
};
this.requestManager.<BuildManager.Buildable, List<IResourceDescription.Delta>>runWrite(_function, _function_1);
}
use of org.eclipse.lsp4j.FileChangeType in project sts4 by spring-projects.
the class ResourceListener method createFileEventFromDelta.
private static FileEvent createFileEventFromDelta(IResourceDelta delta) {
URI locationURI = LSPEclipseUtils.toUri(delta.getResource());
if (locationURI == null) {
return null;
}
FileChangeType changeType = null;
if (delta.getKind() == IResourceDelta.ADDED) {
changeType = FileChangeType.Created;
} else if (delta.getKind() == IResourceDelta.CHANGED) {
changeType = FileChangeType.Changed;
} else if (delta.getKind() == IResourceDelta.REMOVED) {
changeType = FileChangeType.Deleted;
} else {
// $NON-NLS-1$
throw new IllegalStateException("Unsupported resource delta kind: " + delta.getKind());
}
return new FileEvent(locationURI.toString(), changeType);
}
Aggregations