Search in sources :

Example 1 with BreakpointRenderer

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

the class BreakpointManagerImpl method doDeleteBreakpoint.

/**
     * Deletes breakpoint from the list.
     */
private void doDeleteBreakpoint(Breakpoint breakpoint) {
    BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(breakpoint.getPath());
    if (breakpointRenderer != null) {
        breakpointRenderer.removeBreakpointMark(breakpoint.getLineNumber());
    }
    String path = breakpoint.getPath();
    List<Breakpoint> pathBreakpoints = breakpoints.get(path);
    if (pathBreakpoints != null) {
        pathBreakpoints.remove(breakpoint);
        if (pathBreakpoints.isEmpty()) {
            breakpoints.remove(breakpoint.getPath());
        }
    }
    preserveBreakpoints();
}
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)

Example 2 with BreakpointRenderer

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

the class BreakpointManagerImpl method onBreakpointAdded.

@Override
public void onBreakpointAdded(Breakpoint breakpoint) {
    String path = breakpoint.getPath();
    List<Breakpoint> breakpointsForPath = breakpoints.get(path);
    if (breakpointsForPath == null) {
        breakpointsForPath = new ArrayList<>();
        breakpoints.put(path, breakpointsForPath);
    }
    int i = breakpointsForPath.indexOf(breakpoint);
    if (i == -1) {
        breakpointsForPath.add(breakpoint);
    } else {
        breakpointsForPath.set(i, breakpoint);
    }
    BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(breakpoint.getPath());
    if (breakpointRenderer != null) {
        breakpointRenderer.setBreakpointActive(breakpoint.getLineNumber(), breakpoint.isActive());
    }
    preserveBreakpoints();
}
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) Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint)

Example 3 with BreakpointRenderer

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

the class BreakpointManagerImpl method onBreakpointActivated.

@Override
public void onBreakpointActivated(String filePath, int lineNumber) {
    List<Breakpoint> breakpointsForPath = breakpoints.get(filePath);
    if (breakpointsForPath == null) {
        return;
    }
    for (int i = 0; i < breakpointsForPath.size(); i++) {
        Breakpoint breakpoint = breakpointsForPath.get(i);
        if (breakpoint.getLineNumber() == lineNumber) {
            Breakpoint newActiveBreakpoint = new Breakpoint(breakpoint.getType(), breakpoint.getLineNumber(), breakpoint.getPath(), breakpoint.getFile(), true);
            breakpointsForPath.set(i, newActiveBreakpoint);
            preserveBreakpoints();
            BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(breakpoint.getPath());
            if (breakpointRenderer != null) {
                breakpointRenderer.setBreakpointActive(breakpoint.getLineNumber(), true);
            }
        }
    }
}
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) Breakpoint(org.eclipse.che.ide.api.debug.Breakpoint)

Example 4 with BreakpointRenderer

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

the class BreakpointManagerImpl method doSetCurrentBreakpoint.

private void doSetCurrentBreakpoint(VirtualFile activeFile, int lineNumber) {
    currentBreakpoint = new Breakpoint(Type.CURRENT, lineNumber, activeFile.getLocation().toString(), activeFile, true);
    BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(activeFile.getLocation().toString());
    if (breakpointRenderer != null) {
        breakpointRenderer.setLineActive(lineNumber, true);
    }
    preserveBreakpoints();
}
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)

Example 5 with BreakpointRenderer

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

the class BreakpointManagerImpl method deleteCurrentBreakpoint.

public void deleteCurrentBreakpoint() {
    if (currentBreakpoint != null) {
        int oldLineNumber = currentBreakpoint.getLineNumber();
        BreakpointRenderer breakpointRenderer = getBreakpointRendererForFile(currentBreakpoint.getPath());
        if (breakpointRenderer != null) {
            breakpointRenderer.setLineActive(oldLineNumber, false);
        }
        currentBreakpoint = null;
    }
    preserveBreakpoints();
}
Also used : BreakpointRenderer(org.eclipse.che.ide.api.debug.BreakpointRenderer) HasBreakpointRenderer(org.eclipse.che.ide.api.debug.HasBreakpointRenderer) 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