Java Code Examples for com.intellij.openapi.progress.Task#Backgroundable

The following examples show how to use com.intellij.openapi.progress.Task#Backgroundable . 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: GitPushTagsAction.java    From GitToolBox with Apache License 2.0 6 votes vote down vote up
@Override
protected void perform(@NotNull Project project, @NotNull List<VirtualFile> gitRoots,
                       @NotNull VirtualFile defaultRoot) {
  GitPushTagsDialog dialog = new GitPushTagsDialog(project, gitRoots, defaultRoot);
  dialog.show();
  if (dialog.isOK()) {
    final Optional<TagsPushSpec> pushSpec = dialog.getPushSpec();
    if (pushSpec.isPresent()) {
      Task.Backgroundable task = new Task.Backgroundable(project, ResBundle.message("message.pushing"), false) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          GtPushResult result = GitTagsPusher.create(getProject(), indicator).push(pushSpec.get());
          handleResult(getProject(), result);
        }
      };
      GitVcs.runInBackground(task);
    }
  }
}
 
Example 2
Source File: ZipAndQueue.java    From consulo with Apache License 2.0 6 votes vote down vote up
public ZipAndQueue(final Project project, final int interval, final String title, final Runnable runnable) {
  final int correctedInterval = interval <= 0 ? 300 : interval;
  myZipperUpdater = new ZipperUpdater(correctedInterval, project);
  myQueue = new BackgroundTaskQueue(project, title);
  myInZipper = new Runnable() {
    @Override
    public void run() {
      myQueue.run(myInvokedOnQueue);
    }
  };
  myInvokedOnQueue = new Task.Backgroundable(project, title, false, BackgroundFromStartOption.getInstance()) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      runnable.run();
    }
  };
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      myZipperUpdater.stop();
    }
  });
}
 
Example 3
Source File: WorkspaceModel.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
public void saveWorkspace(final Project project, final String workspaceRootPath, final boolean syncFiles, final Runnable onSuccess) {
    final ServerContext serverContext = currentServerContext;
    final Workspace oldWorkspace = this.oldWorkspace;
    final Workspace newWorkspace = new Workspace(server, name, computer, owner, comment, mappings);

    // Using IntelliJ's background framework here so the user can choose to wait or continue working
    final Task.Backgroundable backgroundTask = new Task.Backgroundable(project,
            TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_PROGRESS_TITLE),
            true, PerformInBackgroundOption.DEAF) {
        @Override
        public void run(@NotNull final ProgressIndicator indicator) {
            saveWorkspaceInternal(serverContext, oldWorkspace, newWorkspace, indicator, project,
                    workspaceRootPath, syncFiles, onSuccess);
        }
    };

    backgroundTask.queue();
}
 
Example 4
Source File: BackgroundTaskByVfsChangeManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void runTasks(@Nonnull final VirtualFile virtualFile) {
  Boolean processed = virtualFile.getUserData(PROCESSING_BACKGROUND_TASK);
  if (processed == Boolean.TRUE) {
    return;
  }

  final List<BackgroundTaskByVfsChangeTask> tasks = findEnabledTasks(virtualFile);
  if (tasks.isEmpty()) {
    return;
  }

  Task.Backgroundable backgroundTask = new Task.Backgroundable(myProject, "Processing: " + virtualFile.getName()) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      virtualFile.putUserData(PROCESSING_BACKGROUND_TASK, Boolean.TRUE);
      call(indicator, virtualFile, tasks, 0);
    }
  };
  backgroundTask.queue();
}
 
Example 5
Source File: TeamServicesSettingsModel.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * Update the auth info for each context selected
 */
public void updatePasswords() {
    final ListSelectionModel selectionModel = getTableSelectionModel();
    if (!selectionModel.isSelectionEmpty()) {
        if (Messages.showYesNoDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE), Messages.getQuestionIcon()) == Messages.YES) {
            final List<ServerContext> contexts = tableModel.getSelectedContexts();
            final Task.Backgroundable updateAuthTask = new Task.Backgroundable(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_UPDATING)) {
                @Override
                public void run(final ProgressIndicator indicator) {
                    logger.info("Updating passwords for user. Selected: " + contexts.size());
                    ServerContextManager.getInstance().updateServerContextsAuthInfo(contexts);
                    populateContextTable();
                }
            };
            updateAuthTask.queue();
        }
    } else {
        Messages.showWarningDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_NO_ROWS_SELECTED), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE));
    }
}
 
Example 6
Source File: ProgressManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
void notifyTaskFinished(@Nonnull Task.Backgroundable task, long elapsed) {
  final Task.NotificationInfo notificationInfo = task.notifyFinished();
  if (notificationInfo != null && elapsed > 5000) { // snow notification if process took more than 5 secs
    final Component window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    if (window == null || notificationInfo.isShowWhenFocused()) {
      systemNotify(notificationInfo);
    }
  }
}
 
Example 7
Source File: DependenciesHandlerBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void analyze() {
  final List<DependenciesBuilder> builders = new ArrayList<DependenciesBuilder>();

  final Task task;
  if (canStartInBackground()) {
    task = new Task.Backgroundable(myProject, getProgressTitle(), true, new PerformAnalysisInBackgroundOption(myProject)) {
      @Override
      public void run(@Nonnull final ProgressIndicator indicator) {
        perform(builders);
      }

      @RequiredUIAccess
      @Override
      public void onSuccess() {
        DependenciesHandlerBase.this.onSuccess(builders);
      }
    };
  } else {
    task = new Task.Modal(myProject, getProgressTitle(), true) {
      @Override
      public void run(@Nonnull ProgressIndicator indicator) {
        perform(builders);
      }

      @RequiredUIAccess
      @Override
      public void onSuccess() {
        DependenciesHandlerBase.this.onSuccess(builders);
      }
    };
  }
  ProgressManager.getInstance().run(task);
}
 
Example 8
Source File: PushController.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void push(final boolean force) {
  Task.Backgroundable task = new Task.Backgroundable(myProject, "Pushing...", true) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      myPushSettings.saveExcludedRepoRoots(myExcludedRepositoryRoots);
      for (PushSupport support : myPushSupports) {
        doPush(support, force);
      }
    }
  };
  task.queue();
}
 
Example 9
Source File: ShopwareInstallerProjectGenerator.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
@Override
public void generateProject(@NotNull final Project project, final @NotNull VirtualFile baseDir, final @NotNull ShopwareInstallerSettings settings, @NotNull Module module) {

    String downloadPath = settings.getVersion().getUrl();
    String toDir = baseDir.getPath();

    VirtualFile zipFile = PhpConfigurationUtil.downloadFile(project, null, toDir, downloadPath, "shopware.zip");

    if (zipFile == null) {
        showErrorNotification(project, "Cannot download Shopware.zip file");
        return;
    }

    // Convert files
    File zip = VfsUtil.virtualToIoFile(zipFile);
    File base = VfsUtil.virtualToIoFile(baseDir);

    Task.Backgroundable task = new Task.Backgroundable(project, "Extracting", true) {
        @Override
        public void run(@NotNull ProgressIndicator progressIndicator) {

            try {
                // unzip file
                ZipUtil.extract(zip, base, null);

                // Delete TMP File
                FileUtil.delete(zip);

                // Activate Plugin
                IdeHelper.enablePluginAndConfigure(project);
            } catch (IOException e) {
                showErrorNotification(project, "There is a error occurred");
            }
        }
    };

    ProgressManager.getInstance().run(task);
}
 
Example 10
Source File: GraphQLConfigMigrationHelper.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
public static void checkGraphQLConfigJsonMigrations(Project project) {

        final Task.Backgroundable task = new Task.Backgroundable(project, "Verifying GraphQL Configuration", false) {
            @Override
            public void run(@NotNull ProgressIndicator indicator) {
                indicator.setIndeterminate(true);
                final GlobalSearchScope scope = GlobalSearchScope.projectScope(project);
                final Collection<VirtualFile> legacyConfigFiles = ApplicationManager.getApplication().runReadAction(
                        (Computable<Collection<VirtualFile>>) () -> FilenameIndex.getVirtualFilesByName(project, "graphql.config.json", scope)
                );
                for (VirtualFile virtualFile : legacyConfigFiles) {
                    if (!virtualFile.isDirectory() && virtualFile.isInLocalFileSystem()) {
                        boolean migrate = true;
                        for (String fileName : GraphQLConfigManager.GRAPHQLCONFIG_FILE_NAMES) {
                            if (virtualFile.getParent().findChild(fileName) != null) {
                                migrate = false;
                                break;
                            }
                        }
                        if (migrate) {
                            createMigrationNotification(project, virtualFile);
                        }
                    }
                }
            }
        };
        ProgressManager.getInstance().run(task);
    }
 
Example 11
Source File: VcsLogData.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void runInBackground(@Nonnull ThrowableConsumer<ProgressIndicator, VcsException> task) {
  Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Loading History...", false) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      indicator.setIndeterminate(true);
      try {
        task.consume(indicator);
      }
      catch (VcsException e) {
        throw new RuntimeException(e); // TODO
      }
    }
  };
  myDataLoaderQueue.run(backgroundable, null, myRefresher.getProgress().createProgressIndicator());
}
 
