use of org.eclipse.debug.core.model.IBreakpoint in project liferay-ide by liferay.
the class FMDebugTarget method removeRemoteBreakpoints.
private void removeRemoteBreakpoints(final IBreakpoint[] breakpoints) {
final List<Breakpoint> remoteBreakpoints = new ArrayList<Breakpoint>();
for (IBreakpoint bp : breakpoints) {
final String templateName = bp.getMarker().getAttribute(ILRDebugConstants.FM_TEMPLATE_NAME, "");
final String remoteTemplateName = createRemoteTemplateName(templateName);
final Breakpoint remoteBp = new Breakpoint(remoteTemplateName, bp.getMarker().getAttribute(IMarker.LINE_NUMBER, -1));
remoteBreakpoints.add(remoteBp);
}
final Job job = new Job("remove remote breakpoints") {
@Override
protected IStatus run(IProgressMonitor monitor) {
IStatus retval = null;
for (Breakpoint bp : remoteBreakpoints) {
try {
getDebuggerClient().removeBreakpoint(bp);
} catch (Exception e) {
retval = PortalCore.createErrorStatus(NLS.bind("Unable to get debug client to remove breakpoint: {0}:{1}", new Object[] { bp.getTemplateName(), bp.getLine() }), e);
if (retval != Status.OK_STATUS) {
PortalCore.logError(retval.getMessage());
}
}
}
return Status.OK_STATUS;
}
};
job.schedule();
}
use of org.eclipse.debug.core.model.IBreakpoint 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);
}
}
use of org.eclipse.debug.core.model.IBreakpoint in project watchdog by TestRoots.
the class BreakpointCreator method createBreakpoint.
/**
* Factory method that creates and returns a {@link Breakpoint} from a given
* {@link IBreakpoint}.
*/
public static Breakpoint createBreakpoint(IBreakpoint breakpoint) {
Breakpoint result = new Breakpoint(breakpoint.hashCode(), BreakpointClassifier.classify(breakpoint));
try {
result.setEnabled(breakpoint.isEnabled());
// Make sure the hit count and suspend policy are initialized.
result.setHitCount(-1);
if (breakpoint instanceof IJavaBreakpoint) {
IJavaBreakpoint bp = (IJavaBreakpoint) breakpoint;
result.setSuspendPolicy(bp.getSuspendPolicy());
result.setHitCount(bp.getHitCount());
}
// Initialize condition fields if available.
if (breakpoint instanceof IJavaLineBreakpoint) {
IJavaLineBreakpoint bp = (IJavaLineBreakpoint) breakpoint;
result.setConditionEnabled(bp.isConditionEnabled());
result.setCondition(bp.getCondition());
}
} catch (CoreException exception) {
exception.printStackTrace();
}
return result;
}
use of org.eclipse.debug.core.model.IBreakpoint in project watchdog by TestRoots.
the class BreakpointListener method breakpointAdded.
@Override
public void breakpointAdded(IBreakpoint breakpoint) {
Date timestamp = new Date();
Breakpoint bp = BreakpointCreator.createBreakpoint(breakpoint);
breakpoints.put(bp.getHash(), bp);
BreakpointAddEvent event = new BreakpointAddEvent(bp.getHash(), bp.getBreakpointType(), timestamp);
TrackingEventManager.addEvent(event);
}
use of org.eclipse.debug.core.model.IBreakpoint in project watchdog by TestRoots.
the class BreakpointCreatorTest method testCreateBreakpointHitCount.
@Test
public void testCreateBreakpointHitCount() {
IBreakpoint bp = mock(IBreakpoint.class);
Breakpoint result = BreakpointCreator.createBreakpoint(bp);
assertEquals(-1, result.getHitCount());
}
Aggregations