Example usage for org.eclipse.jdt.core IMethod getClassFile

List of usage examples for org.eclipse.jdt.core IMethod getClassFile

Introduction

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

Prototype

IClassFile getClassFile();

Source Link

Document

Returns the class file in which this member is declared, or null if this member is not declared in a class file (for example, a source type).

Usage

From source file:org.jnario.spec.ui.wizards.SpecCreator.java

License:Open Source License

private String signature(IMethod method, IJvmTypeProvider typeProvider) {
    String typeName = method.getClassFile().getType().getFullyQualifiedName();
    JvmGenericType type = (JvmGenericType) typeProvider.findTypeByName(typeName);
    for (JvmOperation operation : filter(type.getMembers(), JvmOperation.class)) {
        IJavaElement javaElement = javaElementFinder.findElementFor(operation);
        if (javaElement.equals(method)) {
            return nameProvider.apply(operation).getFirstSegment();
        }/*from w  ww. j ava 2  s  . c  o m*/
    }
    throw new IllegalStateException("Could not resolve JVM identifiable for " + method);
}