Tutorial :AST usage in search button of eclipse


I want to know how AST(Abstract Syntax Tree ) is used in the search button of eclipse.Can anyone provide me the link or some info about it .Help


This is a small example for that:

 SearchPattern pattern = SearchPattern.createPattern(fTarget.getDeclaringType()           .getFullyQualifiedName()           + "." + fTarget.getElementName(), type, IJavaSearchConstants.REFERENCES,           SearchPattern.R_PREFIX_MATCH | SearchPattern.R_ERASURE_MATCH);   SearchEngine engine = new SearchEngine();   engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() },           scope, new SearchRequestor() {                 @Override public void acceptSearchMatch(SearchMatch match) throws CoreException {                   if (match.getAccuracy() == SearchMatch.A_ACCURATE && !match.isInsideDocComment()) {                       invocations.add(match);                   }               }           }, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));  


Here is one link that I found:

The Abstract Syntax Tree is the base framework for many powerful tools of the Eclipse IDE, including refactoring, Quick Fix and Quick Assist. The Abstract Syntax Tree maps plain Java source code in a tree form. This tree is more convenient and reliable to analyse and modify programmatically than text-based source. This article shows how you can use the Abstract Syntax Tree for your own applications.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »