use of org.eclipse.debug.core.IBreakpointManager in project erlide_eclipse by erlang.
the class ErlangProcess method getBreakpoints.
@Override
public IBreakpoint[] getBreakpoints() {
IStackFrame top = null;
try {
top = getTopStackFrame();
} catch (final DebugException e1) {
// can never happen
}
if (top instanceof ErlangStackFrame) {
final ErlangStackFrame topFrame = (ErlangStackFrame) top;
final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
final IBreakpoint[] breakpoints = breakpointManager.getBreakpoints();
for (final IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof ErlangLineBreakpoint) {
final ErlangLineBreakpoint lineBreakpoint = (ErlangLineBreakpoint) breakpoint;
try {
if (lineBreakpoint.getModule().equals(topFrame.getModule()) && lineBreakpoint.getLineNumber() == topFrame.getLineNumber()) {
return new IBreakpoint[] { lineBreakpoint };
}
} catch (final DebugException e) {
ErlLogger.warn(e);
} catch (final CoreException e) {
ErlLogger.warn(e);
}
}
}
}
return new IBreakpoint[0];
}
use of org.eclipse.debug.core.IBreakpointManager in project erlide_eclipse by erlang.
the class BackendData method addBreakpointProjectsAndModules.
public static Set<String> addBreakpointProjectsAndModules(final Collection<IProject> projects, final List<String> interpretedModules) {
final IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager();
final Set<String> result = new HashSet<>(interpretedModules);
for (final IBreakpoint bp : bpm.getBreakpoints(ErlDebugConstants.ID_ERLANG_DEBUG_MODEL)) {
final IMarker m = bp.getMarker();
final IResource r = m.getResource();
final String name = r.getName();
if (SourceKind.hasErlExtension(name)) {
final IProject p = r.getProject();
if (projects == null || projects.contains(p)) {
final String s = p.getName() + ":" + name;
result.add(s);
}
}
}
return result;
}
use of org.eclipse.debug.core.IBreakpointManager in project webtools.sourceediting by eclipse.
the class ToggleBreakpointsTarget method toggleLineBreakpoints.
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart,
* org.eclipse.jface.viewers.ISelection)
*/
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
ITextEditor editor = part.getAdapter(ITextEditor.class);
if (selection instanceof ITextSelection) {
ITextSelection textSelection = (ITextSelection) selection;
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
int lineNumber = -1;
try {
lineNumber = document.getLineOfOffset(textSelection.getOffset());
} catch (BadLocationException e) {
}
if (lineNumber >= 0) {
ToggleBreakpointAction toggler = new ToggleBreakpointAction(editor, null);
toggler.update();
if (toggler.isEnabled()) {
IResource resource = toggler.getResource();
AbstractMarkerAnnotationModel model = toggler.getAnnotationModel();
IBreakpoint[] breakpoints = getBreakpoints(resource, document, model, lineNumber);
if (breakpoints.length > 0) {
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
for (int i = 0; i < breakpoints.length; i++) {
breakpoints[i].getMarker().delete();
breakpointManager.removeBreakpoint(breakpoints[i], true);
}
} else {
toggler.createBreakpoints(lineNumber + 1);
}
}
}
}
}
use of org.eclipse.debug.core.IBreakpointManager in project webtools.sourceediting by eclipse.
the class BreakpointRulerAction method getBreakpoints.
protected IBreakpoint[] getBreakpoints(IMarker[] markers) {
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
List breakpoints = new ArrayList(markers.length);
for (int i = 0; i < markers.length; i++) {
IBreakpoint breakpoint = manager.getBreakpoint(markers[i]);
if (breakpoint != null) {
breakpoints.add(breakpoint);
}
}
return (IBreakpoint[]) breakpoints.toArray(new IBreakpoint[0]);
}
use of org.eclipse.debug.core.IBreakpointManager in project webtools.sourceediting by eclipse.
the class ToggleBreakpointAction method removeBreakpoints.
protected void removeBreakpoints(int lineNumber) {
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = getBreakpoints(getMarkers());
for (int i = 0; i < breakpoints.length; i++) {
try {
breakpointManager.removeBreakpoint(breakpoints[i], true);
} catch (CoreException e) {
Logger.logException(e);
}
}
}
Aggregations