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

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

Introduction

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

Prototype

@Override
public String getElementName() 

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  w  w  .  j a va  2s.  c  om*/
    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;
}