Example 12
Source File: UsageViewManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private UsageView doSearchAndShow(@Nonnull final UsageTarget[] searchFor,
                                  @Nonnull final Factory<UsageSearcher> searcherFactory,
                                  @Nonnull final UsageViewPresentation presentation,
                                  @Nonnull final FindUsagesProcessPresentation processPresentation,
                                  @Nullable final UsageViewStateListener listener) {
  final SearchScope searchScopeToWarnOfFallingOutOf = getMaxSearchScopeToWarnOfFallingOutOf(searchFor);
  final AtomicReference<UsageViewImpl> usageViewRef = new AtomicReference<>();
  long start = System.currentTimeMillis();
  Task.Backgroundable task = new Task.Backgroundable(myProject, getProgressTitle(presentation), true, new SearchInBackgroundOption()) {
    @Override
    public void run(@Nonnull final ProgressIndicator indicator) {
      new SearchForUsagesRunnable(UsageViewManagerImpl.this, UsageViewManagerImpl.this.myProject, usageViewRef, presentation, searchFor, searcherFactory, processPresentation,
                                  searchScopeToWarnOfFallingOutOf, listener).run();
    }

    @Nonnull
    @Override
    public NotificationInfo getNotificationInfo() {
      UsageViewImpl usageView = usageViewRef.get();
      int count = usageView == null ? 0 : usageView.getUsagesCount();
      String notification = StringUtil.capitalizeWords(UsageViewBundle.message("usages.n", count), true);
      LOG.debug(notification + " in " + (System.currentTimeMillis() - start) + "ms.");
      return new NotificationInfo("Find Usages", "Find Usages Finished", notification);
    }
  };
  ProgressManager.getInstance().run(task);
  return usageViewRef.get();
}
 
Example 13
Source File: WorkspaceModel.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
public void syncWorkspaceAsync(final ServerContext context, final Project project, final String workspaceRootPath) {
    final Task.Backgroundable backgroundTask = new Task.Backgroundable(project,
            TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_PROGRESS_TITLE),
            true, PerformInBackgroundOption.DEAF) {
        @Override
        public void run(@NotNull final ProgressIndicator indicator) {
            try {
                IdeaHelper.setProgress(indicator, 0.30,
                        TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_SAVE_PROGRESS_SYNCING));

                // Sync all files recursively
                CommandUtils.syncWorkspace(context, workspaceRootPath);

                // Notify the user of a successful sync
                VcsNotifier.getInstance(project).notifySuccess(
                        TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_TITLE),
                        TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_SYNC_MESSAGE));
            } catch (final Throwable t) {
                VcsNotifier.getInstance(project).notifyError(
                        TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_FAILURE_TITLE),
                        LocalizationServiceImpl.getInstance().getExceptionMessage(t));
            }

        }
    };
    backgroundTask.queue();
}
 
Example 14
Source File: MoveMethodPanel.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
private void calculateRefactorings() {
    Project project = scope.getProject();
    ProjectInfo projectInfo = new ProjectInfo(scopeChooserCombo.getScope(), true);
    Set<String> classNamesToBeExamined = new HashSet<>();

    PsiUtils.extractFiles(project).stream()
            .filter(file -> scopeChooserCombo.getScope().contains(file))
            .forEach(list ->
                    Arrays.stream(list.getClasses()).map(PsiClass::getQualifiedName).forEach(classNamesToBeExamined::add));

    final Task.Backgroundable backgroundable = new Task.Backgroundable(project, IntelliJDeodorantBundle.message("feature.envy.detect.indicator.status"), true) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            ApplicationManager.getApplication().runReadAction(() -> {
                List<MoveMethodCandidateRefactoring> candidates = JDeodorantFacade.getMoveMethodRefactoringOpportunities(projectInfo, indicator, classNamesToBeExamined);
                final List<MoveMethodRefactoring> references = candidates.stream().filter(Objects::nonNull)
                        .map(x ->
                                new MoveMethodRefactoring(x.getSourceMethodDeclaration(),
                                        x.getTargetClass().getClassObject().getPsiClass(),
                                        x.getDistinctSourceDependencies(),
                                        x.getDistinctTargetDependencies()))
                        .collect(Collectors.toList());
                refactorings.clear();
                refactorings.addAll(new ArrayList<>(references));
                model.updateTable(refactorings);
                scrollPane.setVisible(true);
                scrollPane.setViewportView(table);
                enableButtonsOnConditions();
                IntelliJDeodorantCounterCollector.getInstance().refactoringFound(project, "move.method", references.size());
            });
        }

        @Override
        public void onCancel() {
            showEmptyPanel();
        }
    };

    AbstractRefactoringPanel.runAfterCompilationCheck(backgroundable, project, projectInfo);
}
 
