public void run(IAction action) {
    boolean okay = false;
    if (fEditor instanceof ITextEditor) {
      ITextEditor textEditor = (ITextEditor) fEditor;
      IDocument document =
          textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
      if (document != null) {
        ITextSelection textSelection = getTextSelection(textEditor);
        FindOccurrencesProcessor findOccurrenceProcessor =
            getProcessorForCurrentSelection(document, textSelection);
        if (findOccurrenceProcessor != null) {
          if (textEditor.getEditorInput() instanceof IFileEditorInput) {
            IFile file = ((IFileEditorInput) textEditor.getEditorInput()).getFile();
            okay = findOccurrenceProcessor.findOccurrences(document, textSelection, file);
          }
        }
      }
    }
    if (okay) {
      // clear status message
      PlatformStatusLineUtil.clearStatusLine();
    } else {
      String errorMessage = SSEUIMessages.FindOccurrencesActionProvider_0; // $NON-NLS-1$
      if (fEditor instanceof StructuredTextEditor) {
        PlatformStatusLineUtil.displayTemporaryErrorMessage(
            ((StructuredTextEditor) fEditor).getTextViewer(), errorMessage);

      } else {
        PlatformStatusLineUtil.displayErrorMessage(errorMessage);
        PlatformStatusLineUtil.addOneTimeClearListener();
      }
    }
  }
 public void selectionChanged(IAction action, ISelection selection) {
   // clear status message
   PlatformStatusLineUtil.clearStatusLine();
 }