本文整理汇总了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));
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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());
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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());
}
}
}
}
}
}
示例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;
}