Java Code Examples for org.eclipse.xtext.generator.trace.TraceFileNameProvider

The following examples show how to use org.eclipse.xtext.generator.trace.TraceFileNameProvider. These examples are extracted from open source projects. 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
protected void collectJavaSourceFile2traceFile(String root, String subdir,
		Map<String, File> javaSourceFile2traceFile) {
	File file = new File(root + "/" + subdir);
	File[] listFiles = file.listFiles();
	if (listFiles == null) {
		if (showEmptyDirWarning) {
			getLog().warn("Directory "+ file.getPath() +" is empty. Can't process.");
		}
		return;
	}
	for (File child : listFiles) {
		String name = child.getName();
		if (child.isDirectory())
			collectJavaSourceFile2traceFile(root, subdir + "/" + name, javaSourceFile2traceFile);
		else if (name.endsWith(TraceFileNameProvider.TRACE_FILE_EXTENSION)) {
			String javaSourceFile = subdir + "/" + traceFileNameProvider.getJavaFromTrace(name);
			javaSourceFile2traceFile.put(javaSourceFile, child);
		}
	}
}
 
Example 2
Source Project: xtext-eclipse   Source File: TraceEditor.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected IStorage getLocalStorage(IResourceServiceProvider serviceProvider, URI traceURI) {
	TraceFileNameProvider fileNameProvider = serviceProvider.get(TraceFileNameProvider.class);
	IStorage2UriMapper storage2UriMapper = serviceProvider.get(IStorage2UriMapper.class);
	String generatedName = fileNameProvider.getJavaFromTrace(traceURI.lastSegment());
	URI generatedURI = traceURI.trimSegments(1).appendSegment(generatedName);
	for (Pair<IStorage, IProject> x : storage2UriMapper.getStorages(generatedURI))
		return x.getFirst();
	throw new IllegalStateException("Could not find IStorage for " + generatedURI);
}
 
Example 3
Source Project: xtext-core   Source File: JavaIoFileSystemAccess.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.4
 */
public JavaIoFileSystemAccess(IResourceServiceProvider.Registry registry, IEncodingProvider encodingProvider,
		TraceFileNameProvider traceFileNameProvider, TraceRegionSerializer traceRegionSerializer) {
	this.registry = registry;
	this.encodingProvider = encodingProvider;
	this.traceFileNameProvider = traceFileNameProvider;
	this.traceSerializer = traceRegionSerializer;
}
 
Example 4
public TraceFileNameProvider getTraceFileNameProvider() {
	return traceFileNameProvider;
}
 
Example 5
public void setTraceFileNameProvider(TraceFileNameProvider traceFileNameProvider) {
	this.traceFileNameProvider = traceFileNameProvider;
}
 
Example 6
protected TraceFileNameProvider getTraceFileNameProvider() {
	return traceFileNameProvider;
}