Example usage for org.eclipse.jdt.core.dom BodyDeclaration getLocationInParent

List of usage examples for org.eclipse.jdt.core.dom BodyDeclaration getLocationInParent

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom BodyDeclaration getLocationInParent.

Prototype

public final StructuralPropertyDescriptor getLocationInParent() 

Source Link

Document

Returns the location of this node within its parent, or null if this is a root node.

Usage

From source file:edu.illinois.jflow.core.transformations.code.ExtractClosureRefactoring.java

License:Open Source License

private void createMethodBundle(final CompilationUnitChange result) {
    BodyDeclaration methodDecl = locateSelectedMethod();

    TextEditGroup insertClassDesc = new TextEditGroup(
            JFlowRefactoringCoreMessages.ExtractClosureRefactoring_bundle_textedit_description);
    result.addTextEditGroup(insertClassDesc);

    BundleCreator bc = new BundleCreator(stages.values());
    AbstractTypeDeclaration newClass = bc.createNewNestedClass();

    ChildListPropertyDescriptor methodDeclDescriptor = (ChildListPropertyDescriptor) methodDecl
            .getLocationInParent();/* www. j  a v a2s  .  c  o  m*/
    ListRewrite methodDeclContainer = fRewriter.getListRewrite(methodDecl.getParent(), methodDeclDescriptor);
    methodDeclContainer.insertBefore(newClass, methodDecl, insertClassDesc);
}