Java Code Examples for org.eclipse.xtext.workspace.IProjectConfig#findSourceFolderContaining()
The following examples show how to use
org.eclipse.xtext.workspace.IProjectConfig#findSourceFolderContaining() .
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: XURIBasedFileSystemAccessFactory.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** Create a new URIBasedFileSystemAccess. */ public URIBasedFileSystemAccess newFileSystemAccess(Resource resource, XBuildRequest request) { URIBasedFileSystemAccess uriBasedFileSystemAccess = new URIBasedFileSystemAccess(); uriBasedFileSystemAccess.setOutputConfigurations(IterableExtensions.toMap( this.outputConfigurationProvider.getOutputConfigurations(resource), OutputConfiguration::getName)); uriBasedFileSystemAccess.setPostProcessor(this.postProcessor); if (this.encodingProvider != null) { uriBasedFileSystemAccess.setEncodingProvider(this.encodingProvider); } uriBasedFileSystemAccess.setTraceFileNameProvider(this.traceFileNameProvider); uriBasedFileSystemAccess.setTraceRegionSerializer(this.traceRegionSerializer); uriBasedFileSystemAccess.setGenerateTraces(true); uriBasedFileSystemAccess.setBaseDir(request.getBaseDir()); if (this.projectConfigProvider != null) { IProjectConfig projectConfig = this.projectConfigProvider.getProjectConfig(resource.getResourceSet()); if (projectConfig != null) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(resource.getURI()); if (sourceFolder != null) { uriBasedFileSystemAccess.setCurrentSource(sourceFolder.getName()); } } } uriBasedFileSystemAccess.setConverter(resource.getResourceSet().getURIConverter()); return uriBasedFileSystemAccess; }
Example 2
Source File: IncrementalBuilder.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
public URIBasedFileSystemAccess newFileSystemAccess(Resource resource, BuildRequest request) { URIBasedFileSystemAccess uriBasedFileSystemAccess = new URIBasedFileSystemAccess(); uriBasedFileSystemAccess.setOutputConfigurations(IterableExtensions.toMap( outputConfigurationProvider.getOutputConfigurations(resource), OutputConfiguration::getName)); uriBasedFileSystemAccess.setPostProcessor(postProcessor); if (encodingProvider != null) { uriBasedFileSystemAccess.setEncodingProvider(encodingProvider); } uriBasedFileSystemAccess.setTraceFileNameProvider(traceFileNameProvider); uriBasedFileSystemAccess.setTraceRegionSerializer(traceRegionSerializer); uriBasedFileSystemAccess.setGenerateTraces(true); uriBasedFileSystemAccess.setBaseDir(request.getBaseDir()); if (projectConfigProvider != null) { IProjectConfig projectConfig = projectConfigProvider.getProjectConfig(resource.getResourceSet()); if (projectConfig != null) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(resource.getURI()); if (sourceFolder != null) { uriBasedFileSystemAccess.setCurrentSource(sourceFolder.getName()); } } } uriBasedFileSystemAccess.setConverter(resource.getResourceSet().getURIConverter()); return uriBasedFileSystemAccess; }
Example 3
Source File: LSPBuilder.java From n4js with Eclipse Public License 1.0 | 5 votes |
protected boolean isSourceFile(URI uri) { IProjectConfig projectConfig = workspaceManager.getWorkspaceConfig().findProjectContaining(uri); if (projectConfig != null) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(uri); if (sourceFolder != null) { return true; } } return false; }
Example 4
Source File: BatchLinkableResourceStorageFacade.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override protected URI getSourceContainerURI(StorageAwareResource resource) { URI uri = resource.getURI(); IProjectConfig mainProject = projectConfigProvider.getProjectConfig(resource.getResourceSet()); if (mainProject != null) { IProjectConfig project = mainProject.getWorkspaceConfig().findProjectContaining(uri); if (project != null) { ISourceFolder sourceFolder = project.findSourceFolderContaining(uri); if (sourceFolder != null) { return sourceFolder.getPath(); } } } return super.getSourceContainerURI(resource); }
Example 5
Source File: AbsoluteURI.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public SourceRelativeURI deresolve(IProjectConfig projectConfig) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(getURI()); return sourceFolder != null ? deresolve(sourceFolder) : null; }