Java Code Examples for org.eclipse.xtext.resource.ILocationInFileProvider

The following examples show how to use org.eclipse.xtext.resource.ILocationInFileProvider. 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: gef   Source File: DotFoldingRegionProvider.java    License: 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 Project: xtext-extras   Source File: TreeAppendable.java    License: 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 3
Source Project: xtext-extras   Source File: TreeAppendable.java    License: 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 4
Source Project: xtext-extras   Source File: TreeAppendable.java    License: 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 5
Source Project: xtext-extras   Source File: ErrorTreeAppendable.java    License: 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 6
@Override
public void setUp() throws Exception {
	super.setUp();
	with(XtextStandaloneSetup.class);
	grammar = (Grammar) getModel(grammarText);
	locationInFileProvider = get(ILocationInFileProvider.class);
}
 
Example 7
Source Project: n4js   Source File: N4JSRuntimeModule.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Bind the {@link ILocationInFileProvider} that is aware of derived elements.
 */
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return N4JSLocationInFileProvider.class;
}
 
Example 8
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 9
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XbaseLocationInFileProvider.class;
}
 
Example 10
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return XbaseLocationInFileProvider.class;
}
 
Example 11
Source Project: xtext-extras   Source File: FeatureCallCompiler.java    License: Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example 12
Source Project: xtext-extras   Source File: TreeAppendable.java    License: 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 13
Source Project: xtext-extras   Source File: TreeAppendable.java    License: 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 14
Source Project: xtext-extras   Source File: TreeAppendable.java    License: 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);
}
 
Example 15
Source Project: xtext-extras   Source File: ErrorTreeAppendable.java    License: 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 16
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
	if (!usesXbaseGrammar(grammar))
		return emptySet();
	BindFactory config = new BindFactory()
					
			// overrides binding from org.eclipse.xtext.generator.exporting.QualifiedNamesFragment
			.addTypeToType(IQualifiedNameProvider.class.getName(),
							"org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider");
			
	if (useInferredJvmModel) {
		config = config
				.addTypeToType(ILocationInFileProvider.class.getName(),
						"org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider")
				.addTypeToType(IGlobalScopeProvider.class.getName(),
						"org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")
				.addTypeToType("org.eclipse.xtext.xbase.validation.FeatureNameValidator",
						"org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator")
				.addTypeToType("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver",
						"org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver")
				.addTypeToType("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver",
						"org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver")
				.addTypeToType(IResourceValidator.class.getCanonicalName(), 
						"org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator");
		if(generateXtendInferrer) {
			config = config
				.addTypeToType("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer",
					getJvmModelInferrerName(grammar, getNaming()));
		}
	} else {
		config = config
				.addTypeToType(ILocationInFileProvider.class.getName(),
							"org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider");

	}
	if (usesXImportSection(grammar)) {
		config = config.addConfiguredBinding(
				IScopeProvider.class.getName() + "Delegate",
				"binder.bind("
						+ IScopeProvider.class.getName()
						+ ".class).annotatedWith(com.google.inject.name.Names.named("
						+ AbstractDeclarativeScopeProvider.class.getName()
						+ ".NAMED_DELEGATE)).to("+ getImportScopeProvider(grammar)+")");
	}
	return config.getBindings();
}
 
Example 17
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 18
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 19
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 20
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 21
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 22
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}
 
Example 23
/**
 * For testing.
 */
public DefaultOutlineTreeProvider(ILabelProvider labelProvider, ILocationInFileProvider locationInFileProvider) {
	this.labelProvider = labelProvider;
	this.locationInFileProvider = locationInFileProvider;
}
 
Example 24
Source Project: xtext-eclipse   Source File: OutlineNodeFactory.java    License: Eclipse Public License 2.0 4 votes vote down vote up
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example 25
@Deprecated
public DefaultFoldingRegionProvider(ILocationInFileProvider locationInFileProvider) {
	this.locationInFileProvider = locationInFileProvider;
	this.tokenTypeToPartitionTypeMapperExtension = new TerminalsTokenTypeToPartitionMapper();
}
 
Example 26
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example 27
public void setLocationProvider(ILocationInFileProvider locationProvider) {
	this.locationProvider = locationProvider;
}
 
Example 28
public ILocationInFileProvider getLocationProvider() {
	return locationProvider;
}
 
Example 29
protected ILocationInFileProvider getLocationInFileProvider() {
	return locationInFileProvider;
}
 
Example 30
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
	return JvmLocationInFileProvider.class;
}