org.eclipse.xtext.resource.clustering.IResourceClusteringPolicy Java Examples

The following examples show how to use org.eclipse.xtext.resource.clustering.IResourceClusteringPolicy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DoUpdateImplementation.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
public DoUpdateImplementation(N4ClusteringBuilderState state, BuildData buildData,
		ResourceDescriptionsData newData, IProgressMonitor monitor, IBuildLogger buildLogger,
		IResourceLoader crossLinkingResourceLoader, IResourceClusteringPolicy clusteringPolicy) {
	this.clusteringPolicy = clusteringPolicy;
	this.crossLinkingResourceLoader = crossLinkingResourceLoader;
	this.buildLogger = buildLogger;
	this.state = state;
	this.buildData = buildData;
	this.newData = newData;
	this.progress = SubMonitor.convert(monitor);
	this.cancelMonitor = new MonitorBasedCancelIndicator(progress);
	this.toBeDeleted = buildData.getAndRemoveToBeDeleted();
	this.resourceSet = buildData.getResourceSet();
	this.newState = new CurrentDescriptions(resourceSet, newData, buildData);
	this.currentProject = state.getBuiltProject(buildData);
	this.queue = buildData.getURIQueue();
}
 
Example #2
Source File: WriteNewResourceDescriptionsImplementation.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
public WriteNewResourceDescriptionsImplementation(N4ClusteringBuilderState state, BuildData buildData,
		IResourceDescriptions oldState,
		CurrentDescriptions newState, IProgressMonitor monitor,
		IBuildLogger buildLogger,
		IResourceLoader globalIndexResourceLoader,
		IResourceClusteringPolicy clusteringPolicy, CompilerPhases compilerPhases) {
	this.compilerPhases = compilerPhases;
	this.clusteringPolicy = clusteringPolicy;
	this.globalIndexResourceLoader = globalIndexResourceLoader;
	this.state = state;
	this.buildData = buildData;
	this.oldState = oldState;
	this.newState = newState;
	this.progress = SubMonitor.convert(monitor, buildData.getToBeUpdated().size());
	this.buildLogger = buildLogger;
	this.resourceSet = buildData.getResourceSet();
	this.currentProject = state.getBuiltProject(buildData);
}
 
Example #3
Source File: N4JSClusteringBuilderConfiguration.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void configure() {
	bind(IResourceClusteringPolicy.class).to(VerboseClusteringPolicy.class);
	bind(XtextBuilder.class).to(N4JSBuildTypeTrackingBuilder.class);
	bind(IBuilderState.class).to(N4JSGenerateImmediatelyBuilderState.class).in(Scopes.SINGLETON);
	bind(IMarkerUpdater.class).to(N4JSMarkerUpdater.class);
	bind(IStorage2UriMapper.class).to(N4JSStorage2UriMapper.class);
	bind(PersistedStateProvider.class).to(ContributingResourceDescriptionPersister.class);
	bind(IBuildLogger.class).annotatedWith(BuilderState.class).to(BuilderStateLogger.class);
	bind(DirtyStateManager.class).to(PrevStateAwareDirtyStateManager.class);
	bind(IResourceLoader.class).annotatedWith(
			Names.named(ClusteringBuilderState.RESOURCELOADER_GLOBAL_INDEX)).toProvider(
					new BuildScopeAwareParallelLoaderProvider());
	bind(BuilderStateDiscarder.class);
	bind(SharedStateContributionRegistryImpl.class).to(DefaultSharedContributionOverridingRegistry.class);
	binder().install(new MyReferenceSearchResultContentProviderCustomModule());
}
 
Example #4
Source File: XIncrementalBuilder.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Run the build.
 * <p>
 * Cancellation behavior: does not throw exception but returns with a partial result.
 */
