Search in sources :

Example 11 with IBreakpoint

use of org.eclipse.debug.core.model.IBreakpoint in project watchdog by TestRoots.

the class BreakpointListener method breakpointChanged.

@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
    Date timestamp = new Date();
    Breakpoint bp = BreakpointCreator.createBreakpoint(breakpoint);
    // Replace entry if present, otherwise create new entry.
    Breakpoint old = breakpoints.put(bp.getHash(), bp);
    List<BreakpointChangeType> changes = BreakpointChangeClassifier.classify(old, bp);
    BreakpointChangeEvent event = new BreakpointChangeEvent(bp.getHash(), bp.getBreakpointType(), changes, timestamp);
    TrackingEventManager.addEvent(event);
}
Also used : Breakpoint(nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) BreakpointChangeType(nl.tudelft.watchdog.core.logic.breakpoint.BreakpointChangeType) Date(java.util.Date) BreakpointChangeEvent(nl.tudelft.watchdog.core.logic.event.eventtypes.debugging.BreakpointChangeEvent)

Example 12 with IBreakpoint

use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.

the class ToggleBreakpointsTarget method getBreakpoints.

private IBreakpoint[] getBreakpoints(IResource resource, IDocument document, AbstractMarkerAnnotationModel model, int lineNumber) {
    List<IMarker> markers = new ArrayList<>();
    if (resource != null && model != null && resource.exists()) {
        try {
            IMarker[] allMarkers = resource.findMarkers(IBreakpoint.LINE_BREAKPOINT_MARKER, true, IResource.DEPTH_ZERO);
            if (allMarkers != null) {
                for (int i = 0; i < allMarkers.length; i++) {
                    Position p = model.getMarkerPosition(allMarkers[i]);
                    int markerLine = -1;
                    try {
                        markerLine = document.getLineOfOffset(p.getOffset());
                    } catch (BadLocationException e1) {
                    }
                    if (markerLine == lineNumber) {
                        markers.add(allMarkers[i]);
                    }
                }
            }
        } catch (CoreException x) {
        }
    }
    IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
    List<IBreakpoint> breakpoints = new ArrayList<>(markers.size());
    for (int i = 0; i < markers.size(); i++) {
        IBreakpoint breakpoint = manager.getBreakpoint(markers.get(i));
        if (breakpoint != null) {
            breakpoints.add(breakpoint);
        }
    }
    return breakpoints.toArray(new IBreakpoint[0]);
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) Position(org.eclipse.jface.text.Position) ArrayList(java.util.ArrayList) IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) IMarker(org.eclipse.core.resources.IMarker) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) BadLocationException(org.eclipse.jface.text.BadLocationException)

Example 13 with IBreakpoint

use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.

the class JavaScriptBreakpointProvider method isBreakpointExist.

/*
	 * @param res @param lineNumber @return boolean
	 */
private boolean isBreakpointExist(IResource res, int lineNumber) {
    IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
    IBreakpoint[] breakpoints = manager.getBreakpoints();
    for (int i = 0; i < breakpoints.length; i++) {
        if (!(breakpoints[i] instanceof JavascriptLineBreakpoint))
            continue;
        JavascriptLineBreakpoint breakpoint = (JavascriptLineBreakpoint) breakpoints[i];
        try {
            if (breakpoint.getResource().equals(res) && breakpoint.getLineNumber() == lineNumber) {
                return true;
            }
        } catch (CoreException e) {
            return true;
        }
    }
    return false;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

Example 14 with IBreakpoint

use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.

the class JAXPJavaLaunchConfigurationDelegate method getBreakpoints.

/**
 * Get the Java breakpoint and the XSL breakpoints
 */
@Override
protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) {
    IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
    if (!breakpointManager.isEnabled())
        return null;
    IBreakpoint[] javaBreakpoints = super.getBreakpoints(configuration);
    IBreakpoint[] xslBreakpoints = breakpointManager.getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
    IBreakpoint[] breakpoints = new IBreakpoint[javaBreakpoints.length + xslBreakpoints.length];
    System.arraycopy(javaBreakpoints, 0, breakpoints, 0, javaBreakpoints.length);
    System.arraycopy(xslBreakpoints, 0, breakpoints, javaBreakpoints.length, xslBreakpoints.length);
    return breakpoints;
}
Also used : IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

Example 15 with IBreakpoint

use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.

the class JAXPDebugTarget method breakpointHit.

private void breakpointHit(String event) {
    // determine which breakpoint was hit, and set the thread's breakpoint
    int lastSpace = event.lastIndexOf(' ');
    if (lastSpace > 0) {
        String line = event.substring(lastSpace + 1);
        int lineNumber = Integer.parseInt(line);
        IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
        for (IBreakpoint breakpoint : breakpoints) {
            if (supportsBreakpoint(breakpoint)) {
                if (breakpoint instanceof ILineBreakpoint) {
                    ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
                    try {
                        if (lineBreakpoint.getLineNumber() == lineNumber) {
                            thread.setBreakpoints(new IBreakpoint[] { breakpoint });
                            break;
                        }
                    } catch (CoreException e) {
                    }
                }
            }
        }
    }
    suspended(DebugEvent.BREAKPOINT);
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

Aggregations

IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)36 CoreException (org.eclipse.core.runtime.CoreException)12 IBreakpointManager (org.eclipse.debug.core.IBreakpointManager)12 Breakpoint (nl.tudelft.watchdog.core.logic.breakpoint.Breakpoint)9 IResource (org.eclipse.core.resources.IResource)9 ILineBreakpoint (org.eclipse.debug.core.model.ILineBreakpoint)9 ArrayList (java.util.ArrayList)6 IJavaBreakpoint (org.eclipse.jdt.debug.core.IJavaBreakpoint)6 IJavaLineBreakpoint (org.eclipse.jdt.debug.core.IJavaLineBreakpoint)6 IStatus (org.eclipse.core.runtime.IStatus)5 ITextSelection (org.eclipse.jface.text.ITextSelection)5 Test (org.junit.Test)5 Breakpoint (freemarker.debug.Breakpoint)4 IMarker (org.eclipse.core.resources.IMarker)4 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)4 ErlangLineBreakpoint (org.erlide.backend.debug.ErlangLineBreakpoint)4 RemoteException (java.rmi.RemoteException)3 Date (java.util.Date)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3