All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.xtext.xbase;

import org.eclipse.xtext.common.types.DefaultCommonTypesRuntimeModule;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.debug.IStratumBreakpointSupport;
import org.eclipse.xtext.generator.AbstractFileSystemAccess2;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
import org.eclipse.xtext.generator.LineSeparatorHarmonizer;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.ILinkingDiagnosticMessageProvider;
import org.eclipse.xtext.naming.IQualifiedNameConverter;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
import org.eclipse.xtext.parser.antlr.IPartialParsingHelper;
import org.eclipse.xtext.resource.DerivedStateAwareResourceDescriptionManager;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
import org.eclipse.xtext.resource.IDerivedStateComputer;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.serializer.sequencer.ITransientValueService;
import org.eclipse.xtext.service.SingletonBinding;
import org.eclipse.xtext.validation.CancelableDiagnostician;
import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider;
import org.eclipse.xtext.validation.SeverityConverter;
import org.eclipse.xtext.workspace.IProjectConfigProvider;
import org.eclipse.xtext.workspace.ProjectConfigProvider;
import org.eclipse.xtext.xbase.annotations.validation.UnresolvedFeatureCallTypeAwareMessageProvider;
import org.eclipse.xtext.xbase.compiler.JvmModelGenerator;
import org.eclipse.xtext.xbase.compiler.output.TraceAwarePostProcessor;
import org.eclipse.xtext.xbase.conversion.XbaseValueConverterService;
import org.eclipse.xtext.xbase.debug.XbaseStratumBreakpointSupport;
import org.eclipse.xtext.xbase.featurecalls.IdentifiableSimpleNameProvider;
import org.eclipse.xtext.xbase.interpreter.IEvaluationContext;
import org.eclipse.xtext.xbase.interpreter.IExpressionInterpreter;
import org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext;
import org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter;
import org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator;
import org.eclipse.xtext.xbase.linking.BrokenConstructorCallAwareEObjectAtOffsetHelper;
import org.eclipse.xtext.xbase.linking.XbaseLazyLinker;
import org.eclipse.xtext.xbase.parser.TokenSequencePreservingPartialParsingHelper;
import org.eclipse.xtext.xbase.parser.LookAheadPreservingNodeModelBuilder;
import org.eclipse.xtext.xbase.resource.BatchLinkableResource;
import org.eclipse.xtext.xbase.resource.XbaseResourceDescriptionStrategy;
import org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider;
import org.eclipse.xtext.xbase.scoping.batch.IBatchScopeProvider;
import org.eclipse.xtext.xbase.serializer.XbaseTransientValueService;
import org.eclipse.xtext.xbase.validation.JvmTypeReferencesValidator;
import org.eclipse.xtext.xbase.validation.UniqueClassNameValidator;
import org.eclipse.xtext.xbase.validation.XbaseConfigurableIssueCodes;
import org.eclipse.xtext.xbase.validation.XbaseDiagnostician;
import org.eclipse.xtext.xbase.validation.XbaseSeverityConverter;
import org.eclipse.xtext.xtype.XtypeFactory;

import com.google.inject.Binder;
import com.google.inject.name.Names;

/**
 * @author Sven Efftinge - Initial contribution and API
 * @since 2.8
 */
public class DefaultXbaseRuntimeModule extends DefaultCommonTypesRuntimeModule {

	public Class bindIEvaluationContext() {
		return DefaultEvaluationContext.class;
	}

	public Class bindIExpressionInterpreter() {
		return XbaseInterpreter.class;
	}

	public Class bindIQualifiedNameConverter() {
		return XbaseQualifiedNameConverter.class;
	}

	@Override
	public Class bindIQualifiedNameProvider() {
		return XbaseQualifiedNameProvider.class;
	}

	@Override
	public Class bindIValueConverterService() {
		return XbaseValueConverterService.class;
	}

	@Override
	public Class bindIScopeProvider() {
		return IBatchScopeProvider.class;
	}

	@Override
	public void configureLinkingIScopeProvider(com.google.inject.Binder binder) {
		binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(org.eclipse.xtext.linking.LinkingScopeProviderBinding.class)
				.to(org.eclipse.xtext.xbase.scoping.batch.IBatchScopeProvider.class);
	}

	@Override
	public void configureSerializerIScopeProvider(com.google.inject.Binder binder) {
		binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding.class)
				.to(org.eclipse.xtext.xbase.serializer.SerializerScopeProvider.class);
	}

	@SuppressWarnings("deprecation")
	public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
		binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
				.annotatedWith(Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
				.to(org.eclipse.xtext.xbase.scoping.XbaseImportedNamespaceScopeProvider.class);
	}

	@Override
	public Class bindILinker() {
		return XbaseLazyLinker.class;
	}

	@Override
	public Class bindXtextResource() {
		return BatchLinkableResource.class;
	}

	@SingletonBinding(eager = true)
	public Class bindJvmTypeReferencesValidator() {
		return JvmTypeReferencesValidator.class;
	}
	
	@SingletonBinding(eager = true)
	public Class bindUniqueClassNameValidator() {
		return UniqueClassNameValidator.class;
	}

	// obsolete convenience bindings
	public Class bindIdentifiableSimpleNameProvider() {
		return IdentifiableSimpleNameProvider.class;
	}

	public Class bindIDerivedStateComputer() {
		return JvmModelAssociator.class;
	}

	public Class bindIResourceDescription$Manager() {
		return DerivedStateAwareResourceDescriptionManager.class;
	}

	public Class bindIGenerator() {
		return JvmModelGenerator.class;
	}

	public XtypeFactory bindXtypeFactoryToInstance() {
		return XtypeFactory.eINSTANCE;
	}

	public Class bindIStratumBreakpointSupport() {
		return XbaseStratumBreakpointSupport.class;
	}

	public Class bindLineSeparatorHarmonizer() {
		return TraceAwarePostProcessor.class;
	}

	public Class bindIDefaultResourceDescriptionStrategy() {
		return XbaseResourceDescriptionStrategy.class;
	}

	public Class bindSeverityConverter() {
		return XbaseSeverityConverter.class;
	}

	public Class bindConfigurableIssueCodesProvider() {
		return XbaseConfigurableIssueCodes.class;
	}

	public Class bindEObjectAtOffsetHelper() {
		return BrokenConstructorCallAwareEObjectAtOffsetHelper.class;
	}

	public Class bindCancelableDiagnostician() {
		return XbaseDiagnostician.class;
	}

	@SuppressWarnings("deprecation")
	public Class bindStaticImplicitMethodsFeatureForTypeProvider$ExtensionClassNameProvider() {
		return org.eclipse.xtext.xbase.scoping.batch.ImplicitlyImportedTypesAdapter.class;
	}
	
	public void configureITransientValueService(Binder binder) {
		binder.bind(ITransientValueService.class).to(XbaseTransientValueService.class);
	}

	public Class bindAbstractFileSystemAccess2() {
		return JavaIoFileSystemAccess.class;
	}
	
	/**
	 * @since 2.9
	 */
	public Class bindProjectConfigProvider() {
		return ProjectConfigProvider.class;
	}
	
	/**
	 * @since 2.9
	 */
	public Class bindILinkingDiagnosticMessageProvider() {
		return UnresolvedFeatureCallTypeAwareMessageProvider.class;
	}
	
	@Override
	public Class bindIPartialParserHelper() {
		return TokenSequencePreservingPartialParsingHelper.class;
	}
	
	/**
	 * @since 2.9
	 */
	public Class bindNodeModelBuilder() {
		return LookAheadPreservingNodeModelBuilder.class;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy