Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] question about SearchEngine API

I'm not sure to understand. Do you want the declarations of the types that 
are referenced in a method, or do you want the type references in this 
method?

 If you want the type references in a method, you should use something 
like:
        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new 
IJavaElement[] {method});
        SearchEngine.search(workspace, "*", TYPE, REFERENCES, scope, 
collector);

If you want the declarations of the types that are referenced in a method, 
you should use SearchEngine.searchDeclarationsOfReferencedTypes(...).
In the case of a declaration in a jar, the collector will get the jar file 
or the project as the resource, BUT it will also get an IJavaElement 
corresponding to 
the type declaration.

Jerome




"Adam Kiezun" <adam.kiezun@xxxxxxx>
Sent by: jdt-core-dev-admin@xxxxxxxxxxx
11/15/2001 04:20 PM
Please respond to jdt-core-dev

 
        To:     <jdt-core-dev@xxxxxxxxxxx>
        cc: 
        Subject:        Re: [jdt-core-dev] question about SearchEngine API

> So the resource would be the jar (or the project if it is an external 
jar)
> and the positions would be the
> positions of the declaration 'Set' in the attached source. If there is 
no
> attached source, then the positions
> would be undefined.

hmmm,
i there any other way i can figure out which types are referenced is this 
or
that method? i need this for Pull up method refactoring.
i could walk the ast but that sounds like a heavy-weight solution for a
problem like this.


> But of course it doesn't work that way as captured in bug 5384 search
engine:
> behavior different than expected. This method needs to be rewritten.
:)
yes, i know
the question was more about the future functionality of these methods

thanks Jerome
a.

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev





Back to the top