Package org.eclipse.jdt.core.search

Examples of org.eclipse.jdt.core.search.SearchRequestor


        IJavaElement element = elementQuery.getElement();
       
        if(DEBUG)
          System.out.println("JSP Query Participant searching on ELEMENT: " + element); //$NON-NLS-1$
       
        SearchRequestor jspRequestor = new JSPSearchRequestor(requestor);
       
        // pa_TODO need to adapt JavaSearchScope to a JSPSearchScope
        JSPSearchSupport.getInstance().search(element, new JSPSearchScope(), jspRequestor, monitor);
       
      }
      else if(querySpecification instanceof PatternQuerySpecification) {
       
        // pattern search (eg. from Java search page)
        PatternQuerySpecification patternQuery = (PatternQuerySpecification)querySpecification;
        String pattern = patternQuery.getPattern();
       
        if(DEBUG)
          System.out.println("JSP Query Participant searching on PATTERN: " + pattern); //$NON-NLS-1$
       
        SearchRequestor jspRequestor = new JSPSearchRequestor(requestor);
       
        JSPSearchSupport.getInstance().search(pattern,
                            new JSPSearchScope(),
                            patternQuery.getSearchFor(),
                            patternQuery.getLimitTo(),
View Full Code Here


       
    try {
     
      MethodSearchRequestor.initializeParserMap();
     
          SearchRequestor searchRequestor =  (SearchRequestor)new MethodSearchRequestor.MethodReferencesSearchRequestor();
     
            SearchEngine searchEngine = new SearchEngine();

            IProgressMonitor monitor = new SubProgressMonitor(progressMonitor, 5, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
           
View Full Code Here

        }
    }
   
    public static Collection/*<MethodUnitPair>*/ findDeclarations(IProgressMonitor progressMonitor, String methodName, IJavaProject project, boolean isConstructor) {
        try {
            SearchRequestor searchRequestor = new MethodSearchRequestor.MethodDeclarationsSearchRequestor();
            SearchEngine searchEngine = new SearchEngine();

            IProgressMonitor monitor = new SubProgressMonitor(
                    progressMonitor, 5, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
            monitor.beginTask("Searching for calls to " +
View Full Code Here

  private void commenceSearch(SearchEngine engine,
      SearchPattern pattern, IJavaSearchScope scope,
      final SearchMatchPurpose purpose,
      IProgressMonitor monitor) throws CoreException {
    engine.search(pattern, new SearchParticipant[] { SearchEngine
        .getDefaultSearchParticipant() }, scope, new SearchRequestor() {

      public void acceptSearchMatch(SearchMatch match)
          throws CoreException {
        if (match.getAccuracy() == SearchMatch.A_ACCURATE
            && !match.isInsideDocComment())
View Full Code Here

  }

  private void findParameters(final int paramNumber, SearchPattern pattern)
      throws CoreException {

    final SearchRequestor requestor = new SearchRequestor() {

      public void acceptSearchMatch(SearchMatch match)
          throws CoreException {
        if (match.getAccuracy() == SearchMatch.A_ACCURATE
            && !match.isInsideDocComment()) {
View Full Code Here

    while (this.wl.hasNext()) {
      final IJavaElement je = (IJavaElement) this.wl.next();
      final SearchPattern pattern = SearchPattern.createPattern(je,
          IJavaSearchConstants.ALL_OCCURRENCES,
          SearchPattern.R_EXACT_MATCH);
      final SearchRequestor requestor = new SearchRequestor() {
        public void acceptSearchMatch(SearchMatch match)
            throws CoreException {
          if (match.getAccuracy() == SearchMatch.A_ACCURATE
              && !match.isInsideDocComment()) {
            ASTNode node = Util.getExactASTNode(match,
                EnumerizationComputer.this.monitor);
            ASTNodeProcessor processor = new ASTNodeProcessor(node,
                EnumerizationComputer.this.constFields,
                EnumerizationComputer.this.scope,
                EnumerizationComputer.this.monitor);
            processor.process();
            EnumerizationComputer.this.wl.addAll(processor
                .getFound());
            Collection infixCol = (Collection) EnumerizationComputer.this.elemToLegalInfixExpressionSourceRangeMap
                .get(je);
            if (infixCol == null)
              EnumerizationComputer.this.elemToLegalInfixExpressionSourceRangeMap
                  .put(
                      je,
                      processor
                          .getLegalEncounteredInfixExpressionSourceLocations());
            else
              infixCol
                  .addAll(processor
                      .getLegalEncounteredInfixExpressionSourceLocations());
          }
        }
      };

      try {
        this.searchEngine.search(pattern,
            new SearchParticipant[] { SearchEngine
                .getDefaultSearchParticipant() }, this.scope,
            requestor, new SubProgressMonitor(this.monitor, 1,
                SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));

        // Work around for bug 164121. Force match for formal
        // parameters.
        if (je.getElementType() == IJavaElement.LOCAL_VARIABLE) {
          final ISourceRange isr = ((ILocalVariable) je)
              .getNameRange();
          final SearchMatch match = new SearchMatch(je,
              SearchMatch.A_ACCURATE, isr.getOffset(), isr
                  .getLength(), SearchEngine
                  .getDefaultSearchParticipant(), je
                  .getResource());
          requestor.acceptSearchMatch(match);
        }
      } catch (final DefinitelyNotEnumerizableException E) {
        this.defNotEnumConstants.addAll(this.wl
            .getCurrentComputationTreeElements());
        this.nonEnumerizableList.addAll(this.wl
View Full Code Here

  private void assertAndVisit() {
    assertAndVisit(SearchJavaClassFromDocTagVisitorTest.type);
  }
 
  private void assertAndVisit(IType type) {
    SearchRequestor requester = new SearchRequestor(){
      @Override
      public void acceptSearchMatch(SearchMatch match) throws CoreException {
        Object element = match.getElement();
        if (element instanceof IType) {
          IType type = (IType) element;
View Full Code Here

  public void learning_SearchEngine() throws Exception {
    SearchEngine engine = new SearchEngine();
    IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
    SearchPattern pattern = SearchPattern.createPattern("TestClass2", IJavaSearchConstants.CLASS, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_FULL_MATCH);
    SearchParticipant[] participants = new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()};
    SearchRequestor requestor = new SearchRequestor(){
   
      @Override
      public void acceptSearchMatch(SearchMatch match) throws CoreException {
        Object element = match.getElement();
        System.out.println(element.getClass().getName());
View Full Code Here

    int matchType = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
    IJavaSearchScope scope = SearchEngine.createJavaSearchScope(
        srcs.toArray(new IJavaElement[srcs.size()]));
    SearchPattern pattern =
      SearchPattern.createPattern("main(String[])", type, context, matchType);
    SearchRequestor requestor = new SearchRequestor(){
      public void acceptSearchMatch(SearchMatch match){
        if(match.getAccuracy() != SearchMatch.A_ACCURATE){
          return;
        }
View Full Code Here

        (packageFrag, IJavaSearchConstants.PACKAGE , IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH);
    IJavaSearchScope scope = SearchEngine.createJavaSearchScope(javaProject.getPackageFragments());
   
    final List<CucumberAnnotation> annotations = new ArrayList<CucumberAnnotation>();
   
    SearchRequestor requestor = new SearchRequestor() {
      public void acceptSearchMatch(SearchMatch match) {
        try {
          if (match.getAccuracy() == SearchMatch.A_ACCURATE) {
            IPackageFragment frag = (IPackageFragment) match.getElement();
            for (IClassFile cls : frag.getClassFiles()) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.search.SearchRequestor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.