org.eclipse.xtext.builder.resourceloader.IResourceLoader Java Examples

The following examples show how to use org.eclipse.xtext.builder.resourceloader.IResourceLoader. 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: 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 #5
Source File: ResourceLoaderProviders.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a provider for parallel loading and the given degree of parallelization.
 *
 * @param nrOfThreads
 *          degree
 * @return parallel resource loader
 */
public static Provider<IResourceLoader> getParallelLoader(final int nrOfThreads) {
  int nProcessors = Runtime.getRuntime().availableProcessors();
  // CHECKSTYLE:CONSTANTS-OFF
  int nThreads = Math.max(2, Math.min(4, nProcessors));
  // CHECKSTYLE:CONSTANTS-ON
  return getParallelLoader(nThreads, 0);
}
 
Example #6
Source File: ResourceLoaderProviders.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a provider for parallel loading and the given degree of parallelization.
 *
 * @param nrOfThreads
 *          degree
 * @param bufferSize
 *          buffer of loader
 * @return parallel resource loader
 */
public static Provider<IResourceLoader> getParallelLoader(final int nrOfThreads, final int bufferSize) {
  return new AbstractResourceLoaderProvider() {

    @Inject
    private Injector injector;

    @Override
    public IResourceLoader get() {
      ParallelResourceLoader resourceLoader = new ParallelResourceLoader(getResourceSetProvider(), getResourceSorter(), nrOfThreads, bufferSize);
      injector.injectMembers(resourceLoader);
      return resourceLoader;
    }
  };
}
 
Example #7
Source File: ResourceLoaderProviders.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
public static Provider<IResourceLoader> getSerialLoader() {
  return new AbstractResourceLoaderProvider() {
    @Override
    public IResourceLoader get() {
      return new SerialResourceLoader(getResourceSetProvider(), getResourceSorter());
    }
  };
}
 
Example #8
Source File: OverridingModule.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configure(final Binder binder) {
	super.configure(binder);
	binder.bind(IResourceLoader.class)
			.annotatedWith(Names.named(ClusteringBuilderState.RESOURCELOADER_GLOBAL_INDEX))
			.toProvider(ResourceLoaderProviders.getParallelLoader(8, 8));

	binder.bind(IResourceLoader.class)
			.annotatedWith(Names.named(ClusteringBuilderState.RESOURCELOADER_CROSS_LINKING))
			.toProvider(ResourceLoaderProviders.getParallelLoader(8, 8));
}
 
Example #9
Source File: BuildScopeAwareParallelLoaderProvider.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IResourceLoader get() {
	BuildScopeAwareParallelLoader resourceLoader = new BuildScopeAwareParallelLoader(getResourceSetProvider(),
			getResourceSorter(), nrOfThreads, 0);
	return resourceLoader;
}
 
Example #10
Source File: MonitoredClusteringBuilderState.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
protected IResourceLoader getCrossLinkingResourceLoader() {
  return crossLinkingResourceLoader;
}
 
Example #11
Source File: ClusteringModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Configure resource loaders.
 *
 * @param binder
 *          binder
 */
public void configureResourceLoaders(final Binder binder) {
  binder.bind(IResourceLoader.class).toProvider(ResourceLoaderProviders.getParallelLoader(PARALLEL_DEGREE));
  binder.bind(IResourceLoader.class).annotatedWith(Names.named(MonitoredClusteringBuilderState.RESOURCELOADER_GLOBAL_INDEX)).toProvider(ResourceLoaderProviders.getParallelLoader(PARALLEL_DEGREE));
  binder.bind(IResourceLoader.class).annotatedWith(Names.named(MonitoredClusteringBuilderState.RESOURCELOADER_CROSS_LINKING)).toProvider(ResourceLoaderProviders.getParallelLoader(PARALLEL_DEGREE));
}