Search in sources :

Example 1 with IBreakpointManager

use of org.eclipse.debug.core.IBreakpointManager in project dbeaver by dbeaver.

the class DatabaseDebugTarget method terminated.

public synchronized void terminated() throws DebugException {
    if (!terminated) {
        threads.clear();
        terminated = true;
        suspended = false;
        try {
            controller.detach(sessionKey, getProgressMonitor());
            controller.unregisterEventHandler(this);
        } catch (DBGException e) {
            String message = NLS.bind("Error terminating {0}", getName());
            IStatus status = DebugCore.newErrorStatus(message, e);
            throw new DebugException(status);
        } finally {
            controller.dispose();
        }
        DebugPlugin debugPlugin = DebugPlugin.getDefault();
        if (debugPlugin != null) {
            IBreakpointManager breakpointManager = debugPlugin.getBreakpointManager();
            breakpointManager.removeBreakpointListener(this);
            debugPlugin.removeDebugEventListener(this);
            breakpointManager.removeBreakpointManagerListener(this);
        }
        if (!getProcess().isTerminated()) {
            try {
                process.terminate();
            } catch (DebugException e) {
            // do nothing
            }
        }
        if (debugPlugin != null) {
            fireTerminateEvent();
        }
    }
}
Also used : DBGException(org.jkiss.dbeaver.debug.DBGException) IStatus(org.eclipse.core.runtime.IStatus) DebugPlugin(org.eclipse.debug.core.DebugPlugin) IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) DebugException(org.eclipse.debug.core.DebugException)

Example 2 with IBreakpointManager

use of org.eclipse.debug.core.IBreakpointManager in project liferay-ide by liferay.

the class FMDebugTarget method getEnabledLineBreakpoints.

private ILineBreakpoint[] getEnabledLineBreakpoints() {
    List<ILineBreakpoint> breakpoints = new ArrayList<ILineBreakpoint>();
    final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
    if (breakpointManager.isEnabled()) {
        IBreakpoint[] fmBreakpoints = breakpointManager.getBreakpoints(getModelIdentifier());
        for (IBreakpoint fmBreakpoint : fmBreakpoints) {
            try {
                if (fmBreakpoint instanceof ILineBreakpoint && supportsBreakpoint(fmBreakpoint) && fmBreakpoint.isEnabled()) {
                    breakpoints.add((ILineBreakpoint) fmBreakpoint);
                }
            } catch (CoreException e) {
            }
        }
    }
    return breakpoints.toArray(new ILineBreakpoint[0]);
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) ILineBreakpoint(org.eclipse.debug.core.model.ILineBreakpoint) IBreakpointManager(org.eclipse.debug.core.IBreakpointManager) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

Example 3 with IBreakpointManager

use of org.eclipse.debug.core.IBreakpointManager 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 4 with IBreakpointManager

use of org.eclipse.debug.core.IBreakpointManager 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 5 with IBreakpointManager

use of org.eclipse.debug.core.IBreakpointManager 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)

Aggregations

IBreakpointManager (org.eclipse.debug.core.IBreakpointManager)14 IBreakpoint (org.eclipse.debug.core.model.IBreakpoint)12 CoreException (org.eclipse.core.runtime.CoreException)7 IMarker (org.eclipse.core.resources.IMarker)4 ArrayList (java.util.ArrayList)3 BadLocationException (org.eclipse.jface.text.BadLocationException)3 ErlangLineBreakpoint (org.erlide.backend.debug.ErlangLineBreakpoint)3 IResource (org.eclipse.core.resources.IResource)2 IStatus (org.eclipse.core.runtime.IStatus)2 DebugException (org.eclipse.debug.core.DebugException)2 IErlangBreakpoint (org.erlide.backend.debug.IErlangBreakpoint)2 HashSet (java.util.HashSet)1 List (java.util.List)1 IProject (org.eclipse.core.resources.IProject)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 Status (org.eclipse.core.runtime.Status)1 DebugPlugin (org.eclipse.debug.core.DebugPlugin)1 ILaunch (org.eclipse.debug.core.ILaunch)1 ILineBreakpoint (org.eclipse.debug.core.model.ILineBreakpoint)1 IStackFrame (org.eclipse.debug.core.model.IStackFrame)1