org.eclipse.xtext.build.IndexState Java Examples
The following examples show how to use
org.eclipse.xtext.build.IndexState.
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: AbstractIncrementalBuilderTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected BuildRequest newBuildRequest(Procedure1<? super BuildRequest> init) { BuildRequest result = new BuildRequest(); ResourceDescriptionsData newIndex = indexState.getResourceDescriptions().copy(); result.setBaseDir(uri("")); XtextResourceSet rs = resourceSetProvider.get(); rs.getURIConverter().getURIHandlers().clear(); rs.getURIConverter().getURIHandlers().add(inMemoryURIHandler); rs.setClasspathURIContext(AbstractIncrementalBuilderTest.class.getClassLoader()); ProjectDescription projectDescription = new ProjectDescription(); projectDescription.setName("test-project"); projectDescription.attachToEmfObject(rs); ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(Collections.emptyMap(), rs); index.setContainer(projectDescription.getName(), newIndex); result.setResourceSet(rs); result.setDirtyFiles(new ArrayList<>()); result.setDeletedFiles(new ArrayList<>()); result.setAfterValidate((uri, issues) -> { Iterables.addAll(this.issues, issues); return Iterables.isEmpty(issues); }); result.setAfterDeleteFile(f -> deleted.add(f)); result.setAfterGenerateFile((source, target) -> generated.put(source, target)); result.setState(new IndexState(newIndex, indexState.getFileMappings().copy())); init.apply(result); return result; }
Example #2
Source File: ProjectManager.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
/** * Creates a new build request for this project. */ protected BuildRequest newBuildRequest(List<URI> changedFiles, List<URI> deletedFiles, List<IResourceDescription.Delta> externalDeltas, CancelIndicator cancelIndicator) { BuildRequest result = new BuildRequest(); result.setBaseDir(baseDir); result.setState( new IndexState(indexState.getResourceDescriptions().copy(), indexState.getFileMappings().copy())); result.setResourceSet(createFreshResourceSet(result.getState().getResourceDescriptions())); result.setDirtyFiles(changedFiles); result.setDeletedFiles(deletedFiles); result.setExternalDeltas(externalDeltas); result.setAfterValidate((URI uri, Iterable<Issue> issues) -> { issueAcceptor.apply(uri, issues); return true; }); result.setCancelIndicator(cancelIndicator); result.setIndexOnly(projectConfig.isIndexOnly()); return result; }
Example #3
Source File: ReusedTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); if (ReusedTypeProviderTest.typeProvider == null) { String pathToSources = "/org/eclipse/xtext/common/types/testSetups"; List<String> files = ReusedTypeProviderTest.readResource(pathToSources + "/files.list"); ResourceDescriptionsData part = new ResourceDescriptionsData(Collections.emptySet()); XtextResourceSet resourceSet = resourceSetProvider.get(); ProjectDescription projectDesc = new ProjectDescription(); projectDesc.setName("my-test-project"); projectDesc.attachToEmfObject(resourceSet); ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(Collections.emptyMap(), resourceSet); index.setContainer(projectDesc.getName(), part); resourceSet.setClasspathURIContext(ReusedTypeProviderTest.class.getClassLoader()); typeProviderFactory.createTypeProvider(resourceSet); BuildRequest buildRequest = new BuildRequest(); for (String file : files) { if (file != null) { String fullPath = pathToSources + "/" + file; URL url = ReusedTypeProviderTest.class.getResource(fullPath); buildRequest.getDirtyFiles().add(URI.createURI(url.toExternalForm())); } } buildRequest.setResourceSet(resourceSet); buildRequest.setState(new IndexState(part, new Source2GeneratedMapping())); builder.build(buildRequest, (URI it) -> { return resourceServiceProviderRegistry.getResourceServiceProvider(it); }); ReusedTypeProviderTest.typeProvider = typeProviderFactory.findTypeProvider(resourceSet); } }
Example #4
Source File: AbstractIncrementalBuilderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected IndexState build(final BuildRequest buildRequest) { this.clean(); final Function1<URI, IResourceServiceProvider> _function = (URI it) -> { return this.getLanguages().getResourceServiceProvider(it); }; this.indexState = this.incrementalBuilder.build(buildRequest, _function).getIndexState(); return this.indexState; }
Example #5
Source File: AbstractIncrementalBuilderTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected IndexState build(BuildRequest buildRequest) { clean(); indexState = incrementalBuilder.build(buildRequest, it -> getLanguages().getResourceServiceProvider(it)) .getIndexState(); return indexState; }
Example #6
Source File: ProjectManager.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public IndexState getIndexState() { return indexState; }
Example #7
Source File: ProjectManager.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected void setIndexState(IndexState indexState) { this.indexState = indexState; }