Package org.springframework.ide.eclipse.beans.ui.search.internal

Examples of org.springframework.ide.eclipse.beans.ui.search.internal.BeansSearchResult


    }

    for (ISearchQuery query : queries) {
      query.run(monitor);

      BeansSearchResult searchResult = (BeansSearchResult) query.getSearchResult();
      for (Object obj : searchResult.getElements()) {
        Match[] matches = searchResult.getMatches(obj);
        if (matches != null && matches.length > 0) {
          for (Match match : matches) {
            if (match.getElement() instanceof IBean) {
              IBean bean = (IBean) match.getElement();
              IType type = JdtUtils.getJavaType(bean.getElementResource().getProject(), bean
View Full Code Here


    return pattern;
  }

  public final ISearchResult getSearchResult() {
    if (result == null) {
      result = new BeansSearchResult(this);
    }
    return result;
  }
View Full Code Here

  public boolean canRunInBackground() {
    return true;
  }

  public final IStatus run(IProgressMonitor monitor) {
    final BeansSearchResult result = (BeansSearchResult) getSearchResult();
    result.removeAll();
    for (IModelElement element : scope.getModelElements()) {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException();
      }
      IModelElementVisitor visitor = new IModelElementVisitor() {
        public boolean visit(IModelElement element,
            IProgressMonitor monitor) {
          if (doesMatch(element, compiledPattern, monitor)) {
            int startLine;
            int lines;
            if (element instanceof ISourceModelElement) {
              ISourceModelElement sourceElement =
                (ISourceModelElement) element;
              startLine = sourceElement.getElementStartLine();
              lines = sourceElement.getElementEndLine()
                  - startLine + 1;
            } else {
              startLine = -1;
              lines = -1;
            }
            Match match = new Match(element, Match.UNIT_LINE,
                startLine, lines);
            result.addMatch(match);
          }
          return true;
        }
      };
      element.accept(visitor, monitor);
    }
    Object[] args = new Object[] { new Integer(result.getMatchCount()) };
    String message = MessageUtils.format(
        BeansSearchMessages.SearchQuery_status, args);
    return new Status(IStatus.OK, BeansSearchPlugin.PLUGIN_ID, 0, message,
        null);
  }
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.beans.ui.search.internal.BeansSearchResult

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.