/**
  * Convenience method that prompts if the currently active saveable is dirty and either saves or
  * reverts the saveable depending on the users input.
  *
  * @param shell a parent shell
  * @param targetSaveable the new saveable
  * @param activeSaveable the current saveable
  * @param allowCancel whether canceling the action is an option
  * @param monitor a progress monitor
  * @throws CoreException
  * @throws InterruptedException
  */
 public static void handleTargetSaveableChange(
     Shell shell,
     SaveableComparison targetSaveable,
     SaveableComparison activeSaveable,
     boolean allowCancel,
     IProgressMonitor monitor)
     throws CoreException, InterruptedException {
   if (activeSaveable != null && targetSaveable != activeSaveable) {
     if (activeSaveable.isDirty()) {
       if (promptToSaveChanges(shell, activeSaveable, allowCancel)) {
         activeSaveable.doSave(monitor);
       } else {
         activeSaveable.doRevert(monitor);
       }
     }
   }
 }