Java Code Examples for com.intellij.openapi.progress.ProgressManager#getInstance()

The following examples show how to use com.intellij.openapi.progress.ProgressManager#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlutterModuleBuilder.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Runs flutter create without showing a console, but with an indeterminate progress dialog.
 * <p>
 * Returns the PubRoot if successful.
 */
@Nullable
public static PubRoot runFlutterCreateWithProgress(@NotNull VirtualFile baseDir,
                                                   @NotNull FlutterSdk sdk,
                                                   @NotNull Project project,
                                                   @Nullable ProcessListener processListener,
                                                   @Nullable FlutterCreateAdditionalSettings additionalSettings) {
  final ProgressManager progress = ProgressManager.getInstance();
  final AtomicReference<PubRoot> result = new AtomicReference<>(null);

  FlutterUtils.disableGradleProjectMigrationNotification(project);

  progress.runProcessWithProgressSynchronously(() -> {
    progress.getProgressIndicator().setIndeterminate(true);
    result.set(sdk.createFiles(baseDir, null, processListener, additionalSettings));
  }, "Creating Flutter Project", false, project);

  return result.get();
}
 
Example 2
Source File: FlutterModuleBuilder.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Runs flutter create without showing a console, but with an indeterminate progress dialog.
 * <p>
 * Returns the PubRoot if successful.
 */
@Nullable
public static PubRoot runFlutterCreateWithProgress(@NotNull VirtualFile baseDir,
                                                   @NotNull FlutterSdk sdk,
                                                   @NotNull Project project,
                                                   @Nullable ProcessListener processListener,
                                                   @Nullable FlutterCreateAdditionalSettings additionalSettings) {
  final ProgressManager progress = ProgressManager.getInstance();
  final AtomicReference<PubRoot> result = new AtomicReference<>(null);

  FlutterUtils.disableGradleProjectMigrationNotification(project);

  progress.runProcessWithProgressSynchronously(() -> {
    progress.getProgressIndicator().setIndeterminate(true);
    result.set(sdk.createFiles(baseDir, null, processListener, additionalSettings));
  }, "Creating Flutter Project", false, project);

  return result.get();
}
 
Example 3
Source File: TestExecutionState.java    From buck with Apache License 2.0 6 votes vote down vote up
private void schedulePostExecutionActions(final OSProcessHandler result, final String title) {
  final ProgressManager manager = ProgressManager.getInstance();
  ApplicationManager.getApplication()
      .invokeLater(
          () -> {
            manager.run(
                new Task.Backgroundable(mProject, title, true) {
                  @Override
                  public void run(@NotNull final ProgressIndicator indicator) {
                    try {
                      result.waitFor();
                    } finally {
                      indicator.cancel();
                    }
                    BuckToolWindow buckToolWindow =
                        BuckUIManager.getInstance(mProject).getBuckToolWindow();
                    if (!buckToolWindow.isRunToolWindowVisible()) {
                      buckToolWindow.showRunToolWindow();
                    }
                  }
                });
          });
}
 
Example 4
Source File: NewClassAction.java    From json2java4idea with Apache License 2.0 5 votes vote down vote up
@Override
public void onOk(@Nonnull NewClassDialog dialog) {
    final PsiDirectory directory = ideView.getOrChooseDirectory();
    if (directory == null) {
        dialog.cancel();
        return;
    }

    try {
        final CommandActionFactory actionFactory = commandActionFactoryProvider.get();
        final JavaConverterFactory converterFactory = javaConverterFactoryProvider.get();
        final NewClassCommandAction command = actionFactory.create(
                dialog.getClassName(),
                dialog.getJson(),
                directory,
                converterFactory.create(settings)
        );

        final ProgressManager progressManager = ProgressManager.getInstance();
        progressManager.runProcessWithProgressSynchronously(() -> {
            final ProgressIndicator indicator = progressManager.getProgressIndicator();
            if (indicator != null) {
                indicator.setIndeterminate(true);
                indicator.setText(bundle.message("progress.text", dialog.getClassName()));
            }

            final RunResult<PsiFile> result = command.execute();
            return result.getResultObject();
        }, bundle.message("progress.title"), false, project);
        dialog.close();
    } catch (RuntimeException e) {
        LOGGER.warn("Unable to create a class", e);
        onError(dialog, e.getCause());
    }
}
 
