Skip to content

Commit

Permalink
[505930] add implementations for XmlParser methods in EclipseLintClient
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiggott committed Oct 13, 2016
1 parent 5b1a4af commit 21b57ef
Showing 1 changed file with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,37 @@ public void dispose(@NonNull XmlContext context, @NonNull Document document) {
}
}

@Override
public Location getNameLocation(XmlContext arg0, Node arg1) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}

@Override
public Location getValueLocation(XmlContext arg0, Attr arg1) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
@Override
public Location getNameLocation(@NonNull XmlContext context, @NonNull Node node) {
IndexedRegion region = (IndexedRegion) node;

IStructuredModel model = (IStructuredModel) context.getProperty(MODEL_PROPERTY);
// Get line number
LazyLocation location = new LazyLocation(context.file,
model.getStructuredDocument(), region);
int line = location.getStart().getLine();

Position startPos = new DefaultPosition(line, -1, region.getStartOffset());
Position endPos = new DefaultPosition(line, -1, region.getEndOffset());

return Location.create(context.file, startPos, endPos);
}

@Override
public Location getValueLocation(@NonNull XmlContext context, @NonNull Attr attribute) {
IndexedRegion region = (IndexedRegion) attribute;

IStructuredModel model = (IStructuredModel) context.getProperty(MODEL_PROPERTY);
// Get line number
LazyLocation location = new LazyLocation(context.file,
model.getStructuredDocument(), region);
int line = location.getStart().getLine();

Position startPos = new DefaultPosition(line, -1, region.getStartOffset());
Position endPos = new DefaultPosition(line, -1, region.getEndOffset());

return Location.create(context.file, startPos, endPos);
}
};
}

Expand Down

0 comments on commit 21b57ef

Please sign in to comment.