Java 类org.eclipse.xtext.generator.AbstractFileSystemAccess2 实例源码

项目:xtext-core    文件:ResourceStorageFacade.java   
/**
 * @return whether a stored resource state exists for the given resource
 */
protected boolean doesStorageExist(final StorageAwareResource resource) {
  final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class));
  if (((stateProvider != null) && (stateProvider.getResourceStorageLoadable(resource) != null))) {
    return true;
  }
  boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap());
  if (_exists) {
    return true;
  }
  boolean _isArchive = resource.getURI().isArchive();
  if (_isArchive) {
    return false;
  }
  final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource);
  final String outputRelativePath = this.computeOutputPath(resource);
  final URI uri = fsa.getURI(outputRelativePath);
  return ((uri != null) && resource.getResourceSet().getURIConverter().exists(uri, null));
}
项目:xtext-extras    文件:LanguageAccess.java   
private void configureFileSystemAccess(final File baseDir, AbstractFileSystemAccess2 fsa) {
    Set<OutputConfiguration> confsForFsa = Sets.newHashSet();
    Set<OutputConfiguration> pomOutputConfigs = getConfiguredOutputConfigs();
    if (pomOutputConfigs != null && !pomOutputConfigs.isEmpty()) {
        for (OutputConfiguration pomConfig : pomOutputConfigs) {
            if (getOutputConfigurationProvider().getOutputConfigurations().contains(pomConfig)) {
                confsForFsa.add(pomConfig);
            } else {
                LOG.warn("Output '" + pomConfig.getName() 
                            + "' is not configured in OutputConfigurationProvider. Used provider "
                            + getOutputConfigurationProvider().getClass().getName());
            }
        }
    }
    confsForFsa.addAll(getOutputConfigurationProvider().getOutputConfigurations());
    Map<String, OutputConfiguration> asMap = IterableExtensions.toMap(
            Iterables.transform(confsForFsa, new Function<OutputConfiguration, OutputConfiguration>() {

                @Override
                public OutputConfiguration apply(OutputConfiguration output) {
                    output.setOutputDirectory(resolveToBaseDir(output.getOutputDirectory(), baseDir));
                    for (SourceMapping sourceMapping : output.getSourceMappings()) {
                        sourceMapping.setOutputDirectory(resolveToBaseDir(sourceMapping.getOutputDirectory(), baseDir));
                    }
                    return output;
                }
            }), new Function1<OutputConfiguration, String>() {
                @Override
                public String apply(final OutputConfiguration it) {
                    return it.getName();
                }
            });
    fsa.setOutputConfigurations(asMap);
}
项目:xtext-core    文件:ResourceStorageFacade.java   
/**
 * Finds or creates a ResourceStorageLoadable for the given resource.
 * Clients should first call shouldLoadFromStorage to check whether there exists a storage version
 * of the given resource.
 * 
 * @return an IResourceStorageLoadable
 */
@Override
public ResourceStorageLoadable getOrCreateResourceStorageLoadable(final StorageAwareResource resource) {
  try {
    final ResourceStorageProviderAdapter stateProvider = IterableExtensions.<ResourceStorageProviderAdapter>head(Iterables.<ResourceStorageProviderAdapter>filter(resource.getResourceSet().eAdapters(), ResourceStorageProviderAdapter.class));
    if ((stateProvider != null)) {
      final ResourceStorageLoadable inputStream = stateProvider.getResourceStorageLoadable(resource);
      if ((inputStream != null)) {
        return inputStream;
      }
    }
    InputStream _xifexpression = null;
    boolean _exists = resource.getResourceSet().getURIConverter().exists(this.getBinaryStorageURI(resource.getURI()), CollectionLiterals.<Object, Object>emptyMap());
    if (_exists) {
      _xifexpression = resource.getResourceSet().getURIConverter().createInputStream(this.getBinaryStorageURI(resource.getURI()));
    } else {
      InputStream _xblockexpression = null;
      {
        final AbstractFileSystemAccess2 fsa = this.getFileSystemAccess(resource);
        final String outputRelativePath = this.computeOutputPath(resource);
        _xblockexpression = fsa.readBinaryFile(outputRelativePath);
      }
      _xifexpression = _xblockexpression;
    }
    final InputStream inputStream_1 = _xifexpression;
    return this.createResourceStorageLoadable(inputStream_1);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-core    文件:ResourceStorageFacade.java   
protected AbstractFileSystemAccess2 getFileSystemAccess(final StorageAwareResource resource) {
  final AbstractFileSystemAccess2 fsa = this.fileSystemAccessProvider.get();
  fsa.setContext(resource);
  final Function1<OutputConfiguration, String> _function = (OutputConfiguration it) -> {
    return it.getName();
  };
  fsa.setOutputConfigurations(IterableExtensions.<String, OutputConfiguration>toMap(this.outputConfigurationProvider.getOutputConfigurations(resource), _function));
  return fsa;
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
    return JavaIoFileSystemAccess.class;
}
项目:xtext-extras    文件:BuilderTestLanguageRuntimeModule.java   
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
    return JavaIoFileSystemAccess.class;
}
项目:xtext-core    文件:LangATestLanguageRuntimeModule.java   
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
    return JavaIoFileSystemAccess.class;
}