public void run(IStructuredSelection selection) {
   IMember member = getMember(selection);
   if (!ActionUtil.isProcessable(getShell(), member)) return;
   FindOccurrencesEngine engine = FindOccurrencesEngine.create(new OccurrencesFinder());
   try {
     ISourceRange range = member.getNameRange();
     String result = engine.run(member.getTypeRoot(), range.getOffset(), range.getLength());
     if (result != null) showMessage(getShell(), fActionBars, result);
   } catch (JavaModelException e) {
     JavaPlugin.log(e);
   }
 }
 @Override
 public void run(IStructuredSelection selection) {
   try {
     IMember member = getMember(selection);
     if (member == null || !ActionUtil.isEditable(getShell(), member)) return;
     ISourceRange range = member.getNameRange();
     RefactoringExecutionStarter.startChangeTypeRefactoring(
         member.getCompilationUnit(), getShell(), range.getOffset(), range.getLength());
   } catch (CoreException e) {
     ExceptionHandler.handle(
         e,
         RefactoringMessages.ChangeTypeAction_dialog_title,
         RefactoringMessages.ChangeTypeAction_exception);
   }
 }
  /* (non-JavaDoc)
   * Method declared in SelectionDispatchAction.
   */
  private IMember getMember(IStructuredSelection selection) {
    if (selection.size() != 1) return null;
    Object o = selection.getFirstElement();
    if (o instanceof IMember) {
      IMember member = (IMember) o;
      try {
        if (member.getNameRange() == null) return null;
      } catch (JavaModelException ex) {
        return null;
      }

      IClassFile file = member.getClassFile();
      if (file != null) {
        try {
          if (file.getSourceRange() != null) return member;
        } catch (JavaModelException e) {
          return null;
        }
      }
      return member;
    }
    return null;
  }