Example 5
Source File: MuleSdkSelectionDialog.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
private void downloadVersionWithProgress(String version, String destinationDir) {

        Messages.showInfoMessage(contentPane, "Download Is Going to Take Some Time. Good time for a coffee.", "Mule Distribution Download");
        final Optional<MuleUrl> first = MuleUrl.getVERSIONS().stream().filter((url) -> url.getName().equals(version)).findFirst();
        final MuleUrl muleUrl = first.get();
        try {
            final ProgressManager instance = ProgressManager.getInstance();
            final File distro = instance.runProcessWithProgressSynchronously(() -> {
                final URL artifactUrl = new URL(muleUrl.getUrl());
                final File sourceFile = FileUtil.createTempFile("mule" + version, ".zip");
                if (download(instance.getProgressIndicator(), artifactUrl, sourceFile, version)) {
                    final File destDir = new File(destinationDir);
                    destDir.mkdirs();
                    ZipUtil.extract(sourceFile, destDir, null);
                    try (ZipFile zipFile = new ZipFile(sourceFile)) {
                        String rootName = zipFile.entries().nextElement().getName();
                        return new File(destDir, rootName);
                    }
                } else {
                    return null;
                }
            }, "Downloading Mule Distribution " + muleUrl.getName(), true, null);
            if (distro != null) {
                final MuleSdk muleSdk = new MuleSdk(distro.getAbsolutePath());
                MuleSdkManagerImpl.getInstance().addSdk(muleSdk);
                myTableModel.addRow(muleSdk);
                final int rowIndex = myTableModel.getRowCount() - 1;
                myInputsTable.getSelectionModel().setSelectionInterval(rowIndex, rowIndex);
                onOK();
            }
        } catch (Exception e) {
            Messages.showErrorDialog("An error occurred while trying to download " + version + ".\n" + e.getMessage(),
                    "Mule SDK Download Error");
        }

    }
 
Example 6
Source File: BuckBuildManager.java    From Buck-IntelliJ-Plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Execute simple process asynchronously with progress.
 *
 * @param handler        a handler
 * @param operationTitle an operation title shown in progress dialog
 */
public void runBuckCommand(
    final BuckCommandHandler handler,
    final String operationTitle) {
  Project project = handler.project();

  // Always save files
  FileDocumentManager.getInstance().saveAllDocuments();

  String exec = BuckSettingsProvider.getInstance().getState().buckExecutable;
  if (exec == null) {
    BuckToolWindowFactory.outputConsoleMessage(
        project,
        "Please specify the buck executable path!\n",
        ConsoleViewContentType.ERROR_OUTPUT);

    BuckToolWindowFactory.outputConsoleMessage(
        project,
        "Preference -> Tools -> Buck -> Path to Buck executable\n",
        ConsoleViewContentType.NORMAL_OUTPUT);
    return;
  }

  final ProgressManager manager = ProgressManager.getInstance();
  manager.run(new Task.Backgroundable(handler.project(), operationTitle, true) {
    public void run(final ProgressIndicator indicator) {
      mProgressIndicator = indicator;
      runInCurrentThread(handler, indicator, true, operationTitle);
    }
  });
}
 
Example 7
Source File: AbstractMissingFilesAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final List<FilePath> files = e.getData(ChangesListView.MISSING_FILES_DATA_KEY);
  if (files == null) return;

  final ProgressManager progressManager = ProgressManager.getInstance();
  final Runnable action = new Runnable() {
    public void run() {
      final List<VcsException> allExceptions = new ArrayList<VcsException>();
      ChangesUtil.processFilePathsByVcs(project, files, new ChangesUtil.PerVcsProcessor<FilePath>() {
        public void process(final AbstractVcs vcs, final List<FilePath> items) {
          final List<VcsException> exceptions = processFiles(vcs, files);
          if (exceptions != null) {
            allExceptions.addAll(exceptions);
          }
        }
      });

      for (FilePath file : files) {
        VcsDirtyScopeManager.getInstance(project).fileDirty(file);
      }
      ChangesViewManager.getInstance(project).scheduleRefresh();
      if (allExceptions.size() > 0) {
        AbstractVcsHelper.getInstance(project).showErrors(allExceptions, "VCS Errors");
      }
    }
  };
  if (synchronously()) {
    action.run();
  } else {
    progressManager.runProcessWithProgressSynchronously(action, getName(), true, project);
  }
}
 
