Example usage for org.eclipse.jdt.internal.core JavaElement getClassFile

List of usage examples for org.eclipse.jdt.internal.core JavaElement getClassFile

Introduction

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

Prototype

public IClassFile getClassFile() 

Source Link

Usage

From source file:qwickie.builder.QWickieBuilder.java

License:Apache License

private int getJavaLine(final JavaElement je, final String wid) {
    Assert.isNotNull(je);/*from  w  ww .j a v a 2  s . com*/
    try {
        if (je instanceof ResolvedBinaryType) {
            ResolvedBinaryType rbt = (ResolvedBinaryType) je;
            String source = rbt.getSource(); // try to get the source
            // shorten search for know wicket:ids
            if ((je.getElementName().equals("FilterToolbar")
                    && ("focus-tracker".equals(wid) || "focus-restore".equals(wid)))
                    || ("cols".equals(wid) && je.getElementName().equals("GridView"))) {
                return 1;
            }
            return getJavaLine(source, wid);
        }
        if (je instanceof ResolvedSourceType) {
            return getJavaLine(((ResolvedSourceType) je).getSource(), wid);
        }
        return getJavaLine(je.getClassFile().getSource(), wid);
    } catch (final JavaModelException e) {
    }
    return -1;
}