Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » relation between IMethod and MethodDeclaration
relation between IMethod and MethodDeclaration [message #171874] Wed, 04 August 2004 13:56 Go to next message
Eclipse UserFriend
Originally posted by: milanstanojevic.sol.co.yu

I am developing plugin which should do some modifications on the selected
method.
I use popup-menus extension point which reacts to
org.eclipse.jdt.core.IMethod types. If selected IMethod is in some
ICompilationUnit (not in class file) then I want to parse its javadoc
comment.
How to do this?
I know I can make an AST using ASTParser on the ICompilationUnit, but is
there a way to quickly map IMethod do MethodDeclaration in the parse tree?
The only thing I can think of searching entire parse tree for
MethodDeclaration which has the same parametars and return type as the
selected IMethod has.

Milan
Re: relation between IMethod and MethodDeclaration [message #171970 is a reply to message #171874] Thu, 05 August 2004 03:32 Go to previous message
Eclipse UserFriend
Currently, there's no API to do this directly. Eclipse refactorings use the
internal method

ASTNodeSearchUtil#getMethodDeclarationNode(IMethod, CompilationUnit)

to do the mapping. It does a binary search in the AST to find the name node
of the method declaration based on IMethod#getNameRange().

Markus

Milan Stanojevic wrote:

> I am developing plugin which should do some modifications on the selected
> method.
> I use popup-menus extension point which reacts to
> org.eclipse.jdt.core.IMethod types. If selected IMethod is in some
> ICompilationUnit (not in class file) then I want to parse its javadoc
> comment.
> How to do this?
> I know I can make an AST using ASTParser on the ICompilationUnit, but is
> there a way to quickly map IMethod do MethodDeclaration in the parse tree?
> The only thing I can think of searching entire parse tree for
> MethodDeclaration which has the same parametars and return type as the
> selected IMethod has.
>
> Milan
>
>
>
>
Previous Topic:How to treat Java files with extension
Next Topic:Error in brace matching
Goto Forum:
  


Current Time: Thu May 22 15:31:35 EDT 2025

Powered by FUDForum. Page generated in 0.02698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top