Example 8
Source File: InlineOptionsDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected static int initOccurrencesNumber(PsiNameIdentifierOwner nameIdentifierOwner) {
  final ProgressManager progressManager = ProgressManager.getInstance();
  final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(nameIdentifierOwner.getProject());
  final GlobalSearchScope scope = GlobalSearchScope.projectScope(nameIdentifierOwner.getProject());
  final String name = nameIdentifierOwner.getName();
  final boolean isCheapToSearch =
   name != null && searchHelper.isCheapEnoughToSearch(name, scope, null, progressManager.getProgressIndicator()) != PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES;
  return isCheapToSearch ? ReferencesSearch.search(nameIdentifierOwner).findAll().size() : - 1;
}
 
Example 9
Source File: FlutterProjectCreator.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void createProject() {
  IdeFrame frame = IdeFocusManager.getGlobalInstance().getLastFocusedFrame();
  final Project projectToClose = frame != null ? frame.getProject() : null;

  VirtualFile baseDir = getLocationFromModel(projectToClose, true);
  if (baseDir == null) {
    return;
  }
  //noinspection ConstantConditions (Keep this refresh even if the converter is removed.)
  VfsUtil.markDirtyAndRefresh(false, true, true, baseDir);

  // Create the project files using 'flutter create'.
  FlutterSdk sdk = FlutterSdk.forPath(myModel.flutterSdk().get());
  if (sdk == null) {
    FlutterMessages.showError("Error creating project", myModel.flutterSdk().get() + " is not a valid Flutter SDK");
    return;
  }
  final OutputListener listener = new OutputListener();
  // TODO(messick,pq): Refactor createFiles() to accept a logging interface instead of module, and display it in the wizard.
  ProgressManager progress = ProgressManager.getInstance();
  AtomicReference<PubRoot> result = new AtomicReference<>(null);
  progress.runProcessWithProgressSynchronously(() -> {
    progress.getProgressIndicator().setIndeterminate(true);
    sdk.createFiles(baseDir, null, listener, makeAdditionalSettings());
    VfsUtil.markDirtyAndRefresh(false, true, true, baseDir);
    result.set(PubRoot.forDirectory(baseDir));
  }, "Creating Flutter Project", false, null);
  PubRoot root = result.get();
  if (root == null) {
    String stderr = listener.getOutput().getStderr();
    FlutterMessages.showError("Error creating project", stderr.isEmpty() ? "Flutter create command was unsuccessful" : stderr);
    return;
  }

  Project project = null;
  if (myModel.shouldOpenNewWindow()) {
    // Open the project window.
    EnumSet<PlatformProjectOpenProcessor.Option> options = EnumSet.noneOf(PlatformProjectOpenProcessor.Option.class);
    project = PlatformProjectOpenProcessor.doOpenProject(baseDir, projectToClose, -1, null, options);
  }

  if (project != null) {
    // Android Studio changes the default project type, so we need to set it.
    ProjectTypeService.setProjectType(project, ProjectOpenActivity.FLUTTER_PROJECT_TYPE);
    disableGradleProjectMigrationNotification(project);
    disableUserConfig(project);
    Project proj = project;
    StartupManager.getInstance(project).registerPostStartupActivity(
      () -> ApplicationManager.getApplication().invokeLater(
        () -> {
          // We want to show the Project view, not the Android view since it doesn't make the Dart code visible.
          DumbService.getInstance(proj).runWhenSmart(
            () -> {
              ToolWindowManager.getInstance(proj).getToolWindow(ToolWindowId.PROJECT_VIEW).activate(null);
              ProjectView.getInstance(proj).changeView(ProjectViewPane.ID);
            });
        }, ModalityState.defaultModalityState()));
  }
}
 
