/*
   * @return <code>true</code> if compare result is OK to show, <code>false</code> otherwise
   */
  public boolean compareResultOK(CompareEditorInput input, IRunnableContext context) {
    final Shell shell = getShell();
    try {

      // run operation in separate thread and make it cancelable
      if (context == null) context = PlatformUI.getWorkbench().getProgressService();
      context.run(true, true, input);

      String message = input.getMessage();
      if (message != null) {
        MessageDialog.openError(
            shell, Utilities.getString("CompareUIPlugin.compareFailed"), message); // $NON-NLS-1$
        return false;
      }

      if (input.getCompareResult() == null) {
        MessageDialog.openInformation(
            shell,
            Utilities.getString("CompareUIPlugin.dialogTitle"),
            Utilities.getString("CompareUIPlugin.noDifferences")); // $NON-NLS-2$ //$NON-NLS-1$
        return false;
      }

      return true;

    } catch (InterruptedException x) {
      // canceled by user
    } catch (InvocationTargetException x) {
      MessageDialog.openError(
          shell,
          Utilities.getString("CompareUIPlugin.compareFailed"),
          x.getTargetException().getMessage()); // $NON-NLS-1$
    }
    return false;
  }
 public IStatus prepareInput(CompareEditorInput input, IProgressMonitor monitor) {
   try {
     input.run(monitor);
     String message = input.getMessage();
     if (message != null) {
       return new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, message, null);
     }
     if (input.getCompareResult() == null) {
       return new Status(
           IStatus.ERROR,
           CompareUIPlugin.PLUGIN_ID,
           NO_DIFFERENCE,
           Utilities.getString("CompareUIPlugin.noDifferences"),
           null); //$NON-NLS-1$
     }
     return Status.OK_STATUS;
   } catch (InterruptedException e) {
     throw new OperationCanceledException();
   } catch (InvocationTargetException e) {
     return new Status(
         IStatus.ERROR,
         CompareUIPlugin.PLUGIN_ID,
         0,
         Utilities.getString("CompareUIPlugin.compareFailed"),
         e.getTargetException()); // $NON-NLS-1$
   }
 }