Search in sources :

Example 1 with Position

use of com.android.tools.lint.detector.api.Position in project android by JetBrains.

the class DomPsiParser method getLocation.

@NonNull
@Override
public Location getLocation(@NonNull XmlContext context, @NonNull Node node, int startDelta, int endDelta) {
    TextRange textRange = DomPsiConverter.getTextRange(node);
    Position start = new LintXmlPosition(node, textRange.getStartOffset() + startDelta);
    Position end = new LintXmlPosition(node, textRange.getStartOffset() + endDelta);
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.lint.detector.api.Position) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Example 2 with Position

use of com.android.tools.lint.detector.api.Position in project android by JetBrains.

the class DomPsiParser method getLocation.

@NonNull
@Override
public Location getLocation(@NonNull XmlContext context, @NonNull Node node) {
    TextRange textRange = DomPsiConverter.getTextRange(node);
    Position start = new LintXmlPosition(node, textRange.getStartOffset());
    Position end = new LintXmlPosition(node, textRange.getEndOffset());
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.lint.detector.api.Position) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Example 3 with Position

use of com.android.tools.lint.detector.api.Position in project android by JetBrains.

the class DomPsiParser method getValueLocation.

@NonNull
@Override
public Location getValueLocation(@NonNull XmlContext context, @NonNull Attr node) {
    TextRange textRange = DomPsiConverter.getTextValueRange(node);
    Position start = new LintXmlPosition(node, textRange.getStartOffset());
    Position end = new LintXmlPosition(node, textRange.getEndOffset());
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.lint.detector.api.Position) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Example 4 with Position

use of com.android.tools.lint.detector.api.Position in project android by JetBrains.

the class DomPsiParser method getNameLocation.

@NonNull
@Override
public Location getNameLocation(@NonNull XmlContext context, @NonNull Node node) {
    TextRange textRange = DomPsiConverter.getTextNameRange(node);
    Position start = new LintXmlPosition(node, textRange.getStartOffset());
    Position end = new LintXmlPosition(node, textRange.getEndOffset());
    return Location.create(context.file, start, end);
}
Also used : Position(com.android.tools.lint.detector.api.Position) TextRange(com.intellij.openapi.util.TextRange) NonNull(com.android.annotations.NonNull)

Aggregations

NonNull (com.android.annotations.NonNull)4 Position (com.android.tools.lint.detector.api.Position)4 TextRange (com.intellij.openapi.util.TextRange)4