示例#1
0
 private void performNewSearch(final IErlElement element) {
   final ErlangExternalFunctionCallRef ref = SearchUtil.getRefFromErlElement(element);
   final ErlSearchQuery query =
       new ErlSearchQuery(
           ref, IErlSearchConstants.REFERENCES, IErlSearchConstants.FUNCTION, getScope());
   if (query.canRunInBackground()) {
     /*
      * This indirection with Object as parameter is needed to prevent
      * the loading of the Search plug-in: the VM verifies the method
      * call and hence loads the types used in the method signature,
      * eventually triggering the loading of a plug-in (in this case
      * ISearchQuery results in Search plug-in being loaded).
      */
     NewSearchUI.runQueryInBackground(query);
   } else {
     final IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
     /*
      * This indirection with Object as parameter is needed to prevent
      * the loading of the Search plug-in: the VM verifies the method
      * call and hence loads the types used in the method signature,
      * eventually triggering the loading of a plug-in (in this case it
      * would be ISearchQuery).
      */
     final IStatus status = NewSearchUI.runQueryInForeground(progressService, query);
     if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
       ErrorDialog.openError(
           getShell(),
           "SearchMessages.Search_Error_search_title",
           "SearchMessages.Search_Error_search_message",
           status);
     }
   }
 }