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


Java OutputConfiguration类代码示例

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


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

示例1: configureFSA

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
/**
 * Setting the compile output-configurations to contain path-locations relative to the user.dir: Wrapper function
 * written against Xtext 2.7.1.
 *
 * In Eclipse-compile mode there are "projects" and the FSA is configured relative to these projects. In this
 * filebasedWorkspace here there is no "project"-concept for the generator. So the paths of the FSA need to be
 * reconfigured to contain the navigation to the IN4JSProject-root.
 *
 * @param project
 *            project to be compiled
 */
private void configureFSA(IN4JSProject project) {
	Map<String, OutputConfiguration> outputConfigToBeWrapped = getInitialOutputConfigurations();
	File currentDirectory = new File(".");
	File projectLocation = new File(project.getLocation().toFileString());

	// If project is not in a sub directory of the current directory an absolute path is computed.
	final java.net.URI projectURI = currentDirectory.toURI().relativize(projectLocation.toURI());
	final String projectPath = projectURI.getPath();
	if (projectPath.length() == 0) {
		// same directory, skip
		return;
	}

	// set different output configuration.
	fsa.setOutputConfigurations(transformedOutputConfiguration(projectPath, outputConfigToBeWrapped));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:N4HeadlessCompiler.java

示例2: cleanOutput

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
private void cleanOutput(IProject aProject, OutputConfiguration config, IProgressMonitor monitor)
		throws CoreException {
	IContainer container = getContainer(aProject, config.getOutputDirectory());
	if (!container.exists()) {
		return;
	}
	if (config.isCanClearOutputDirectory()) {
		for (IResource resource : container.members()) {
			resource.delete(IResource.KEEP_HISTORY, monitor);
		}
	} else if (config.isCleanUpDerivedResources()) {
		List<IFile> resources = derivedResourceMarkers.findDerivedResources(container, null);
		for (IFile iFile : resources) {
			iFile.delete(IResource.KEEP_HISTORY, monitor);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:CleanInstruction.java

示例3: getGeneratorMarkers

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
@Override
protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject,
		Collection<OutputConfiguration> outputConfigurations) throws CoreException {

	if (builtProject instanceof ExternalProject) {
		return emptyMap();
	}

	Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap();
	for (OutputConfiguration config : outputConfigurations) {
		if (config.isCleanUpDerivedResources()) {
			List<IMarker> markers = Lists.newArrayList();
			for (IContainer container : getOutputs(builtProject, config)) {
				Iterables.addAll(
						markers,
						getDerivedResourceMarkers().findDerivedResourceMarkers(container,
								getGeneratorIdProvider().getGeneratorIdentifier()));
			}
			generatorMarkers.put(config, markers);
		}
	}
	return generatorMarkers;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4JSBuilderParticipant.java

示例4: createDescriptor

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
private static CompilerDescriptor createDescriptor() {
	final CompilerDescriptor result = new CompilerDescriptor();
	result.setIdentifier(COMPILER_ID);
	result.setName("N4JS to ECMAScript transpiler");
	result.setDescription(
			"Transpiles N4JS to ECMAScript, currently ES5 plus some selected ES6 features supported by V8.");
	result.setActive(true);
	result.setCompiledFileExtension("js");
	result.setCompiledFileSourceMapExtension("map");
	final OutputConfiguration outCfg = new OutputConfiguration(COMPILER_ID);
	outCfg.setDescription("N4JS to ECMAScript transpiler");
	outCfg.setOutputDirectory(calculateOutputDirectory("src-gen", COMPILER_ID));
	outCfg.setOverrideExistingResources(true);
	outCfg.setCreateOutputDirectory(true);
	outCfg.setCleanUpDerivedResources(true);
	outCfg.setSetDerivedProperty(true);
	outCfg.setKeepLocalHistory(true);
	outCfg.setCanClearOutputDirectory(true);
	result.setOutputConfiguration(outCfg);
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:EcmaScriptSubGenerator.java

示例5: getFileSystemAccess

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的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

示例6: getFileSystemAccess

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
private ISCTFileSystemAccess getFileSystemAccess(GeneratorEntry entry) {
	final ISCTFileSystemAccess fileSystemAccess = this.factory.create(entry);

	final FeatureConfiguration featureConfiguration = entry
			.getFeatureConfiguration(IArduinoFeatureConstants.FEATURE_NAME);
	if (featureConfiguration != null) {
		final String userSrcFolder = featureConfiguration
				.getParameterValue(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER).getStringValue();
		fileSystemAccess.setOutputPath(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER, userSrcFolder);

		final OutputConfiguration outputConfiguration = fileSystemAccess.getOutputConfigurations()
				.get(IArduinoFeatureConstants.PARAM_USER_SRC_FOLDER);
		outputConfiguration.setCreateOutputDirectory(true);
		outputConfiguration.setOverrideExistingResources(false);
		outputConfiguration.setSetDerivedProperty(false);
	}

	return fileSystemAccess;
}
 
开发者ID:wendehals,项目名称:arduino_sct_tools,代码行数:20,代码来源:ArduinoCppCodeGenerator.java

示例7: before

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的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

示例8: outputConfigurations

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
@Test
public void outputConfigurations() {
  Set<OutputConfiguration> configs = new Antlr4OutputConfigurationProvider()
      .getOutputConfigurations();

  assertNotNull(configs);
  assertEquals(1, configs.size());

  OutputConfiguration config = configs.iterator().next();
  assertNotNull(config);
  assertEquals("Options", config.getDescription());
  assertEquals("DEFAULT_OUTPUT", config.getName());
  assertEquals("./target/generated-sources/antlr4", config.getOutputDirectory());
  assertEquals(false, config.isCanClearOutputDirectory());
  assertEquals(true, config.isCreateOutputDirectory());
  assertEquals(true, config.isHideSyntheticLocalVariables());
  assertEquals(false, config.isInstallDslAsPrimarySource());
  assertEquals(true, config.isKeepLocalHistory());
  assertEquals(true, config.isOverrideExistingResources());
  assertEquals(true, config.isSetDerivedProperty());
}
 
开发者ID:antlr4ide,项目名称:antlr4ide,代码行数:22,代码来源:Antlr4OutputConfigurationProviderTest.java

示例9: WrappedOutputConfiguration

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
public WrappedOutputConfiguration(OutputConfiguration delegate, String pathprefix) {
	super(delegate.getName());
	this.delegate = delegate;
	this.pathprefix = normalize(pathprefix);
	// Wrapp all sourcemappings:
	sourceMappings = Sets.<WrappedSourceMapping> newHashSet();
	for (SourceMapping sm : delegate.getSourceMappings()) {
		sourceMappings.add(new WrappedSourceMapping(sm, this));
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:WrappedOutputConfiguration.java

示例10: getInitialOutputConfigurations

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
/** Build an output configuration from a composite generator. */
private Map<String, OutputConfiguration> getInitialOutputConfigurations() {
	if (initialOutputConfiguration == null) {
		initialOutputConfiguration = new HashMap<>();
		for (CompilerDescriptor desc : compositeGenerator.getCompilerDescriptors()) {
			initialOutputConfiguration.put(desc.getIdentifier(), desc.getOutputConfiguration());
		}

	}
	return initialOutputConfiguration;
	// return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:N4HeadlessCompiler.java

示例11: transformedOutputConfiguration

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
/**
 * Wraps the output-configurations with a delegate that transparently injects the relative path to the project-root.
 *
 * @param projectPath
 *            relative path to the project-root
 * @return wrapped configurations.
 */
private Map<String, OutputConfiguration> transformedOutputConfiguration(String projectPath,
		Map<String, OutputConfiguration> outputConfigToBeWrapped) {
	Map<String, OutputConfiguration> result = new HashMap<>();

	for (Entry<String, OutputConfiguration> pair : outputConfigToBeWrapped.entrySet()) {
		final OutputConfiguration input = pair.getValue();
		OutputConfiguration transOC = new WrappedOutputConfiguration(input, projectPath);
		result.put(pair.getKey(), transOC);
	}

	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:N4HeadlessCompiler.java

示例12: BuildInstruction

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
/**
 * Create a build instruction for the given project.
 */
public BuildInstruction(IProject project,
		Map<String, OutputConfiguration> outputConfigurations,
		IDerivedResourceMarkers derivedResourceMarkers,
		EclipseResourceFileSystemAccess2 access,
		Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers,
		IStorage2UriMapper storage2UriMapper, ICompositeGenerator compositeGenerator,
		Injector injector) {
	super(project, outputConfigurations, derivedResourceMarkers);
	this.access = access;
	this.generatorMarkers = generatorMarkers;
	this.storage2UriMapper = storage2UriMapper;
	this.compositeGenerator = compositeGenerator;
	this.injector = injector;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:BuildInstruction.java

示例13: deleteEmptyDirectories

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
private void deleteEmptyDirectories(IProgressMonitor progressMonitor) throws CoreException {
	for (OutputConfiguration config : outputConfigurations.values()) {
		IFolder folder = project.getFolder(config.getOutputDirectory());
		if (null != folder && folder.exists()) {
			deleteEmptyDirectories(folder, progressMonitor);
			folder.getParent().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:BuildInstruction.java

示例14: recordDerivedResources

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
private void recordDerivedResources(final String uri) {
	for (OutputConfiguration config : outputConfigurations.values()) {
		if (config.isCleanUpDerivedResources()) {
			Iterable<IMarker> markers = generatorMarkers.get(config);
			if (null != markers) {
				for (IMarker marker : markers) {
					String source = derivedResourceMarkers.getSource(marker);
					if (source != null && source.equals(uri)) {
						derivedResources.add((IFile) marker.getResource());
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:BuildInstruction.java

示例15: CleanInstruction

import org.eclipse.xtext.generator.OutputConfiguration; //导入依赖的package包/类
/**
 * Creates a new clean operation for the given project.
 */
public CleanInstruction(IProject project, Map<String, OutputConfiguration> outputConfigurations,
		IDerivedResourceMarkers derivedResourceMarkers) {
	super(project, outputConfigurations, derivedResourceMarkers);
	this.project = project;
	this.outputConfigurations = outputConfigurations;
	this.derivedResourceMarkers = derivedResourceMarkers;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:CleanInstruction.java


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