/** * Stores the value of the hit count in the breakpoint. * @param breakpoint the breakpoint to update * @throws CoreException if an exception occurs while setting * the hit count */ private void storeHitCount(IJavaBreakpoint breakpoint) throws CoreException { int hitCount = -1; if (fHitCountButton.getSelection()) { try { hitCount = Integer.parseInt(fHitCountText.getText()); } catch (NumberFormatException e) { JDIDebugUIPlugin.log(new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, MessageFormat.format("JavaBreakpointPage allowed input of invalid string for hit count value: {0}.", new String[] { fHitCountText.getText() }), e)); //$NON-NLS-1$ } } breakpoint.setHitCount(hitCount); }
/** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { IStructuredSelection selection= getCurrentSelection(); if (selection == null) { return; } Iterator itr= selection.iterator(); if (!itr.hasNext()) { return; } while (itr.hasNext()) { IJavaBreakpoint breakpoint= (IJavaBreakpoint)itr.next(); try { int oldHitCount= breakpoint.getHitCount(); int newHitCount= hitCountDialog(breakpoint); if (newHitCount != -1) { if (oldHitCount == newHitCount && newHitCount == 0) { return; } breakpoint.setHitCount(newHitCount); } } catch (CoreException ce) { JDIDebugUIPlugin.statusDialog(ce.getStatus()); } } }
/** * Applies the original attributes to the new breakpoint * * @param breakpoint the new breakpoint * @throws CoreException */ protected void apply(IJavaBreakpoint breakpoint) throws CoreException { breakpoint.setHitCount(fHitCount); for (int i = 0; i < fInstanceFilters.length; i++) { breakpoint.addInstanceFilter(fInstanceFilters[i]); } breakpoint.setSuspendPolicy(fSuspendPolicy); for (int i = 0; i < fThreadFilters.length; i++) { breakpoint.setThreadFilter(fThreadFilters[i]); } breakpoint.setEnabled(fEnabled); }