コード例 #1
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
   */
  public void run() { // (IAction action) {
    SearchDialog dialog =
        new SearchDialog(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            "FLATTT Lucene Analysis",
            "Enter query:",
            FLATTTLuceneAnalysis.getSearchString(),
            null);
    dialog.open();
    if (dialog.getReturnCode() == Window.OK) {

      LuceneIndexer.setIndexDir(
          FLATTT
              .singleton()
              .getStateLocation()
              .append("luceneindex")
              .toFile()); // TODO: should this be the projectname? or do we want one index for the
                          // whole workspace?

      // Do the search when done indexing
      UIJob job = new SearchJob(dialog.getValue());
      FLATTT.nextSearch = job;
      // job.schedule();

      // Index if needed
      try {
        LuceneIndexer.checkIfIndexed();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  };