org.eclipse.xtext.resource.ILocationInFileProvider Java Examples

The following examples show how to use org.eclipse.xtext.resource.ILocationInFileProvider. 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 File: DotFoldingRegionProvider.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void computeObjectFolding(EObject eObject,
		IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor) {
	ILocationInFileProvider locationInFileProvider = getLocationInFileProvider();
	ITextRegion region = locationInFileProvider.getFullTextRegion(eObject);
	ITextRegionWithLineInformation regionWithLineInformation = (ITextRegionWithLineInformation) region;
	if (region != null) {
		ITextRegion significant = locationInFileProvider
				.getSignificantTextRegion(eObject);
		if (significant == null)
			throw new NullPointerException(
					"significant region may not be null"); //$NON-NLS-1$
		if (!isAlreadyAccepted(regionWithLineInformation)) {
			foldingRegionAcceptor.accept(region.getOffset(),
					region.getLength(), significant);
			acceptedRegions.add(regionWithLineInformation);
		}
	}
}
 
Example #2
Source File: XtextLocationInFileProviderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	with(XtextStandaloneSetup.class);
	grammar = (Grammar) getModel(grammarText);
	locationInFileProvider = get(ILocationInFileProvider.class);
}
 
Example #3
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public TreeAppendable(ImportManager importManager, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source,
		String indentation, String lineSeparator) {
	this(
			new SharedAppendableState(indentation, lineSeparator, importManager, source.eResource()),
			converter,
			locationProvider,
			jvmModelAssociations,
			source);
}
 
Example #4
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected TreeAppendable(SharedAppendableState state, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source) {
	this(
			state,
			converter,
			locationProvider,
			jvmModelAssociations,
			createAllLocationData(
					converter,
					locationProvider,
					jvmModelAssociations,
					source,
					ILocationInFileProviderExtension.RegionDescription.INCLUDING_COMMENTS,
					false), // don't skip empty root regions
			false);
}
 
Example #5
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected TreeAppendable(SharedAppendableState state,
		final ITraceURIConverter converter,
		ILocationInFileProvider locationProvider,
		IJvmModelAssociations jvmModelAssociations,
		Set<ILocationData> sourceLocations, 
		boolean useForDebugging) {
	this.state = state;
	this.traceURIConverter = converter;
	this.locationProvider = locationProvider;
	this.jvmModelAssociations = jvmModelAssociations;
	this.children = Lists.newArrayList();
	this.locationData = sourceLocations;
	this.useForDebugging = useForDebugging;
	this.lightweightTypeReferenceSerializer = createLightweightTypeReferenceSerializer();
}
 
Example #6
Source File: ErrorTreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public ErrorTreeAppendable(SharedAppendableState state, 
		ITraceURIConverter converter,
		ILocationInFileProvider locationProvider,
		IJvmModelAssociations jvmModelAssociations,
		Set<ILocationData> sourceLocations, 
		boolean useForDebugging) {
	super(state, converter, locationProvider, jvmModelAssociations, sourceLocations, useForDebugging);
	encoder = getOrCreateURIEncoder();
}
 
Example #7
Source File: OutlineNodeFactory.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example #8
Source File: AbstractDomainmodelRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example #9
Source File: DefaultFoldingRegionProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Deprecated
public DefaultFoldingRegionProvider(ILocationInFileProvider locationInFileProvider) {
	this.locationInFileProvider = locationInFileProvider;
	this.tokenTypeToPartitionTypeMapperExtension = new TerminalsTokenTypeToPartitionMapper();
}
 
Example #10
Source File: DefaultFoldingRegionProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example #11
Source File: LanguageSpecificURIEditorOpener.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void setLocationProvider(ILocationInFileProvider locationProvider) {
	this.locationProvider = locationProvider;
}
 
Example #12
Source File: LanguageSpecificURIEditorOpener.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public ILocationInFileProvider getLocationProvider() {
	return locationProvider;
}
 
Example #13
Source File: DefaultReferenceUpdater.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example #14
Source File: AbstractXtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example #15
Source File: XtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XtendLocationInFileProvider.class;
}
 
Example #16
Source File: DefaultRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return DefaultLocationInFileProvider.class;
}
 
Example #17
Source File: XtextRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XtextLocationInFileProvider.class;
}
 
Example #18
Source File: XbaseGeneratorFragment2.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected void contributeRuntimeGuiceBindings() {
  final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), 
    TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider"));
  boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(this.getGrammar());
  boolean _not = (!_usesXImportSection);
  if (_not) {
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("binder.bind(");
        _builder.append(Boolean.class);
        _builder.append(".TYPE)");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(".annotatedWith(");
        _builder.append(Names.class, "\t");
        _builder.append(".named(");
        TypeReference _typeReference = new TypeReference("org.eclipse.xtext.xbase.imports", "RewritableImportSection.Factory");
        _builder.append(_typeReference, "\t");
        _builder.append(".REWRITABLEIMPORTSECTION_ENABLEMENT))");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(".toInstance(");
        _builder.append(Boolean.class, "\t");
        _builder.append(".FALSE);");
        _builder.newLineIfNotEmpty();
      }
    };
    bindingFactory.addConfiguredBinding("RewritableImportSectionEnablement", _client);
  }
  if (this.useInferredJvmModel) {
    bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider")).addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.validation.FeatureNameValidator"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver")).addTypeToType(TypeReference.typeRef(IResourceValidator.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator"));
    if (this.generateXtendInferrer) {
      bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer"), this.getJvmModelInferrer());
    }
  } else {
    bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider"));
  }
  bindingFactory.contributeTo(this.getLanguage().getRuntimeGenModule());
  boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(this.getLanguage().getGrammar());
  if (_inheritsXbaseWithAnnotations) {
    GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule();
    _runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.DefaultXbaseWithAnnotationsRuntimeModule"));
  } else {
    GuiceModuleAccess _runtimeGenModule_1 = this.getLanguage().getRuntimeGenModule();
    _runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule"));
  }
}
 
Example #19
Source File: ScopeRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
  return ScopeLocationInFileProvider.class;
}
 
Example #20
Source File: CheckRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
  return CheckLocationInFileProvider.class;
}
 
Example #21
Source File: AbstractOutlineTreeProvider.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public ILocationInFileProvider getLocationInFileProvider() {
  return locationInFileProvider;
}
 
Example #22
Source File: AbstractSARLRuntimeModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XtendLocationInFileProvider.class;
}
 
Example #23
Source File: ErrorTreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, 
		IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
	return this;
}
 
Example #24
Source File: AbstractPureXbaseRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example #25
Source File: AbstractXbaseRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XbaseLocationInFileProvider.class;
}
 
Example #26
Source File: AbstractXbaseWithAnnotationsRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XbaseLocationInFileProvider.class;
}
 
Example #27
Source File: FeatureCallCompiler.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example #28
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.4
 */
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
	return new TreeAppendable(state, traceURIConverter, locationProvider, jvmModelAssociations, newData, useForDebugging);
}
 
Example #29
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected static ILocationData createLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, EObject object, ILocationInFileProviderExtension.RegionDescription query) {
	return createLocationData(converter, locationProvider, object, query, true);
}
 
Example #30
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
private static Set<ILocationData> createAllLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject object, ILocationInFileProviderExtension.RegionDescription query) {
	return createAllLocationData(converter, locationProvider, jvmModelAssociations, object, query, true);
}