Example usage for org.eclipse.jdt.internal.core SourceMethod getTypeQualifiedName

List of usage examples for org.eclipse.jdt.internal.core SourceMethod getTypeQualifiedName

Introduction

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

Prototype

public String getTypeQualifiedName(char enclosingTypeSeparator, boolean showParameters)
            throws JavaModelException 

Source Link

Usage

From source file:sidecarviz.core.MonitorEclipse.java

License:BSD License

/**
 * @param sideCarJavaEditor/*from w  w  w. ja  v  a2  s .  c  o  m*/
 * @param method
 */
public void gotEditingMethod(final SideCarJavaEditor sideCarJavaEditor, final SourceMethod method) {
    try {
        // fully qualified has a bug, in that getPackageFragment returns null! :-(
        // use type qualified instead...

        // go up until you find a class....
        // then, prepend the package & class name to the method's name...
        String packageAndClassName = "";
        if (method.getParent().getClass().equals(SourceType.class)) {
            packageAndClassName = ((SourceType) method.getParent()).getFullyQualifiedName();
        }

        final String methodName = method.getTypeQualifiedName('.', true);
        final String fullyQualifiedMethodName = packageAndClassName + "."
                + methodName.substring(methodName.lastIndexOf(".") + 1);

        // TODO: Forward to Flash if it's not the last method we edited
        if (method != lastMethodEdited) {
            DebugUtils.println("Editing Method: " + fullyQualifiedMethodName);
        }
        lastMethodEdited = method;

        // add to hashmap, for later access
        javaEditorEditedMethods.put(fullyQualifiedMethodName, method);
    } catch (JavaModelException e) {
        e.printStackTrace();
    }
}