Example 10
Source File: FlutterProjectCreator.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void createProject() {
  IdeFrame frame = IdeFocusManager.getGlobalInstance().getLastFocusedFrame();
  final Project projectToClose = frame != null ? frame.getProject() : null;

  VirtualFile baseDir = getLocationFromModel(projectToClose, true);
  if (baseDir == null) {
    return;
  }
  //noinspection ConstantConditions (Keep this refresh even if the converter is removed.)
  VfsUtil.markDirtyAndRefresh(false, true, true, baseDir);

  // Create the project files using 'flutter create'.
  FlutterSdk sdk = FlutterSdk.forPath(myModel.flutterSdk().get());
  if (sdk == null) {
    FlutterMessages.showError("Error creating project", myModel.flutterSdk().get() + " is not a valid Flutter SDK");
    return;
  }
  final OutputListener listener = new OutputListener();
  // TODO(messick,pq): Refactor createFiles() to accept a logging interface instead of module, and display it in the wizard.
  ProgressManager progress = ProgressManager.getInstance();
  AtomicReference<PubRoot> result = new AtomicReference<>(null);
  progress.runProcessWithProgressSynchronously(() -> {
    progress.getProgressIndicator().setIndeterminate(true);
    sdk.createFiles(baseDir, null, listener, makeAdditionalSettings());
    VfsUtil.markDirtyAndRefresh(false, true, true, baseDir);
    result.set(PubRoot.forDirectory(baseDir));
  }, "Creating Flutter Project", false, null);
  PubRoot root = result.get();
  if (root == null) {
    String stderr = listener.getOutput().getStderr();
    FlutterMessages.showError("Error creating project", stderr.isEmpty() ? "Flutter create command was unsuccessful" : stderr);
    return;
  }

  Project project = null;
  if (myModel.shouldOpenNewWindow()) {
    // Open the project window.
    EnumSet<PlatformProjectOpenProcessor.Option> options = EnumSet.noneOf(PlatformProjectOpenProcessor.Option.class);
    project = PlatformProjectOpenProcessor.doOpenProject(baseDir, projectToClose, -1, null, options);
  }

  if (project != null) {
    // Android Studio changes the default project type, so we need to set it.
    ProjectTypeService.setProjectType(project, ProjectOpenActivity.FLUTTER_PROJECT_TYPE);
    disableGradleProjectMigrationNotification(project);
    disableUserConfig(project);
    Project proj = project;
    StartupManager.getInstance(project).registerPostStartupActivity(
      () -> ApplicationManager.getApplication().invokeLater(
        () -> {
          // We want to show the Project view, not the Android view since it doesn't make the Dart code visible.
          DumbService.getInstance(proj).runWhenSmart(
            () -> {
              ToolWindowManager.getInstance(proj).getToolWindow(ToolWindowId.PROJECT_VIEW).activate(null);
              ProjectView.getInstance(proj).changeView(ProjectViewPane.ID);
            });
        }, ModalityState.defaultModalityState()));
  }
}
 
Example 11
Source File: DevToolsManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public CompletableFuture<Boolean> installDevTools() {
  if (isBazel(project)) {
    // TODO(jacobr): prebuild devtools so the initial devtools load is faster.
    // Bazel projects do not need to load DevTools.
    return createCompletedFuture(true);
  }

  final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
  if (sdk == null) {
    return createCompletedFuture(false);
  }

  final CompletableFuture<Boolean> result = new CompletableFuture<>();
  final FlutterCommand command = sdk.flutterPub(null, "global", "activate", "devtools");

  final ProgressManager progressManager = ProgressManager.getInstance();
  progressManager.run(new Task.Backgroundable(project, "Installing DevTools...", true) {
    Process process;

    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      indicator.setText(getTitle());
      indicator.setIndeterminate(true);

      process = command.start((ProcessOutput output) -> {
        if (output.getExitCode() != 0) {
          final String message = (output.getStdout() + "\n" + output.getStderr()).trim();
          FlutterConsoles.displayMessage(project, null, message, true);
        }
      }, null);

      try {
        final int resultCode = process.waitFor();
        if (resultCode == 0) {
          installedDevTools = true;
        }
        result.complete(resultCode == 0);
      }
      catch (RuntimeException | InterruptedException re) {
        if (!result.isDone()) {
          result.complete(false);
        }
      }

      process = null;
    }

    @Override
    public void onCancel() {
      if (process != null && process.isAlive()) {
        process.destroy();
        if (!result.isDone()) {
          result.complete(false);
        }
      }
    }
  });

  return result;
}
 
