summaryrefslogtreecommitdiff
path: root/platform/script-debugger/backend/src/org/jetbrains/debugger/Breakpoint.java
blob: f2180d66a06972b319e6c86bb548c96f5e361023 (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 org.jetbrains.debugger;

import com.intellij.openapi.util.ActionCallback;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * A breakpoint in the browser JavaScript virtual machine. The {@code set*}
 * method invocations will not take effect until
 * {@link #flush} is called.
 */
public abstract class Breakpoint {
  /**
   * This value is used when the corresponding parameter is absent
   */
  public static final int EMPTY_VALUE = -1;

  /**
   * A breakpoint has this ID if it does not reflect an actual breakpoint in a
   * JavaScript VM debugger.
   */
  public static final int INVALID_ID = -1;

  @NotNull
  public abstract BreakpointTarget getTarget();

  public abstract int getLine();

  /**
   * @return whether this breakpoint is enabled
   */
  public abstract boolean isEnabled();

  /**
   * Sets whether this breakpoint is enabled.
   * Requires subsequent {@link #flush} call.
   * @param enabled whether the breakpoint should be enabled
   */
  public abstract Breakpoint enabled(boolean enabled);

  @Nullable
  public abstract String getCondition();

  /**
   * Sets the breakpoint condition as plain JavaScript ({@code null} to clear).
   * Requires subsequent {@link #flush} call.
   * @param condition the new breakpoint condition
   */
  public abstract void setCondition(@Nullable String condition);

  /**
   * Flushes the breakpoint parameter changes (set* methods) into the browser
   * and invokes the callback once the operation has finished. This method must
   * be called for the set* method invocations to take effect.
   *
   */
  public abstract ActionCallback flush();

  public abstract boolean isResolved();

  /**
   * Be aware! V8 doesn't provide reliable debugger API, so, sometimes actual locations is empty - in this case this methods return "true".
   * V8 debugger doesn't report about resolved breakpoint if it is happened after initial breakpoint set. So, you cannot trust "actual locations".
   */
  public abstract boolean isActualLineCorrect();

  /**
   * Visitor interface that includes all extensions.
   */
  public interface TargetExtendedVisitor<R> extends FunctionSupport.Visitor<R>, ScriptRegExpSupport.Visitor<R> {
  }
}