Search in sources :

Example 6 with BreakpointRenderer

use of org.eclipse.che.ide.api.debug.BreakpointRenderer in project che by eclipse.

the class BreakpointManagerImpl method addBreakpoint.

/**
     * Adds breakpoint to the list and JVM.
     */
private void addBreakpoint(final Breakpoint breakpoint) {
    List<Breakpoint> pathBreakpoints = breakpoints.get(breakpoint.getPath());
    if (pathBreakpoints == null) {
        pathBreakpoints = new ArrayList<>();
        breakpoints.put(breakpoint.getPath(), pathBreakpoints);
    }
    if (!pathBreakpoints.contains(breakpoint)) {
        pathBreakpoints.add(breakpoint);
    }
    preserveBreakpoints();
    final BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(breakpoint.getPath());
    if (breakpointRenderer != null) {
        breakpointRenderer.addBreakpointMark(breakpoint.getLineNumber(), new LineChangeAction() {

            @Override
            public void onLineChange(VirtualFile file, int firstLine, int linesAdded, int linesRemoved) {
                BreakpointManagerImpl.this.onLineChange(file, firstLine, linesAdded, linesRemoved);
            }
        });
        breakpointRenderer.setBreakpointActive(breakpoint.getLineNumber(), breakpoint.isActive());
    }
    for (BreakpointManagerObserver observer : observers) {
        observer.onBreakpointAdded(breakpoint);
    }
    Debugger debugger = debuggerManager.getActiveDebugger();
    if (debugger != null) {
        debugger.addBreakpoint(breakpoint.getFile(), breakpoint.getLineNumber());
    }
}
Also used : VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint) BreakpointRenderer(org.eclipse.che.ide.api.debug.BreakpointRenderer) HasBreakpointRenderer(org.eclipse.che.ide.api.debug.HasBreakpointRenderer) LineChangeAction(org.eclipse.che.ide.api.debug.BreakpointRenderer.LineChangeAction) BreakpointManagerObserver(org.eclipse.che.ide.api.debug.BreakpointManagerObserver) Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint)

Example 7 with BreakpointRenderer

use of org.eclipse.che.ide.api.debug.BreakpointRenderer in project che by eclipse.

the class BreakpointManagerImpl method onDebuggerDisconnected.

@Override
public void onDebuggerDisconnected() {
    for (Entry<String, List<Breakpoint>> entry : breakpoints.entrySet()) {
        List<Breakpoint> breakpointsForPath = entry.getValue();
        for (int i = 0; i < breakpointsForPath.size(); i++) {
            Breakpoint breakpoint = breakpointsForPath.get(i);
            if (breakpoint.isActive()) {
                Breakpoint newInactiveBreakpoint = new Breakpoint(breakpoint.getType(), breakpoint.getLineNumber(), breakpoint.getPath(), breakpoint.getFile(), false);
                breakpointsForPath.set(i, newInactiveBreakpoint);
                BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(breakpoint.getPath());
                if (breakpointRenderer != null) {
                    breakpointRenderer.setBreakpointActive(breakpoint.getLineNumber(), false);
                }
            }
        }
    }
    deleteCurrentBreakpoint();
}
Also used : Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint) BreakpointRenderer(org.eclipse.che.ide.api.debug.BreakpointRenderer) HasBreakpointRenderer(org.eclipse.che.ide.api.debug.HasBreakpointRenderer) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint)

Aggregations

Breakpoint (org.eclipse.che.ide.api.debug.Breakpoint)7 BreakpointRenderer (org.eclipse.che.ide.api.debug.BreakpointRenderer)7 HasBreakpointRenderer (org.eclipse.che.ide.api.debug.HasBreakpointRenderer)7 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 BreakpointManagerObserver (org.eclipse.che.ide.api.debug.BreakpointManagerObserver)1 LineChangeAction (org.eclipse.che.ide.api.debug.BreakpointRenderer.LineChangeAction)1 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)1