Example 12
Source File: DevToolsManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public CompletableFuture<Boolean> installDevTools() {
  if (isBazel(project)) {
    // TODO(jacobr): prebuild devtools so the initial devtools load is faster.
    // Bazel projects do not need to load DevTools.
    return createCompletedFuture(true);
  }

  final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
  if (sdk == null) {
    return createCompletedFuture(false);
  }

  final CompletableFuture<Boolean> result = new CompletableFuture<>();
  final FlutterCommand command = sdk.flutterPub(null, "global", "activate", "devtools");

  final ProgressManager progressManager = ProgressManager.getInstance();
  progressManager.run(new Task.Backgroundable(project, "Installing DevTools...", true) {
    Process process;

    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      indicator.setText(getTitle());
      indicator.setIndeterminate(true);

      process = command.start((ProcessOutput output) -> {
        if (output.getExitCode() != 0) {
          final String message = (output.getStdout() + "\n" + output.getStderr()).trim();
          FlutterConsoles.displayMessage(project, null, message, true);
        }
      }, null);

      try {
        final int resultCode = process.waitFor();
        if (resultCode == 0) {
          installedDevTools = true;
        }
        result.complete(resultCode == 0);
      }
      catch (RuntimeException | InterruptedException re) {
        if (!result.isDone()) {
          result.complete(false);
        }
      }

      process = null;
    }

    @Override
    public void onCancel() {
      if (process != null && process.isAlive()) {
        process.destroy();
        if (!result.isDone()) {
          result.complete(false);
        }
      }
    }
  });

  return result;
}
 
Example 13
Source File: AbstractVcsHelperImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadAndShowCommittedChangesDetails(@Nonnull final Project project,
                                               @Nonnull final VcsRevisionNumber revision,
                                               @Nonnull final VirtualFile virtualFile,
                                               @Nonnull VcsKey vcsKey,
                                               @Nullable final RepositoryLocation location,
                                               final boolean isNonLocal) {
  final AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).findVcsByName(vcsKey.getName());
  if (vcs == null) return;
  final CommittedChangesProvider provider = vcs.getCommittedChangesProvider();
  if (provider == null) return;
  if (isNonLocal && provider.getForNonLocal(virtualFile) == null) return;

  final String title = VcsBundle.message("paths.affected.in.revision",
                                         revision instanceof ShortVcsRevisionNumber
                                         ? ((ShortVcsRevisionNumber)revision).toShortString()
                                         : revision.asString());
  final CommittedChangeList[] list = new CommittedChangeList[1];
  final FilePath[] targetPath = new FilePath[1];
  final VcsException[] exc = new VcsException[1];

  final BackgroundableActionLock lock = BackgroundableActionLock.getLock(project, VcsBackgroundableActions.COMMITTED_CHANGES_DETAILS,
                                                                         revision, virtualFile.getPath());
  if (lock.isLocked()) return;
  lock.lock();

  Task.Backgroundable task = new Task.Backgroundable(project, title, true) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      try {
        if (!isNonLocal) {
          final Pair<CommittedChangeList, FilePath> pair = provider.getOneList(virtualFile, revision);
          if (pair != null) {
            list[0] = pair.getFirst();
            targetPath[0] = pair.getSecond();
          }
        }
        else {
          if (location != null) {
            final ChangeBrowserSettings settings = provider.createDefaultSettings();
            settings.USE_CHANGE_BEFORE_FILTER = true;
            settings.CHANGE_BEFORE = revision.asString();
            final List<CommittedChangeList> changes = provider.getCommittedChanges(settings, location, 1);
            if (changes != null && changes.size() == 1) {
              list[0] = changes.get(0);
            }
          }
          else {
            list[0] = getRemoteList(vcs, revision, virtualFile);
          }
        }
      }
      catch (VcsException e) {
        exc[0] = e;
      }
    }

    @Override
    public void onCancel() {
      lock.unlock();
    }

    @Override
    public void onSuccess() {
      lock.unlock();
      if (exc[0] != null) {
        showError(exc[0], failedText(virtualFile, revision));
      }
      else if (list[0] == null) {
        Messages.showErrorDialog(project, failedText(virtualFile, revision), getTitle());
      }
      else {
        VirtualFile navigateToFile = targetPath[0] != null ?
                                     new VcsVirtualFile(targetPath[0].getPath(), null, VcsFileSystem.getInstance()) :
                                     virtualFile;
        showChangesListBrowser(list[0], navigateToFile, title);
      }
    }
  };

  // we can's use runProcessWithProgressAsynchronously(task) because then ModalityState.NON_MODAL would be used
  CoreProgressManager progressManager = (CoreProgressManager)ProgressManager.getInstance();
  progressManager.runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task), null, ModalityState.current());
}
 
