@Override
 public void replayRefactoring(RefactoringDescriptor refactoringDescriptor) throws CoreException {
   try {
     // FIXME: This is a temporary hack. It is required to overcome the problem that sometimes
     // Eclipse does not finish updating
     // program's structure yet, and thus, the refactoring can not be properly initialized (i.e.
     // the refactored element is not found).
     // Find a better solution, e.g. listen for some Eclipse "refreshing" process to complete.
     Thread.sleep(1500);
   } catch (InterruptedException e) {
     // do nothing
   }
   RefactoringStatus initializationStatus = new RefactoringStatus();
   Refactoring refactoring = refactoringDescriptor.createRefactoring(initializationStatus);
   if (!initializationStatus.isOK()) {
     Debugger.debugWarning(
         "Failed to initialize a refactoring from its descriptor: " + refactoringDescriptor);
     unperformedRefactorings.add(getTime());
     return;
   }
   // This remove is needed to ensure that multiple replays in the same run do not overlap
   unperformedRefactorings.remove(getTime());
   PerformRefactoringOperation performRefactoringOperation =
       new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
   performRefactoringOperation.run(null);
   if (performRefactoringOperation.getConditionStatus().hasFatalError()) {
     throw new RuntimeException(
         "Failed to check preconditions of refactoring: " + refactoring.getName());
   }
   if (performRefactoringOperation.getValidationStatus().hasFatalError()) {
     throw new RuntimeException("Failed to validate refactoring: " + refactoring.getName());
   }
 }
 protected final Refactoring createRefactoring(RefactoringDescriptor descriptor)
     throws CoreException {
   RefactoringStatus status = new RefactoringStatus();
   Refactoring refactoring = descriptor.createRefactoring(status);
   assertNotNull("refactoring should not be null", refactoring);
   assertTrue("status should be ok", status.isOK());
   return refactoring;
 }
 /** Validates the given descriptor. The base implementation ensures it is the proper type. */
 protected void validateDescriptor(RefactoringDescriptor descriptor) throws RefactoringException {
   if (!descriptorType.isInstance(descriptor)) {
     throw new RefactoringException(
         String.format(
             "The refactoring descriptor (%s) is an unexpected type (expecting %s).",
             descriptor.getClass().getSimpleName(), descriptorType.getSimpleName()));
   }
 }
 /** {@inheritDoc} */
 public String toString() {
   return fDescriptor.toString();
 }
 /** {@inheritDoc} */
 public long getTimeStamp() {
   return fDescriptor.getTimeStamp();
 }
 /** {@inheritDoc} */
 public String getProject() {
   return fDescriptor.getProject();
 }
 /** {@inheritDoc} */
 public String getDescription() {
   return fDescriptor.getDescription();
 }
 /** {@inheritDoc} */
 public int compareTo(final Object object) {
   return fDescriptor.compareTo(object);
 }