Search in sources :

Example 26 with ITextRegionWithLineInformation

use of org.eclipse.xtext.util.ITextRegionWithLineInformation in project xtext-core by eclipse.

the class TracingSugar method location.

/**
 * @param obj the EObject containing the feature
 * @param feature the EStructuralFeature to trace
 * @param idx the index of the value to trace, in case the feature contains a list, should be <code>-1</code> otherwise.
 *
 * @return ILocationData covering the <code>fullTextRegion</code> of the given feature in the given EObject.
 */
public ILocationData location(final EObject obj, final EStructuralFeature feature, final int idx) {
    final ITextRegion region = this.locationProvider.getFullTextRegion(obj, feature, idx);
    final SourceRelativeURI uri = this.traceURIConverter.getURIForTrace(obj.eResource());
    return new LocationData(((ITextRegionWithLineInformation) region), uri);
}
Also used : ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) LocationData(org.eclipse.xtext.generator.trace.LocationData) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) ITextRegion(org.eclipse.xtext.util.ITextRegion) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI)

Aggregations

ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)26 Test (org.junit.Test)14 TextRegionWithLineInformation (org.eclipse.xtext.util.TextRegionWithLineInformation)5 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)4 Mode (org.eclipse.xtext.resource.locationprovidertest.Mode)4 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)3 ILocationData (org.eclipse.xtext.generator.trace.ILocationData)3 INode (org.eclipse.xtext.nodemodel.INode)3 Bus (org.eclipse.xtext.resource.locationprovidertest.Bus)3 Processor (org.eclipse.xtext.resource.locationprovidertest.Processor)3 ITextRegion (org.eclipse.xtext.util.ITextRegion)3 EObject (org.eclipse.emf.ecore.EObject)2 LocationData (org.eclipse.xtext.generator.trace.LocationData)2 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Matcher (java.util.regex.Matcher)1 URI (org.eclipse.emf.common.util.URI)1 RootTraceRegionForTesting (org.eclipse.xtend.core.tests.compiler.RootTraceRegionForTesting)1 SimpleTrace (org.eclipse.xtend.core.tests.compiler.SimpleTrace)1