use of com.liferay.ide.portal.core.debug.fm.FMLineBreakpoint in project liferay-ide by liferay.
the class FMBreakpointProvider method addBreakpoint.
public IStatus addBreakpoint(IDocument document, IEditorInput input, int lineNumber, int offset) throws CoreException {
IStatus retval = Status.OK_STATUS;
if (fSourceEditingTextTools instanceof IDebugEditor) {
IDebugEditor debugEditor = (IDebugEditor) fSourceEditingTextTools;
IStatus status = debugEditor.validateBreakpointPosition(lineNumber, offset);
if (status.isOK()) {
if (input instanceof IFileEditorInput) {
final IFileEditorInput fileEditorInput = (IFileEditorInput) input;
final IFile file = fileEditorInput.getFile();
final FMLineBreakpoint bp = new FMLineBreakpoint(file, lineNumber);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(bp);
}
} else {
retval = status;
}
}
return retval;
}
use of com.liferay.ide.portal.core.debug.fm.FMLineBreakpoint in project liferay-ide by liferay.
the class FMLineBreakpointAdapter 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(ILRDebugConstants.ID_FM_DEBUG_MODEL);
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
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)
FMLineBreakpoint lineBreakpoint = new FMLineBreakpoint(resource, lineNumber + 1);
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
Aggregations