use of org.eclipse.xtext.util.CancelIndicator in project xtext-core by eclipse.
the class IncrementalBuilder method build.
public IncrementalBuilder.Result build(final BuildRequest request, final Function1<? super URI, ? extends IResourceServiceProvider> languages, final IResourceClusteringPolicy clusteringPolicy) {
try {
final XtextResourceSet resourceSet = request.getResourceSet();
ResourceDescriptionsData _copy = request.getState().getResourceDescriptions().copy();
Source2GeneratedMapping _copy_1 = request.getState().getFileMappings().copy();
final IndexState oldState = new IndexState(_copy, _copy_1);
CancelIndicator _cancelIndicator = request.getCancelIndicator();
final BuildContext context = new BuildContext(languages, resourceSet, oldState, clusteringPolicy, _cancelIndicator);
final IncrementalBuilder.InternalStatefulIncrementalBuilder builder = this.provider.get();
builder.context = context;
builder.request = request;
try {
return builder.launch();
} catch (final Throwable _t) {
if (_t instanceof Throwable) {
final Throwable t = (Throwable) _t;
this._operationCanceledManager.propagateIfCancelException(t);
throw t;
} else {
throw Exceptions.sneakyThrow(_t);
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.util.CancelIndicator in project xtext-core by eclipse.
the class OutdatedStateManager method newCancelIndicator.
/**
* Created a fresh CancelIndicator
*/
public CancelIndicator newCancelIndicator(final ResourceSet rs) {
CancelIndicator _xifexpression = null;
if ((rs instanceof XtextResourceSet)) {
final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue();
final int current = ((XtextResourceSet) rs).getModificationStamp();
final CancelIndicator _function = () -> {
return (cancelationAllowed && (((XtextResourceSet) rs).isOutdated() || (current != ((XtextResourceSet) rs).getModificationStamp())));
};
return _function;
} else {
_xifexpression = CancelIndicator.NullImpl;
}
return _xifexpression;
}
use of org.eclipse.xtext.util.CancelIndicator in project xtext-core by eclipse.
the class NamesAreUniqueValidator method checkUniqueNamesInResourceOf.
@Check
public void checkUniqueNamesInResourceOf(EObject eObject) {
Map<Object, Object> context = getContext();
Resource resource = eObject.eResource();
if (resource == null)
return;
CancelIndicator cancelIndicator = null;
if (context != null) {
if (context.containsKey(resource))
// resource was already validated
return;
context.put(resource, this);
cancelIndicator = (CancelIndicator) context.get(CancelableDiagnostician.CANCEL_INDICATOR);
}
doCheckUniqueNames(resource, cancelIndicator);
}
Aggregations