use of org.eclipse.xtext.resource.impl.ResourceDescriptionsData in project xtext-core by eclipse.
the class Indexer method computeAndIndexAffected.
public Indexer.IndexResult computeAndIndexAffected(final BuildRequest request, @Extension final BuildContext context) {
final ResourceDescriptionsData previousIndex = context.getOldState().getResourceDescriptions();
final ResourceDescriptionsData newIndex = request.getState().getResourceDescriptions();
final List<IResourceDescription.Delta> deltas = CollectionLiterals.<IResourceDescription.Delta>newArrayList();
boolean _isInfoEnabled = Indexer.LOG.isInfoEnabled();
if (_isInfoEnabled) {
Set<URI> _set = IterableExtensions.<URI>toSet(request.getDeletedFiles());
String _plus = ("Creating Deltas for changes. Deleted : " + _set);
String _plus_1 = (_plus + ", Changed : ");
Set<URI> _set_1 = IterableExtensions.<URI>toSet(request.getDirtyFiles());
String _plus_2 = (_plus_1 + _set_1);
String _plus_3 = (_plus_2 + ".");
Indexer.LOG.info(_plus_3);
}
deltas.addAll(this.getDeltasForDeletedResources(request, previousIndex, context));
deltas.addAll(this.getDeltasForChangedResources(request.getDirtyFiles(), previousIndex, context));
for (final IResourceDescription.Delta delta : deltas) {
newIndex.register(delta);
}
final HashSet<IResourceDescription.Delta> allDeltas = new HashSet<IResourceDescription.Delta>(deltas);
boolean _isEmpty = request.getExternalDeltas().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
allDeltas.addAll(request.getExternalDeltas());
}
final Function1<IResourceDescription, URI> _function = (IResourceDescription it) -> {
return it.getURI();
};
final Set<URI> remainingURIs = IterableExtensions.<URI>toSet(IterableExtensions.<IResourceDescription, URI>map(previousIndex.getAllResourceDescriptions(), _function));
final Function1<IResourceDescription.Delta, URI> _function_1 = (IResourceDescription.Delta it) -> {
return it.getUri();
};
remainingURIs.removeAll(ListExtensions.<IResourceDescription.Delta, URI>map(deltas, _function_1));
final Function1<URI, Boolean> _function_2 = (URI it) -> {
final IResourceDescription.Manager manager = context.getResourceServiceProvider(it).getResourceDescriptionManager();
final IResourceDescription resourceDescription = previousIndex.getResourceDescription(it);
final boolean isAffected = this.isAffected(resourceDescription, manager, allDeltas, allDeltas, newIndex);
return Boolean.valueOf(isAffected);
};
final List<URI> allAffected = IterableExtensions.<URI>toList(IterableExtensions.<URI>filter(remainingURIs, _function_2));
if ((Indexer.LOG.isInfoEnabled() && (!allAffected.isEmpty()))) {
Set<URI> _set_2 = IterableExtensions.<URI>toSet(allAffected);
String _plus_4 = ("Creating Deltas for affected resources : " + _set_2);
String _plus_5 = (_plus_4 + ".");
Indexer.LOG.info(_plus_5);
}
deltas.addAll(this.getDeltasForChangedResources(allAffected, previousIndex, context));
return new Indexer.IndexResult(deltas, newIndex);
}
use of org.eclipse.xtext.resource.impl.ResourceDescriptionsData in project xtext-core by eclipse.
the class LiveShadowedChunkedContainer method getChunk.
protected ResourceDescriptionsData getChunk() {
ResourceDescriptionsData _elvis = null;
ResourceDescriptionsData _container = this.getChunkedResourceDescriptions().getContainer(this.containerName);
if (_container != null) {
_elvis = _container;
} else {
ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(Collections.<IResourceDescription>unmodifiableList(CollectionLiterals.<IResourceDescription>newArrayList()));
_elvis = _resourceDescriptionsData;
}
return _elvis;
}
use of org.eclipse.xtext.resource.impl.ResourceDescriptionsData in project xtext-core by eclipse.
the class ProjectDescriptionBasedContainerManager method createContainer.
protected IContainer createContainer(final IResourceDescriptions resourceDescriptions, final ChunkedResourceDescriptions chunkedResourceDescriptions, final String projectName) {
IContainer _xifexpression = null;
if ((resourceDescriptions instanceof LiveShadowedChunkedResourceDescriptions)) {
_xifexpression = new LiveShadowedChunkedContainer(((LiveShadowedChunkedResourceDescriptions) resourceDescriptions), projectName);
} else {
ResourceDescriptionsData _elvis = null;
ResourceDescriptionsData _container = chunkedResourceDescriptions.getContainer(projectName);
if (_container != null) {
_elvis = _container;
} else {
Set<IResourceDescription> _emptySet = CollectionLiterals.<IResourceDescription>emptySet();
ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(_emptySet);
_elvis = _resourceDescriptionsData;
}
_xifexpression = new ResourceDescriptionsBasedContainer(_elvis);
}
return _xifexpression;
}
use of org.eclipse.xtext.resource.impl.ResourceDescriptionsData in project xtext-core by eclipse.
the class ChunkedResourceDescriptions method readExternal.
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final int numChunks = in.readInt();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, numChunks, true);
for (final Integer i : _doubleDotLessThan) {
{
final String chunkName = in.readUTF();
final int numDescriptions = in.readInt();
final ArrayList<IResourceDescription> descriptions = new ArrayList<IResourceDescription>(numDescriptions);
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, numDescriptions, true);
for (final Integer j : _doubleDotLessThan_1) {
Object _readObject = in.readObject();
descriptions.add(((IResourceDescription) _readObject));
}
ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(descriptions);
this.chunk2resourceDescriptions.put(chunkName, _resourceDescriptionsData);
}
}
}
Aggregations