use of org.eclipse.wst.xsl.launching.model.XSLLineBreakpoint 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.wst.xsl.launching.model.XSLLineBreakpoint 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