Example usage for org.aspectj.weaver IHasSourceLocation getSourceContext

List of usage examples for org.aspectj.weaver IHasSourceLocation getSourceContext

Introduction

In this page you can find the example usage for org.aspectj.weaver IHasSourceLocation getSourceContext.

Prototype

ISourceContext getSourceContext();

Source Link

Usage

From source file:org.caesarj.compiler.aspectj.CaesarScope.java

License:Open Source License

/**
 * Creates the ISourceLocation for the given location.
 *//*  ww w.ja v a  2 s.c  o m*/
protected ISourceLocation makeSourceLocation(IHasPosition location) {

    if (location instanceof IHasSourceLocation) {
        IHasSourceLocation pattern = (IHasSourceLocation) location;
        ISourceContext sourceContext = pattern.getSourceContext();

        if (sourceContext != null) {
            return pattern.getSourceContext().makeSourceLocation(location);
        }
    }

    if (where != null) {
        return new SourceLocation(where.getPath(), where.getLine());
    } else {
        return new SourceLocation(new File(context.getCClass().getSourceFile()), location.getStart());
    }
}