[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: problems with searching for references

You correctly use Search Engine, but it just cannot find references in
non-Java files...

When you said that Eclipse finds references in plugin.xml, I guess you
mean that using the 'File Search' of Eclipse, then you found matches...
But this kind of search is a text search inside file contents (like
Windows search in fact) which is different from Java Search...

Rudolf Ziegaus wrote:
Hello,

I want to search for references for a class or a method. I do this via

getSearchEngine().search(pattern, getParticipants(), searchScope, searchRequestor, monitor);

where the pattern has been created with


pattern = SearchPattern.createPattern(element, JavaSearchConstants.REFERENCES);


and the searchScope has been created with

searchScope = SearchEngine.createJavaSearchScope(javaProjects);
javaProjects is a array of IJavaProject, that the user selects.


Now when I use this approach on classes I will find all references in java
source code, but I miss references in plugin.xml.
Eclipse itself however also finds the reference to plugin.xml when I search
the same projects via "references".

I thought that maybe the way I create my searchscope might be wrong, so I
tried SearchEngine.createWorkspaceScope(), but to no avail. I also tried
variations of the createPattern method, but again I had no success.

Can anybody give me a hint which approach I need to take in order to also
find references to a class in plugin.xml?


TIA,

Rudi