public XBuildResult build(XBuildRequest request, IResourceClusteringPolicy clusteringPolicy) {

	ResourceDescriptionsData resDescrsCopy = request.getState().getResourceDescriptions().copy();
	XSource2GeneratedMapping fileMappingsCopy = request.getState().getFileMappings().copy();
	XIndexState oldState = new XIndexState(resDescrsCopy, fileMappingsCopy);

	XtextResourceSet resourceSet = request.getResourceSet();
	XBuildContext context = new XBuildContext(languagesRegistry::getResourceServiceProvider,
			resourceSet, oldState, clusteringPolicy, request.getCancelIndicator());

	XStatefulIncrementalBuilder builder = provider.get();
	builder.setContext(context);
	builder.setRequest(request);

	return builder.launch();
}
 
Example #5
Source File: IncrementalBuilder.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Run the build.
 */
public IncrementalBuilder.Result build(BuildRequest request,
		Function1<? super URI, ? extends IResourceServiceProvider> languages,
		IResourceClusteringPolicy clusteringPolicy) {
	XtextResourceSet resourceSet = request.getResourceSet();
	IndexState oldState = new IndexState(request.getState().getResourceDescriptions().copy(),
			request.getState().getFileMappings().copy());
	BuildContext context = new BuildContext(languages, resourceSet, oldState, clusteringPolicy,
			request.getCancelIndicator());
	IncrementalBuilder.InternalStatefulIncrementalBuilder builder = provider.get();
	builder.setContext(context);
	builder.setRequest(request);
	try {
		return builder.launch();
	} catch (Throwable t) {
		operationCanceledManager.propagateIfCancelException(t);
		throw t;
	}
}
 
Example #6
Source File: GamlUiModule.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings ("unchecked")
@Override
public void configure(final Binder binder) {

	super.configure(binder);
	binder.bind(String.class).annotatedWith(
			com.google.inject.name.Names.named(XtextContentAssistProcessor.COMPLETION_AUTO_ACTIVATION_CHARS))
			.toInstance(".");
	binder.bind(IContentAssistParser.class).to((Class<? extends IContentAssistParser>) GamlParser.class);
	binder.bind(Lexer.class).annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
			.to(InternalGamlLexer.class);
	binder.bind(IResourceLoader.class).toProvider(ResourceLoaderProviders.getParallelLoader());
	binder.bind(IResourceClusteringPolicy.class).to(DynamicResourceClusteringPolicy.class);
	binder.bind(IModelRunner.class).to(ModelRunner.class);
	// binder.bind(XtextDocumentProvider.class).to(XtextDocumentProvider.class);
	binder.bind(IMarkerUpdater.class).to(GamlMarkerUpdater.class);
	binder.bind(IGamlLabelProvider.class).to(GamlLabelProvider.class);
}
 
Example #7
Source File: XBuildContext.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor.
 */
public XBuildContext(
		Function1<? super URI, ? extends IResourceServiceProvider> resourceServiceProviderProvider,
		XtextResourceSet resourceSet, XIndexState oldState,
		IResourceClusteringPolicy clusteringPolicy, CancelIndicator cancelIndicator) {
	this.resourceServiceProviderProvider = resourceServiceProviderProvider;
	this.resourceSet = resourceSet;
	this.oldState = oldState;
	this.clusteringPolicy = clusteringPolicy;
	this.cancelIndicator = cancelIndicator;
}
 
Example #8
Source File: BuildContext.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public BuildContext(Function1<? super URI, ? extends IResourceServiceProvider> resourceServiceProviderProvider,
		XtextResourceSet resourceSet, IndexState oldState, IResourceClusteringPolicy clusteringPolicy,
		CancelIndicator cancelIndicator) {
	this.resourceServiceProviderProvider = resourceServiceProviderProvider;
	this.resourceSet = resourceSet;
	this.oldState = oldState;
	this.clusteringPolicy = clusteringPolicy;
	this.cancelIndicator = cancelIndicator;
}
 
Example #9
Source File: XBuildContext.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Getter
 */
public IResourceClusteringPolicy getClusteringPolicy() {
	return this.clusteringPolicy;
}
 
Example #10
Source File: BuildContext.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public IResourceClusteringPolicy getClusteringPolicy() {
	return clusteringPolicy;
}
 
Example #11
Source File: OverridingGuiceModule.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void configure(Binder binder) {
	binder.bind(IResourceClusteringPolicy.class).to(DynamicResourceClusteringPolicy.class);
}