当前位置: 首页>>代码示例>>Java>>正文


Java IFileSystemAccess类代码示例

本文整理汇总了Java中org.eclipse.xtext.generator.IFileSystemAccess的典型用法代码示例。如果您正苦于以下问题:Java IFileSystemAccess类的具体用法?Java IFileSystemAccess怎么用?Java IFileSystemAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IFileSystemAccess类属于org.eclipse.xtext.generator包,在下文中一共展示了IFileSystemAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
public String generate(final Resource res, final JvmDeclaredType type) {
  String _xblockexpression = null;
  {
    res.eSetDeliver(false);
    EList<EObject> _contents = res.getContents();
    this.builder.<JvmDeclaredType>operator_add(_contents, type);
    res.eSetDeliver(true);
    final InMemoryFileSystemAccess fsa = new InMemoryFileSystemAccess();
    this.generator.doGenerate(res, fsa);
    Map<String, CharSequence> _files = fsa.getFiles();
    String _replace = type.getIdentifier().replace(".", "/");
    String _plus = (IFileSystemAccess.DEFAULT_OUTPUT + _replace);
    String _plus_1 = (_plus + ".java");
    _xblockexpression = _files.get(_plus_1).toString();
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:JvmModelGeneratorTest.java

示例2: getFileSystemAccess

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
protected IFileSystemAccess2 getFileSystemAccess(final IProject project, final IProgressMonitor monitor) {
	EclipseResourceFileSystemAccess2 access = fileSystemAccessProvider.get();
	access.setContext(project);
	access.setMonitor(monitor);
	OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
	defaultOutput.setDescription("Output Folder");
	defaultOutput.setOutputDirectory("./");
	defaultOutput.setOverrideExistingResources(true);
	defaultOutput.setCreateOutputDirectory(true);
	defaultOutput.setCleanUpDerivedResources(false);
	defaultOutput.setSetDerivedProperty(false);
	defaultOutput.setKeepLocalHistory(false);
	HashMap<String, OutputConfiguration> outputConfigurations = new HashMap<String, OutputConfiguration>();
	outputConfigurations.put(IFileSystemAccess.DEFAULT_OUTPUT, defaultOutput);
	access.setOutputConfigurations(outputConfigurations);
	return access;
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:18,代码来源:RestauranteProjectCreator.java

示例3: before

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Before
public void before() {
  try {
    final Path tmpPath = Paths.get(StandardSystemProperty.JAVA_IO_TMPDIR.value());
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("tempFolder_");
    UUID _randomUUID = UUID.randomUUID();
    _builder.append(_randomUUID);
    final Path output = Files.createTempDirectory(tmpPath, _builder.toString());
    final Path resource = Files.createFile(output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME));
    resource.toFile().deleteOnExit();
    output.toFile().deleteOnExit();
    final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(this.configProvider.getOutputConfigurations());
    config.setOutputDirectory(output.toString());
    Pair<String, OutputConfiguration> _mappedTo = Pair.<String, OutputConfiguration>of(IFileSystemAccess.DEFAULT_OUTPUT, config);
    this.fsa.setOutputConfigurations(Collections.<String, OutputConfiguration>unmodifiableMap(CollectionLiterals.<String, OutputConfiguration>newHashMap(_mappedTo)));
    this.fsa.setConverter(this.uriConverter);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:URIBasedFileSystemAccessTest.java

示例4: generateClassesForApp

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
private void generateClassesForApp(IFileSystemAccess filesystem, List<Application> applications,
		Application application) {
	String projectName = getProjectName(applications, application);
	ApplicationElementList elements = getFieldData(application.getAttributes(),
			ApplicationElementList.class);
		
	for (ApplicationElement element : elements.getElements()) {
		if (isAllowedElement(element)) {
			String classPath = application.getName().replace(".", "/");
		
			filesystem.generateFile(String.format("%s/src/main/java/%s/%s/%s.java", projectName,
					classPath, getSubClassPath(), element.getName()),
					retrieveElementTemplate(application, element));
		}
	}
}
 
开发者ID:nohum,项目名称:android-code-generation,代码行数:17,代码来源:AbstractClassGenerator.java

示例5: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
public void doGenerate(final Resource input, final IFileSystemAccess fsa) {
  EList<EObject> _contents = input.getContents();
  EObject _head = IterableExtensions.<EObject>head(_contents);
  final Model m = ((Model) _head);
  Assembly _assembly = m.getAssembly();
  boolean _notEquals = (!Objects.equal(_assembly, null));
  if (_notEquals) {
    final LinkedHashSet<Action> actions = new LinkedHashSet<Action>();
    Assembly _assembly_1 = m.getAssembly();
    this.collectActions(_assembly_1, actions);
    boolean _isEmpty = actions.isEmpty();
    boolean _not = (!_isEmpty);
    if (_not) {
      final LinkedHashSet<MountedAssemblyItem> items = new LinkedHashSet<MountedAssemblyItem>();
      Assembly _assembly_2 = m.getAssembly();
      this.collectItems(_assembly_2, items);
      Assembly _assembly_3 = m.getAssembly();
      String _name = _assembly_3.getName();
      String _plus = ("3d/" + _name);
      String _plus_1 = (_plus + ".js");
      CharSequence _generateJS = this.generateJS(actions, items);
      fsa.generateFile(_plus_1, _generateJS);
    }
  }
}
 
开发者ID:BestSolution-at,项目名称:lego,代码行数:26,代码来源:Lego3dJavaScript.java

示例6: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
  try {
    ResourceSetImpl _resourceSetImpl = new ResourceSetImpl();
    final ResourceSetImpl rset = _resourceSetImpl;
    URI _uRI = resource.getURI();
    URI _appendFileExtension = _uRI.appendFileExtension("xml");
    final Resource xmlResource = rset.createResource(_appendFileExtension);
    EList<EObject> _contents = xmlResource.getContents();
    EList<EObject> _contents_1 = resource.getContents();
    EObject _head = IterableExtensions.<EObject>head(_contents_1);
    _contents.add(_head);
    xmlResource.save(Collections.EMPTY_MAP);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:RobertWalter83,项目名称:DialogScriptDSL,代码行数:17,代码来源:DialogScriptGenerator.java

示例7: setup

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    temporaryOutputDirectory = Files.createTempDir();
    temporaryOutputDirectory.deleteOnExit();
    InvocationArguments arguments = new InvocationArguments();
    arguments.setGenerationLanguage("java");
    arguments.setModelPath("src/test/resources");
    arguments.setOutputPath(temporaryOutputDirectory.getAbsolutePath());

    Injector francaInjector = new FrancaIDLStandaloneSetup().createInjectorAndDoEMFRegistration()
                                                            .createChildInjector(new AbstractModule() {

                                                                @Override
                                                                protected void configure() {
                                                                    bind(IFileSystemAccess.class).to(JavaIoFileSystemAccess.class);
                                                                }
                                                            });
    francaInjector.injectMembers(this);
    generator = new JoynrJavaGenerator();
    Injector injector = francaInjector.createChildInjector(generator.getGeneratorModule());
    injector.injectMembers(this);
    injector.injectMembers(generator);
    FileSystemAccessUtil.createFileSystemAccess(outputFileSystem, arguments.getOutputPath());
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:25,代码来源:AbstractJoynrJavaGeneratorTest.java

示例8: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
  TreeIterator<EObject> _allContents = resource.getAllContents();
  Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_allContents);
  Iterable<ExpressionsModel> _filter = Iterables.<ExpressionsModel>filter(_iterable, ExpressionsModel.class);
  final Procedure1<ExpressionsModel> _function = new Procedure1<ExpressionsModel>() {
    @Override
    public void apply(final ExpressionsModel it) {
      StringConcatenation _builder = new StringConcatenation();
      URI _uRI = resource.getURI();
      String _lastSegment = _uRI.lastSegment();
      _builder.append(_lastSegment, "");
      _builder.append(".evaluated");
      String _interpretExpressions = ExpressionsGenerator.this.interpretExpressions(it);
      fsa.generateFile(_builder.toString(), _interpretExpressions);
    }
  };
  IterableExtensions.<ExpressionsModel>forEach(_filter, _function);
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:20,代码来源:ExpressionsGenerator.java

示例9: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
  TreeIterator<EObject> _allContents = resource.getAllContents();
  Iterable<EObject> _iterable = IteratorExtensions.<EObject>toIterable(_allContents);
  Iterable<Entity> _filter = Iterables.<Entity>filter(_iterable, Entity.class);
  final Procedure1<Entity> _function = new Procedure1<Entity>() {
    @Override
    public void apply(final Entity it) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("entities/");
      String _name = it.getName();
      _builder.append(_name, "");
      _builder.append(".java");
      CharSequence _compile = EntitiesGenerator.this.compile(it);
      fsa.generateFile(_builder.toString(), _compile);
    }
  };
  IterableExtensions.<Entity>forEach(_filter, _function);
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:20,代码来源:EntitiesGenerator.java

示例10: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
public void doGenerate(Resource input, IFileSystemAccess fsa) {
	if (isApplicableTo(input)) {
		String fileExtension = xpectAwareFileExtensionCalculator.getXpectAwareFileExtension(input.getURI());
		for (ISubGenerator subgenerator : getSubGenerators(fileExtension)) {
			subgenerator.doGenerate(input, fsa);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:N4JSCompositeGenerator.java

示例11: getAllFolders

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
protected List<String> getAllFolders() {
	Set<OutputConfiguration> outputConfigurations = outputConfigurationProvider.getOutputConfigurations();
	String outputFolder = "src-gen";
	for (OutputConfiguration outputConfiguration : outputConfigurations) {
		if (IFileSystemAccess.DEFAULT_OUTPUT.equals(outputConfiguration.getName())) {
			outputFolder = outputConfiguration.getOutputDirectory();
			break;
		}
	}
	return ImmutableList.of(getModelFolderName(), outputFolder);
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:13,代码来源:RestauranteProjectCreator.java

示例12: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
public void doGenerate(final Resource input, final IFileSystemAccess fsa) {
  EList<EObject> _contents = input.getContents();
  for (final EObject obj : _contents) {
    this.internalDoGenerate(obj, fsa);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:JvmModelGenerator.java

示例13: _internalDoGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
protected void _internalDoGenerate(final JvmDeclaredType type, final IFileSystemAccess fsa) {
  boolean _isDisabled = DisableCodeGenerationAdapter.isDisabled(type);
  if (_isDisabled) {
    return;
  }
  String _qualifiedName = type.getQualifiedName();
  boolean _tripleNotEquals = (_qualifiedName != null);
  if (_tripleNotEquals) {
    String _replace = type.getQualifiedName().replace(".", "/");
    String _plus = (_replace + ".java");
    fsa.generateFile(_plus, this.generateType(type, this.generatorConfigProvider.get(type)));
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:JvmModelGenerator.java

示例14: internalDoGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
public void internalDoGenerate(final EObject type, final IFileSystemAccess fsa) {
  if (type instanceof JvmDeclaredType) {
    _internalDoGenerate((JvmDeclaredType)type, fsa);
    return;
  } else if (type != null) {
    _internalDoGenerate(type, fsa);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(type, fsa).toString());
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:13,代码来源:JvmModelGenerator.java

示例15: doGenerate

import org.eclipse.xtext.generator.IFileSystemAccess; //导入依赖的package包/类
@Override
public void doGenerate(Resource input, IFileSystemAccess fsa) {
	if (input.getContents().isEmpty())
		return;
	EObject root = input.getContents().get(0);
	if (!(root instanceof Model))
		return;
	GenerateDirective generateDirective = ((Model) root).getGenerateDirective();
	if (generateDirective != null) {
		fsa.generateFile(generateFileName(generateDirective), generateFileContents(generateDirective));
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:13,代码来源:ContentAssistTestLanguageGenerator.java


注:本文中的org.eclipse.xtext.generator.IFileSystemAccess类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。