Example 15
Source File: ExtractMethodPanel.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
/**
 * Calculates suggestions for whole project.
 */
private void calculateRefactorings() {
    Project project = scope.getProject();
    ProjectInfo projectInfo = new ProjectInfo(scopeChooserCombo.getScope(), false);

    final Task.Backgroundable backgroundable = new Task.Backgroundable(project,
            IntelliJDeodorantBundle.message("long.method.detect.indicator.status"), true) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            ApplicationManager.getApplication().runReadAction(() -> {
                Set<ASTSliceGroup> candidates = getExtractMethodRefactoringOpportunities(projectInfo, indicator);
                final List<ExtractMethodCandidateGroup> extractMethodCandidateGroups = candidates.stream().filter(Objects::nonNull)
                        .map(sliceGroup ->
                                sliceGroup.getCandidates().stream()
                                        .filter(c -> canBeExtracted(c))
                                        .collect(toSet()))
                        .filter(set -> !set.isEmpty())
                        .map(ExtractMethodCandidateGroup::new)
                        .sorted(Comparator.comparing(ExtractMethodCandidateGroup::getDescription))
                        .collect(toList());
                treeTableModel.setCandidateRefactoringGroups(extractMethodCandidateGroups);
                ApplicationManager.getApplication().invokeLater(() -> showRefactoringsTable());
                IntelliJDeodorantCounterCollector.getInstance().refactoringFound(project, "extract.method", extractMethodCandidateGroups.size());
            });
        }

        @Override
        public void onCancel() {
            showEmptyPanel();
        }
    };
    runAfterCompilationCheck(backgroundable, scope.getProject(), projectInfo);
}
 
Example 16
Source File: ProgressManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public Future<?> runProcessWithProgressAsynchronously(@Nonnull Task.Backgroundable task) {
  ProgressIndicator progressIndicator = ApplicationManager.getApplication().isHeadlessEnvironment() ? new EmptyProgressIndicator() : new BackgroundableProcessIndicator(task);
  return runProcessWithProgressAsynchronously(task, progressIndicator, null);
}
 
Example 17
Source File: CommitHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
private boolean doCommit(final GeneralCommitProcessor processor) {

    final Runnable action = new Runnable() {
      @Override
      public void run() {
        delegateCommitToVcsThread(processor);
      }
    };

    if (myForceSyncCommit) {
      ProgressManager.getInstance().runProcessWithProgressSynchronously(action, myActionName, true, myProject);
      boolean success = doesntContainErrors(processor.getVcsExceptions());
      if (success) {
        reportResult(processor);
      }
      return success;
    }
    else {
      Task.Backgroundable task = new Task.Backgroundable(myProject, myActionName, true, myConfiguration.getCommitOption()) {
        @Override
        public void run(@Nonnull final ProgressIndicator indicator) {
          final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
          vcsManager.startBackgroundVcsOperation();
          try {
            action.run();
          }
          finally {
            vcsManager.stopBackgroundVcsOperation();
          }
        }

        @Override
        public NotificationInfo notifyFinished() {
          if (myCustomResultHandler == null) {
            String text = reportResult(processor);
            return new NotificationInfo("VCS Commit", "VCS Commit Finished", text, true);
          }
          return null;
        }
      };
      ProgressManager.getInstance().run(task);
      return false;
    }
  }
 
