Example usage for org.eclipse.jdt.internal.core SourceMapper UNKNOWN_RANGE

List of usage examples for org.eclipse.jdt.internal.core SourceMapper UNKNOWN_RANGE

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core SourceMapper UNKNOWN_RANGE.

Prototype

SourceRange UNKNOWN_RANGE

To view the source code for org.eclipse.jdt.internal.core SourceMapper UNKNOWN_RANGE.

Click Source Link

Document

The unknown source range {-1, 0}

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java

License:Open Source License

protected void reportBinaryMemberDeclaration(IResource resource, IMember binaryMember,
        Binding binaryMemberBinding, IBinaryType info, int accuracy) throws CoreException {
    ClassFile classFile = (ClassFile) binaryMember.getClassFile();
    ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
    if (range.getOffset() == -1) {
        BinaryType type = (BinaryType) classFile.getType();
        String sourceFileName = type.sourceFileName(info);
        if (sourceFileName != null) {
            SourceMapper mapper = classFile.getSourceMapper();
            if (mapper != null) {
                char[] contents = mapper.findSource(type, sourceFileName);
                if (contents != null)
                    range = mapper.mapSource(type, contents, info, binaryMember);
            }/*from   w  w w .j a  va  2  s .  co  m*/
        }
    }
    if (resource == null)
        resource = this.currentPossibleMatch.resource;
    SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(),
            range.getLength(), getParticipant(), resource);
    report(match);
}