Search in sources :

Example 46 with EmptyProgressIndicator

use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-plugins by StepicOrg.

the class FormListener method sendStep.

private static void sendStep(@NotNull Project project, @NotNull StepNode stepNode, @NotNull Elements elements, @NotNull StepType type, long attemptId, @Nullable String data) {
    StepikApiClient stepikApiClient = authAndGetStepikApiClient(true);
    StepikSubmissionsPostQuery query = stepikApiClient.submissions().post().attempt(attemptId);
    Reply reply = getReply(stepNode, type, elements, data);
    if (reply == null) {
        return;
    }
    query.reply(reply).executeAsync().whenComplete(((submissions, e) -> {
        if (submissions == null) {
            logger.warn("Failed send step from browser", e);
            StepikProjectManager.updateSelection(project);
            return;
        }
        if (submissions.isEmpty()) {
            logger.warn("Failed send step from browser", e);
            return;
        }
        Submission submission = submissions.getFirst();
        SendAction.checkStepStatus(project, stepikApiClient, stepNode, submission.getId(), new EmptyProgressIndicator());
    }));
}
Also used : HTMLFormElement(org.w3c.dom.html.HTMLFormElement) StepikAuthManager.authAndGetStepikApiClient(org.stepik.core.stepik.StepikAuthManager.authAndGetStepikApiClient) VirtualFile(com.intellij.openapi.vfs.VirtualFile) StudyNode(org.stepik.core.courseFormat.StudyNode) StepikSubmissionsPostQuery(org.stepik.api.queries.submissions.StepikSubmissionsPostQuery) Project(com.intellij.openapi.project.Project) Logger(com.intellij.openapi.diagnostic.Logger) Submission(org.stepik.api.objects.submissions.Submission) StepikAuthState(org.stepik.core.stepik.StepikAuthState) Files(java.nio.file.Files) StepNode(org.stepik.core.courseFormat.StepNode) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) File(java.io.File) StudyUtils(org.stepik.core.StudyUtils) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) FileChooser(javafx.stage.FileChooser) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) SendAction(org.stepik.plugin.actions.SendAction) EventListener(org.w3c.dom.events.EventListener) StepType(org.stepik.core.courseFormat.StepType) Event(org.w3c.dom.events.Event) StepikProjectManager(org.stepik.core.StepikProjectManager) StepikApiClient(org.stepik.api.client.StepikApiClient) Reply(org.stepik.api.objects.submissions.Reply) StepikAuthManager(org.stepik.core.stepik.StepikAuthManager) NotNull(org.jetbrains.annotations.NotNull) StepDescriptionUtils.getReply(org.stepik.core.ui.StepDescriptionUtils.getReply) ProjectFilesUtils.getOrCreateSrcDirectory(org.stepik.core.utils.ProjectFilesUtils.getOrCreateSrcDirectory) StepikAuthManager.authAndGetStepikApiClient(org.stepik.core.stepik.StepikAuthManager.authAndGetStepikApiClient) StepikApiClient(org.stepik.api.client.StepikApiClient) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) Submission(org.stepik.api.objects.submissions.Submission) Reply(org.stepik.api.objects.submissions.Reply) StepDescriptionUtils.getReply(org.stepik.core.ui.StepDescriptionUtils.getReply) StepikSubmissionsPostQuery(org.stepik.api.queries.submissions.StepikSubmissionsPostQuery)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)46 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)14 NotNull (org.jetbrains.annotations.NotNull)14 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 IOException (java.io.IOException)6 ProgressManager (com.intellij.openapi.progress.ProgressManager)5 Test (org.junit.Test)5 StudioProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.StudioProgressIndicatorAdapter)4 Processor (com.intellij.util.Processor)4 File (java.io.File)4 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)3 DiffLog (com.intellij.psi.impl.source.text.DiffLog)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Future (java.util.concurrent.Future)3 Nullable (org.jetbrains.annotations.Nullable)3 Disposable (com.intellij.openapi.Disposable)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 Logger (com.intellij.openapi.diagnostic.Logger)2 PluginId (com.intellij.openapi.extensions.PluginId)2