summaryrefslogtreecommitdiff
path: root/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/task/ExternalSystemTaskNotificationListener.java
blob: 4eff1de35e7e7e04f4aad32630080ca1c1c9e624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.intellij.openapi.externalSystem.model.task;

import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.NotNull;

/**
 * Defines contract for callback to listen external task notifications.
 * 
 * @author Denis Zhdanov
 * @since 11/10/11 11:57 AM
 */
public interface ExternalSystemTaskNotificationListener {

  ExtensionPointName<ExternalSystemTaskNotificationListener> EP_NAME
    = ExtensionPointName.create("com.intellij.externalSystemTaskNotificationListener");

  /**
   * Notifies that task with the given id is queued for the execution.
   * <p/>
   * 'Queued' here means that intellij process-local codebase receives request to execute the target task and even has not been
   * sent it to the slave gradle api process.
   *
   * @param id  target task's id
   */
  void onQueued(@NotNull ExternalSystemTaskId id);
  
  /**
   * Notifies that task with the given id is about to be started.
   * 
   * @param id  target task's id
   */
  void onStart(@NotNull ExternalSystemTaskId id);

  /**
   * Notifies about processing state change of task with the given id.
   *
   * @param event  event that holds information about processing change state of the
   *               {@link ExternalSystemTaskNotificationEvent#getId() target task}
   */
  void onStatusChange(@NotNull ExternalSystemTaskNotificationEvent event);

  /**
   * Notifies about text written to stdout/stderr during the task execution
   *
   * @param id      id of the task being executed
   * @param text    text produced by external system during the target task execution
   * @param stdOut  flag which identifies output type (stdout or stderr)
   */
  void onTaskOutput(@NotNull ExternalSystemTaskId id, @NotNull String text, boolean stdOut);

  /**
   * Notifies that task with the given id is finished.
   *
   * @param id  target task's id
   */
  void onEnd(@NotNull ExternalSystemTaskId id);

  /**
   * Notifies that task with the given id is finished successfully.
   *
   * @param id  target task's id
   */
  void onSuccess(@NotNull ExternalSystemTaskId id);

  /**
   * Notifies that task with the given id is failed.
   *
   * @param id  target task's id
   * @param e  failure exception
   */
  void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception e);
}