private static void removeJSBreakpointsInDartFiles(final Project project) {
    final XBreakpointManager breakpointManager =
        XDebuggerManager.getInstance(project).getBreakpointManager();
    final Collection<XBreakpoint<?>> toRemove = new ArrayList<XBreakpoint<?>>();

    for (XBreakpoint<?> breakpoint : breakpointManager.getAllBreakpoints()) {
      final XSourcePosition position = breakpoint.getSourcePosition();
      if (position != null
          && position.getFile().getFileType() == DartFileType.INSTANCE
          && !(breakpoint.getType() instanceof DartLineBreakpointType)) {
        toRemove.add(breakpoint);
      }
    }

    if (!toRemove.isEmpty()) {
      ApplicationManager.getApplication()
          .runWriteAction(
              new Runnable() {
                public void run() {
                  for (XBreakpoint<?> breakpoint : toRemove) {
                    breakpointManager.removeBreakpoint(breakpoint);
                  }
                }
              });
    }
  }
Ejemplo n.º 2
0
  public void testXDebugger() throws Exception {
    final WorkingContextManager manager = getContextManager();
    final XBreakpointManager breakpointManager =
        XDebuggerManager.getInstance(getProject()).getBreakpointManager();

    ApplicationManager.getApplication()
        .runWriteAction(
            new Runnable() {
              public void run() {
                XLineBreakpointImpl<XBreakpointProperties> breakpoint =
                    (XLineBreakpointImpl<XBreakpointProperties>)
                        breakpointManager.addLineBreakpoint(
                            new XsltBreakpointType(), "foo", 0, null);

                final String name = "foo";
                manager.saveContext(name, null);
                breakpointManager.removeBreakpoint(breakpoint);
              }
            });
    manager.loadContext("foo");
    XBreakpoint<?>[] breakpoints = breakpointManager.getAllBreakpoints();
    assertEquals(1, breakpoints.length);
    manager.clearContext();
  }