private String getSearchPatternDescription() {
   if (patternData.hasElement()) {
     DartElement element = ((ElementQuerySpecification) patternData).getElement();
     return DartElementLabels.getElementLabel(
         element,
         DartElementLabels.ALL_DEFAULT
             | DartElementLabels.ALL_FULLY_QUALIFIED
             | DartElementLabels.USE_RESOLVED);
   } else if (patternData.hasNode()) {
     // TODO(messick): Make this better, if needed.
     DartNode node = ((NodeQuerySpecification) patternData).getNode();
     if (node instanceof DartIdentifier) {
       return ((DartIdentifier) node).getName();
     } else {
       return node.getObjectIdentifier();
     }
   }
   return BasicElementLabels.getFilePattern(
       ((PatternQuerySpecification) patternData).getPattern());
 }
  @Override
  public IStatus run(IProgressMonitor monitor) {
    final DartSearchResult textResult = (DartSearchResult) getSearchResult();
    textResult.removeAll();
    SearchEngine engine = SearchEngineFactory.createSearchEngine();

    //  try {
    //  int totalTicks= 1000;
    // TODO (pquitslund): add search participant support
    //  IProject[] projects=
    // JavaSearchScopeFactory.getInstance().getProjects(fPatternData.getScope());
    //  final SearchParticipantRecord[] participantDescriptors=
    // SearchParticipantsExtensionPoint.getInstance().getSearchParticipants(projects);
    //  final int[] ticks= new int[participantDescriptors.length];
    //  for (int i= 0; i < participantDescriptors.length; i++) {
    //    final int iPrime= i;
    //    ISafeRunnable runnable= new ISafeRunnable() {
    //      public void handleException(Throwable exception) {
    //        ticks[iPrime]= 0;
    //        String message= SearchMessages.JavaSearchQuery_error_participant_estimate;
    //        DartToolsPlugin.log(new Status(IStatus.ERROR, DartToolsPlugin.getPluginId(), 0,
    // message, exception));
    //      }
    //
    //      public void run() throws Exception {
    //        ticks[iPrime]=
    // participantDescriptors[iPrime].getParticipant().estimateTicks(fPatternData);
    //      }
    //    };
    //
    //    SafeRunner.run(runnable);
    //    totalTicks+= ticks[i];
    //  }

    SearchResultCollector collector = new SearchResultCollector(textResult);
    SearchScope scope = patternData.getScope();

    if (patternData.hasElement()) {
      DartElement element = ((ElementQuerySpecification) patternData).getElement();
      if (!element.exists()) {
        String patternString =
            DartElementLabels.getElementLabel(element, DartElementLabels.ALL_DEFAULT);
        return new Status(
            IStatus.ERROR,
            DartToolsPlugin.getPluginId(),
            0,
            Messages.format(
                SearchMessages.DartSearchQuery_error_element_does_not_exist, patternString),
            null);
      }

      try {
        if (patternData.isReferencesSearch()) {
          searchForReferences(engine, element, scope, null, collector, monitor);
        }
        if (patternData.isDeclarationsSearch()) {
          searchForDeclarations(engine, element, scope, null, collector, monitor);
        }
        if (patternData.isOverridesSearch()) {
          searchForOverrides(engine, element, scope, null, collector, monitor);
        }
      } catch (SearchException e) {
        DartToolsPlugin.log(e);
        // TODO: do we need to update the UI as well? Or schedule another search?
      } catch (CoreException ex) {
        DartToolsPlugin.log(ex);
      }

    } else if (patternData.hasNode()) {

      DartNode node = ((NodeQuerySpecification) patternData).getNode();
      if (node instanceof DartIdentifier) {
        DartIdentifier id = (DartIdentifier) node;

        try {
          if (patternData.isReferencesSearch()) {
            searchForReferences(engine, id, scope, null, collector, monitor);
          }
          if (patternData.isDeclarationsSearch()) {
            searchForDeclarations(engine, id, scope, null, collector, monitor);
          }
        } catch (SearchException e) {
          DartToolsPlugin.log(e);
        } catch (CoreException ex) {
          DartToolsPlugin.log(ex);
        }
      }
    }

    //      engine.search(pattern, new SearchParticipant[] {
    // SearchEngine.getDefaultSearchParticipant() }, fPatternData.getScope(), collector,
    // mainSearchPM);
    // TODO (pquitslund): add search participant support
    //      for (int i= 0; i < participantDescriptors.length; i++) {
    //        final ISearchRequestor requestor= new
    // SearchRequestor(participantDescriptors[i].getParticipant(), textResult);
    //        final IProgressMonitor participantPM= new SubProgressMonitor(monitor, ticks[i]);
    //
    //        final int iPrime= i;
    //        ISafeRunnable runnable= new ISafeRunnable() {
    //          public void handleException(Throwable exception) {
    //            participantDescriptors[iPrime].getDescriptor().disable();
    //            String message= SearchMessages.JavaSearchQuery_error_participant_search;
    //            DartToolsPlugin.log(new Status(IStatus.ERROR, DartToolsPlugin.getPluginId(), 0,
    // message, exception));
    //          }
    //
    //          public void run() throws Exception {
    //
    //            final IQueryParticipant participant=
    // participantDescriptors[iPrime].getParticipant();
    //            final PerformanceStats stats= PerformanceStats.getStats(PERF_SEARCH_PARTICIPANT,
    // participant);
    //            stats.startRun();
    //
    //            participant.search(requestor, fPatternData, participantPM);
    //
    //            stats.endRun();
    //          }
    //        };

    //        SafeRunner.run(runnable);
    //      }

    //    } catch (CoreException e) {
    //      return e.getStatus();
    //    }

    String message =
        Messages.format(
            SearchMessages.DartSearchQuery_status_ok_message,
            String.valueOf(textResult.getMatchCount()));
    return new Status(IStatus.OK, DartToolsPlugin.getPluginId(), 0, message, null);
  }