protected boolean isAssociatedWith(AbstractTraceRegion region, URI uri) { URI convertedUri = traceURIConverter.getURIForTrace(uri); if (convertedUri.equals(region.getAssociatedPath())) return true; return false; }
public byte[] installTrace(byte[] javaClassBytecode) throws IOException { if (trace == null) return null; ClassReader reader = new ClassReader(javaClassBytecode); ClassWriter writer = new ClassWriter(0); URI associatedPath = trace.getAssociatedPath(); if (associatedPath == null) return null; String sourceFile = associatedPath.lastSegment(); int[] target2source = getTargetToSourceLineMapping(trace); XtextClassAdapter adapter = new XtextClassAdapter(writer, sourceFile, target2source, hideSyntheticVariables); reader.accept(adapter, 0); return writer.toByteArray(); }
public TraceRegion(int myOffset, int myLength, int myLineNumber, int myEndLineNumber, ILocationData locationData, @Nullable AbstractTraceRegion parent) { super(new TextRegionWithLineInformation(myOffset, myLength, myLineNumber, myEndLineNumber), locationData, parent); if (myOffset == myLength && myOffset == 0) { throw new IllegalArgumentException(); } if (parent == null) { if (locationData.getPath() == null) { throw new IllegalArgumentException("associatedPath may not be null"); } } else { if (parent.getAssociatedPath() == null && locationData.getPath() == null) { throw new IllegalArgumentException("associatedPath may not be null"); } } }
public TraceRegion(int myOffset, int myLength, int myLineNumber, int myEndLineNumber, List<ILocationData> allLocationData, @Nullable AbstractTraceRegion parent) { super(new TextRegionWithLineInformation(myOffset, myLength, myLineNumber, myEndLineNumber), Lists.newArrayList(allLocationData), parent); if (parent == null) { for(ILocationData locationData: allLocationData) { if (locationData.getPath() == null) { throw new IllegalArgumentException("associatedPath may not be null"); } } } else { boolean nullSeen = false; boolean notNullSeen = false; for(ILocationData locationData: allLocationData) { if (locationData.getPath() == null) { nullSeen = true; } else { notNullSeen = true; } if (nullSeen && notNullSeen) { throw new IllegalArgumentException("list of locations is inconsistent"); } } if (parent.getAssociatedPath() == null) { if (nullSeen) { throw new IllegalArgumentException("list of locations is inconsistent with parent"); } } } }
protected Map<URI, List<Pair<ILocationData, AbstractTraceRegion>>> collectMatchingLocations(@Nullable URI expectedAssociatedPath) { Map<URI, List<Pair<ILocationData, AbstractTraceRegion>>> result = Maps.newHashMapWithExpectedSize(2); Iterator<AbstractTraceRegion> treeIterator = treeIterator(); while(treeIterator.hasNext()) { AbstractTraceRegion next = treeIterator.next(); URI associatedPath = next.getAssociatedPath(); List<Pair<ILocationData, AbstractTraceRegion>> matchingLocations = getCollectingList(associatedPath, expectedAssociatedPath, result); for(ILocationData locationData: next.getAssociatedLocations()) { if (associatedPath == null) { matchingLocations = getCollectingList(locationData.getPath(), expectedAssociatedPath, result); } if (matchingLocations != null) { matchingLocations.add(Tuples.create(locationData, next)); } } } return result; }
protected Set<Integer> createSmapInfo(AbstractTraceRegion targetRegion, Set<LineMapping> lineMappings) { Set<Integer> mapped = newHashSet(); for (AbstractTraceRegion nested : targetRegion.getNestedRegions()) { mapped.addAll(createSmapInfo(nested, lineMappings)); } if (targetRegion.isUseForDebugging()) { ILocationData location = targetRegion.getMergedAssociatedLocation(); if (location != null) { final URI path = targetRegion.getAssociatedPath(); if (path != null) { int myLineNumber = targetRegion.getMyLineNumber(); int myEndLineNumber = targetRegion.getMyEndLineNumber(); for (int i = myLineNumber; i <= myEndLineNumber; i++) { if (!mapped.contains(i)) { final LineMapping e = new LineMapping(location.getLineNumber() + 1, i, i, path); lineMappings.add(e); mapped.add(i); } } } } } return mapped; }
@Nullable public URI getAssociatedPath() { ILocationData data = getMergedAssociatedLocation(); if (data != null) { URI result = data.getPath(); if (result != null) { return result; } } if (parent == null) return null; boolean uriSeen = false; for (ILocationData associated : getAssociatedLocations()) if (associated.getPath() != null) { if (!uriSeen) uriSeen = true; else return null; } return parent.getAssociatedPath(); }
/** * Creates a new location for a target resource that matches the given {@code location}. * @param location the location * @return the location in resource, <code>null</code> detecting a path fails. */ @Nullable protected ILocationInResource createLocationInResourceFor(ILocationData location, AbstractTraceRegion traceRegion) { URI path = location.getPath(); if (path == null) path = traceRegion.getAssociatedPath(); if (path == null) return null; return new LocationInResource(location.getOffset(), location.getLength(), location.getLineNumber(), location.getEndLineNumber(), path, this); }
if (traceToSource == null) continue; URI dslSourceFile = traceToSource.getAssociatedPath();
return getMergedLocationInResource(left); } else { URI leftToPath = left.getAssociatedPath(); URI rightToPath = right.getAssociatedPath(); if (leftToPath != null && leftToPath.equals(rightToPath) || leftToPath == rightToPath) { ITextRegionWithLineInformation leftRegion = left.getMyRegion(); path = leftChild.getAssociatedPath();