Ejemplo n.º 1
0
 public static List<BreakpointPanelProvider> collectPanelProviders() {
   List<BreakpointPanelProvider> panelProviders = new ArrayList<>();
   for (DebuggerSupport debuggerSupport : DebuggerSupport.getDebuggerSupports()) {
     panelProviders.add(debuggerSupport.getBreakpointPanelProvider());
   }
   Collections.sort(panelProviders, (o1, o2) -> o2.getPriority() - o1.getPriority());
   return panelProviders;
 }
Ejemplo n.º 2
0
 @Nullable
 public static DebuggerSupport getDebuggerSupport(Project project, BreakpointItem breakpointItem) {
   DebuggerSupport[] debuggerSupports = DebuggerSupport.getDebuggerSupports();
   List<BreakpointItem> items = new ArrayList<>();
   for (DebuggerSupport support : debuggerSupports) {
     support.getBreakpointPanelProvider().provideBreakpointItems(project, items);
     if (items.contains(breakpointItem)) {
       return support;
     }
     items.clear();
   }
   return null;
 }
Ejemplo n.º 3
0
  @NotNull
  public static Pair<GutterIconRenderer, Object> findSelectedBreakpoint(
      @NotNull final Project project, @NotNull final Editor editor) {
    int offset = editor.getCaretModel().getOffset();
    Document editorDocument = editor.getDocument();

    DebuggerSupport[] debuggerSupports = DebuggerSupport.getDebuggerSupports();
    for (DebuggerSupport debuggerSupport : debuggerSupports) {
      final BreakpointPanelProvider<?> provider = debuggerSupport.getBreakpointPanelProvider();

      final int textLength = editor.getDocument().getTextLength();
      if (offset > textLength) {
        offset = textLength;
      }

      Object breakpoint = provider.findBreakpoint(project, editorDocument, offset);
      if (breakpoint != null) {
        final GutterIconRenderer iconRenderer =
            provider.getBreakpointGutterIconRenderer(breakpoint);
        return Pair.create(iconRenderer, breakpoint);
      }
    }
    return Pair.create(null, null);
  }