use of org.eclipse.debug.core.model.IBreakpoint in project erlide_eclipse by erlang.
the class ErlangDebugOptionsManager method updateBreakpointsMessages.
/**
* Updates message attributes on the given erlang breakpoints.
*/
private void updateBreakpointsMessages(final IBreakpoint[] breakpoints) {
final IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(final IProgressMonitor monitor) throws CoreException {
for (final IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof IErlangBreakpoint) {
final IErlangBreakpoint erlangBreakpoint = (IErlangBreakpoint) breakpoint;
final String message = erlangBreakpoint.getMessage();
breakpoint.getMarker().setAttribute(IMarker.MESSAGE, message);
}
}
}
};
try {
ResourcesPlugin.getWorkspace().run(runnable, null, 0, null);
} catch (final CoreException e) {
ErlLogger.error(e);
}
}
use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.
the class ManageBreakpointAction method update.
public void update() {
// doEnable means "enable" instead of "disable"
doEnable = true;
breakpoints = getBreakpoints(getMarkers());
for (int i = 0; doEnable && i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
try {
if (breakpoint.isEnabled()) {
doEnable = false;
}
} catch (CoreException e) {
// $NON-NLS-1$
Logger.logException("breakpoint not responding to isEnabled: " + breakpoint, e);
}
}
setEnabled(breakpoints != null && breakpoints.length > 0);
if (doEnable)
// $NON-NLS-1$
setText(SSEUIMessages.ManageBreakpointAction_0);
else
// $NON-NLS-1$
setText(SSEUIMessages.ManageBreakpointAction_1);
}
use of org.eclipse.debug.core.model.IBreakpoint 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.model.IBreakpoint in project webtools.sourceediting by eclipse.
the class XSLBreakpointProvider method addBreakpoint.
public IStatus addBreakpoint(IDocument document, IEditorInput input, int editorLineNumber, int offset) throws CoreException {
// check if there is a valid position to set breakpoint
int pos = getValidPosition(document, editorLineNumber);
IStatus status = null;
if (pos >= 0) {
IResource res = getResourceFromInput(input);
if (res != null) {
boolean add = true;
if (add) {
IBreakpoint point = new XSLLineBreakpoint(res, editorLineNumber, pos, pos);
if (point == null) {
status = new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR, Messages.XSLBreakpointProvider_0, null);
} else {
// DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(point);
}
}
} else if (input instanceof IStorageEditorInput) {
res = ResourcesPlugin.getWorkspace().getRoot();
String id = input.getName();
if (input instanceof IStorageEditorInput && ((IStorageEditorInput) input).getStorage() != null && ((IStorageEditorInput) input).getStorage().getFullPath() != null) {
id = ((IStorageEditorInput) input).getStorage().getFullPath().toString();
}
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(StructuredResourceMarkerAnnotationModel.SECONDARY_ID_KEY, id);
IBreakpoint point = new XSLLineBreakpoint(res, editorLineNumber, pos, pos);
if (point == null) {
status = new Status(IStatus.ERROR, XSLDebugUIPlugin.PLUGIN_ID, IStatus.ERROR, Messages.XSLBreakpointProvider_0, null);
}
}
}
if (status == null) {
status = new Status(IStatus.OK, XSLDebugUIPlugin.PLUGIN_ID, IStatus.OK, "JSPUIMessages.OK", // $NON-NLS-1$
null);
}
return status;
}
use of org.eclipse.debug.core.model.IBreakpoint in project webtools.sourceediting by eclipse.
the class XSLLineBreakpointAdapter method toggleLineBreakpoints.
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
ITextEditor textEditor = getEditor(part);
if (textEditor != null) {
IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXSLConstants.ID_XSL_DEBUG_MODEL);
for (IBreakpoint breakpoint : breakpoints) {
if (resource.equals(breakpoint.getMarker().getResource())) {
if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
// remove
breakpoint.delete();
return;
}
}
}
// create line breakpoint (doc line numbers start at 0)
XSLLineBreakpoint lineBreakpoint = new XSLLineBreakpoint(resource, lineNumber + 1, 1, 1);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
Aggregations