Search in sources :

Example 1 with CancellableTaskHandleImpl

use of com.microsoft.intellij.helpers.tasks.CancellableTaskHandleImpl in project azure-tools-for-java by Microsoft.

the class IDEHelperImpl method runInBackground.

@NotNull
@Override
public CancellableTask.CancellableTaskHandle runInBackground(@NotNull ProjectDescriptor projectDescriptor, @NotNull final String name, @Nullable final String indicatorText, @NotNull final CancellableTask cancellableTask) throws AzureCmdException {
    final CancellableTaskHandleImpl handle = new CancellableTaskHandleImpl();
    final Project project = findOpenProject(projectDescriptor);
    // background tasks via ProgressManager can be scheduled only on the
    // dispatch thread
    ApplicationManager.getApplication().invokeLater(new Runnable() {

        @Override
        public void run() {
            ProgressManager.getInstance().run(getCancellableBackgroundTask(project, name, indicatorText, handle, cancellableTask));
        }
    }, ModalityState.any());
    return handle;
}
Also used : Project(com.intellij.openapi.project.Project) CancellableTaskHandleImpl(com.microsoft.intellij.helpers.tasks.CancellableTaskHandleImpl) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Aggregations

Project (com.intellij.openapi.project.Project)1 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)1 CancellableTaskHandleImpl (com.microsoft.intellij.helpers.tasks.CancellableTaskHandleImpl)1