Examples of SearchRequestor


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

  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

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

  }

  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

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

    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

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

  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

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

  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

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

    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

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

        (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

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

                    return matches.get(potentialAnnotationName);
                }

                try {
                    final List<IAnnotation> matchesForAnnotation = new ArrayList<IAnnotation>();
                    SearchRequestor requestor = new SearchRequestor() {
                        @Override
                        public void acceptSearchMatch(SearchMatch match) throws CoreException {
                            if (match.getElement() instanceof IMethod) {
                                IAnnotation[] annotations = ((IMethod) match.getElement()).getAnnotations();
                                for (IAnnotation annotation : annotations) {
View Full Code Here

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

    }
  }
 
  public static Set<IType> searchForJavaConfigs(SearchPattern pattern, IJavaSearchScope scope) {
    final Set<IType> annotatedTypes = new HashSet<IType>();
    SearchRequestor requestor = new SearchRequestor() {
      @Override
      public void acceptSearchMatch(SearchMatch match) throws CoreException {
        if (match.getAccuracy() == SearchMatch.A_ACCURATE && !match.isInsideDocComment()) {
          Object element = match.getElement();
          if (element instanceof IType) {
View Full Code Here

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

  }

  private IPackageFragment findPackageFragment(String packageName) {
    final List<IPackageFragment> results = new ArrayList<IPackageFragment>();

    SearchRequestor collector = new SearchRequestor() {

      @Override
      public void acceptSearchMatch(SearchMatch match) throws CoreException {
        Object element = match.getElement();
        if (element instanceof IPackageFragment) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.