Example 14
Source File: RollbackAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static void rollbackModifiedWithoutEditing(final Project project, final LinkedHashSet<VirtualFile> modifiedWithoutEditing) {
  final String operationName = StringUtil.decapitalize(UIUtil.removeMnemonic(RollbackUtil.getRollbackOperationName(project)));
  String message = (modifiedWithoutEditing.size() == 1)
                   ? VcsBundle.message("rollback.modified.without.editing.confirm.single",
                                       operationName, modifiedWithoutEditing.iterator().next().getPresentableUrl())
                   : VcsBundle.message("rollback.modified.without.editing.confirm.multiple",
                                       operationName, modifiedWithoutEditing.size());
  int rc = showYesNoDialog(project, message, VcsBundle.message("changes.action.rollback.title", operationName), getQuestionIcon());
  if (rc != Messages.YES) {
    return;
  }
  final List<VcsException> exceptions = new ArrayList<>();

  final ProgressManager progressManager = ProgressManager.getInstance();
  final Runnable action = new Runnable() {
    public void run() {
      final ProgressIndicator indicator = progressManager.getProgressIndicator();
      try {
        ChangesUtil.processVirtualFilesByVcs(project, modifiedWithoutEditing, (vcs, items) -> {
          final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
          if (rollbackEnvironment != null) {
            if (indicator != null) {
              indicator.setText(vcs.getDisplayName() +
                                ": performing " + UIUtil.removeMnemonic(rollbackEnvironment.getRollbackOperationName()).toLowerCase() + "...");
              indicator.setIndeterminate(false);
            }
            rollbackEnvironment
                    .rollbackModifiedWithoutCheckout(items, exceptions, new RollbackProgressModifier(items.size(), indicator));
            if (indicator != null) {
              indicator.setText2("");
            }
          }
        });
      }
      catch (ProcessCanceledException e) {
        // for files refresh
      }
      if (!exceptions.isEmpty()) {
        AbstractVcsHelper.getInstance(project).showErrors(exceptions, VcsBundle.message("rollback.modified.without.checkout.error.tab",
                                                                                        operationName));
      }

      VfsUtil.markDirty(true, false, VfsUtilCore.toVirtualFileArray(modifiedWithoutEditing));

      VirtualFileManager.getInstance().asyncRefresh(new Runnable() {
        public void run() {
          for (VirtualFile virtualFile : modifiedWithoutEditing) {
            VcsDirtyScopeManager.getInstance(project).fileDirty(virtualFile);
          }
        }
      });
    }
  };
  progressManager.runProcessWithProgressSynchronously(action, operationName, true, project);
}