/**
  * Check to see if the target saveable differs from the currently active saveable. If it does,
  * prompt to save changes in the active saveable if it is dirty.
  *
  * @throws InterruptedException
  * @throws InvocationTargetException
  */
 protected void handleTargetSaveableChange()
     throws InvocationTargetException, InterruptedException {
   final SaveableComparison targetSaveable = getTargetSaveable();
   final SaveableComparison activeSaveable = getActiveSaveable();
   if (activeSaveable != null && activeSaveable.isDirty()) {
     PlatformUI.getWorkbench()
         .getProgressService()
         .run(
             true,
             true,
             new IRunnableWithProgress() {
               @Override
               public void run(IProgressMonitor monitor)
                   throws InvocationTargetException, InterruptedException {
                 try {
                   handleTargetSaveableChange(
                       configuration.getSite().getShell(),
                       targetSaveable,
                       activeSaveable,
                       true,
                       monitor);
                 } catch (CoreException e) {
                   throw new InvocationTargetException(e);
                 }
               }
             });
   }
   setActiveSaveable(targetSaveable);
 }
 /**
  * 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);
       }
     }
   }
 }