Java Code Examples for org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2

The following examples show how to use org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2. 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
Source Project: n4js   Source File: BuildInstruction.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source Project: n4js   Source File: N4JSBuilderParticipant.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Intentionally package visible producer for the {@link IBuildParticipantInstruction}.
 *
 * @param project
 *            the currently build project
 * @param buildType
 *            the current build type
 * @return a StatefulBuilderParticipant. Never <code>null</code>.
 */
IBuildParticipantInstruction prepareBuild(IProject project, IXtextBuilderParticipant.BuildType buildType)
		throws CoreException {

	if (!isEnabled(project)) {
		return IBuildParticipantInstruction.NOOP;
	}
	EclipseResourceFileSystemAccess2 access = fileSystemAccessProvider.get();
	access.setProject(project);
	final Map<String, OutputConfiguration> outputConfigurations = getOutputConfigurations(project);
	refreshOutputFolders(project, outputConfigurations, null);
	access.setOutputConfigurations(outputConfigurations);
	if (buildType == BuildType.CLEAN || buildType == BuildType.RECOVERY) {
		IBuildParticipantInstruction clean = new CleanInstruction(project, outputConfigurations,
				getDerivedResourceMarkers());
		if (buildType == BuildType.RECOVERY) {
			clean.finish(Collections.<Delta> emptyList(), null);
		} else {
			return clean;
		}
	}
	Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = getGeneratorMarkers(project,
			outputConfigurations.values());
	BuildInstruction buildInstruction = new BuildInstruction(project, outputConfigurations,
			getDerivedResourceMarkers(), access,
			generatorMarkers, storage2UriMapper, compositeGenerator, injector);
	return buildInstruction;
}
 
Example 3
@Override
protected void handleChangedContents(final Delta delta, final IBuildContext context, final EclipseResourceFileSystemAccess2 fsa) throws CoreException {

  if (isAffected(delta, resourceServiceProvider)) {
    Resource resource = context.getResourceSet().getResource(delta.getUri(), true);
    if (shouldGenerate(resource, context) && resource.getContents().get(0) instanceof FormatConfiguration) {
      generator.doGenerate(resource, fsa);
    }
  }
}
 
Example 4
Source Project: n4js   Source File: N4JSUiModule.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Avoid unnecessary overhead for trace file lookup.
 */
public Class<? extends EclipseResourceFileSystemAccess2> bindEclipseResourceFileSystemAccess2() {
	return FileSystemAccessWithoutTraceFileSupport.class;
}
 
Example 5
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {	
    return EclipseResourceFileSystemAccess2.class;	
}
 
Example 6
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
	return EclipseResourceFileSystemAccess2.class;
}
 
Example 7
public Class<? extends EclipseResourceFileSystemAccess2> bindEclipseResourceFileSystemAccess2() {
	return JDTAwareEclipseResourceFileSystemAccess2.class;
}
 
Example 8
Source Project: xtext-xtend   Source File: XtendUiModule.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends EclipseResourceFileSystemAccess2> bindEclipseResourceFileSystemAccess2() {
	return SourceRelativeFileSystemAccess.class;
}
 
Example 9
Source Project: xtext-xtend   Source File: XtendUiModule.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
	return EclipseResourceFileSystemAccess2.class;
}