Example 18
Source File: MigrationsToolWindow.java    From yiistorm with MIT License 4 votes vote down vote up
public void runBackgroundTask(final int Action, Project project) {
    final Task.Backgroundable task = new Task.Backgroundable(project, "Yii migrations", false) {

        @Override
        public String getProcessId() {
            return "Yii migrations";
        }

        @Override
        public DumbModeAction getDumbModeAction() {
            return DumbModeAction.CANCEL;
        }

        public void run(@NotNull final ProgressIndicator indicator) {
            final Task.Backgroundable this_task = this;
            ((ProgressIndicatorEx) indicator).addStateDelegate(new ProgressIndicatorBase() {
                @Override
                public void cancel() {
                    this_task.onCancel();
                }
            });
            switch (Action) {
                case MigrationsToolWindow.MIGRATE_DOWN_BACKGROUND_ACTION:
                    indicator.setText("Migrating 1 down");
                    indicator.setFraction(0.1);
                    MigrationsToolWindow.toolw.migrateDown();
                    indicator.setFraction(0.3);
                    MigrationsToolWindow.toolw.updateNewMigrations(true);
                    indicator.setFraction(0.5);
                    indicator.setText("Updating migrations menu");
                    MigrationsToolWindow.toolw.fillActionMenu();
                    indicator.setFraction(0.8);
                    break;
                case MigrationsToolWindow.ADD_MENUS_BACKGROUND_ACTION:
                    indicator.setText("Updating migrations list");
                    indicator.setFraction(0.1);
                    MigrationsToolWindow.toolw.updateNewMigrations(true);
                    indicator.setFraction(0.5);
                    MigrationsToolWindow.toolw.addMenus();
                    indicator.setFraction(0.8);
                    break;
                case MigrationsToolWindow.UPDATE_MIGRAITIONS_MENUS_BACKGROUND_ACTION:
                    indicator.setText("Updating migrations list");
                    indicator.setFraction(0.1);
                    MigrationsToolWindow.toolw.updateNewMigrations(true);
                    indicator.setFraction(0.5);
                    indicator.setText("Updating migrations menu");
                    MigrationsToolWindow.toolw.fillActionMenu();
                    indicator.setFraction(0.8);
                    break;
                case MigrationsToolWindow.APPLY_MIGRATIONS_BACKGROUND_ACTION:
                    indicator.setText("Applying migrations list");
                    indicator.setFraction(0.1);
                    MigrationsToolWindow.toolw.applyMigrations();
                    indicator.setFraction(0.3);
                    MigrationsToolWindow.toolw.updateNewMigrations(false);
                    indicator.setFraction(0.5);
                    indicator.setText("Updating migrations menu");
                    MigrationsToolWindow.toolw.fillActionMenu();
                    indicator.setFraction(0.8);
                    break;
                case MigrationsToolWindow.CREATE_MIGRATION_BACKGROUND_ACTION:
                    indicator.setText("Creating migration: " + newMigrationDialog.getMigrationName());
                    indicator.setFraction(0.1);
                    MigrationsToolWindow.toolw.createMigrationByName(newMigrationDialog.getMigrationName());
                    indicator.setFraction(0.3);
                    MigrationsToolWindow.toolw.updateNewMigrations(false, true);
                    indicator.setFraction(0.5);
                    indicator.setText("Updating migrations menu");
                    MigrationsToolWindow.toolw.fillActionMenu();
                    indicator.setFraction(0.8);

                    break;
            }

            indicator.stop();
        }

    };
    task.setCancelText("Stop processing").queue();
}
 
Example 19
Source File: PostReviewAction.java    From reviewboard-plugin-for-idea with MIT License 4 votes vote down vote up
private void execute(final Project project, final VCSBuilder vcsBuilder, VirtualFile[] vFiles) throws Exception {
    vcsBuilder.build(project, vFiles);
    final String diff = vcsBuilder.getDiff();
    if (diff == null) {
        Messages.showMessageDialog(project, "No diff generated", "Warn", null);
        return;
    }

    final ReviewBoardClient reviewBoardClient = new ReviewBoardClient();
    Task.Backgroundable task = new Task.Backgroundable(project, "Query Repository...", false, new PerformInBackgroundOption() {
        @Override
        public boolean shouldStartInBackground() {
            return false;
        }

        @Override
        public void processSentToBackground() {
        }
    }) {

        @Override
        public void run(@NotNull ProgressIndicator progressIndicator) {
            progressIndicator.setIndeterminate(true);
            Repository[] repositories;
            try {
                repositories = reviewBoardClient.getRepositories().repositories;
            } catch (Exception e) {
                PopupUtil.showBalloonForActiveFrame("Error to list repository:" + e.getMessage(), MessageType.ERROR);
                throw new RuntimeException(e);
            }
            if (repositories != null) {
                final Repository[] finalRepositories = repositories;
                ApplicationManager.getApplication().invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        showPostForm(project, vcsBuilder, finalRepositories);
                    }
                });

            }
        }
    };
    ProgressManager.getInstance().run(task);
}
 
Example 20
Source File: VcsLogRefresherImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void startNewBackgroundTask(@Nonnull final Task.Backgroundable refreshTask) {
  UIUtil.invokeLaterIfNeeded(() -> {
    LOG.debug("Starting a background task...");
    ProgressManager.getInstance().runProcessWithProgressAsynchronously(refreshTask, myProgress.createProgressIndicator());
  });
}