public static String getFileName (LineBreakpoint b) { try { return new File (new URL (b.getURL ()).getFile ()).getName (); } catch (MalformedURLException e) { return null; } }
public static String getFileName(LineBreakpoint b) { try { return new File(new URL(b.getURL()).getFile()).getName(); } catch (MalformedURLException e) { return null; } }
public void propertyChange(PropertyChangeEvent evt) { if (LineBreakpoint.PROP_LINE_NUMBER.equals(evt.getPropertyName())) { synchronized (LineTranslations.this) { Map<LineBreakpoint, Integer> bpLines = originalBreakpointLines.get(timeStamp); if (bpLines != null) { LineBreakpoint lb = (LineBreakpoint) evt.getSource(); int line = getOriginalLineNumber(lb.getURL(), lb.getLineNumber(), timeStamp); bpLines.put(lb, line); } } } } };
private String valiadateMsg () { int line; try { line = Integer.parseInt(tfLineNumber.getText().trim()); } catch (NumberFormatException e) { return NbBundle.getMessage(LineBreakpointPanel.class, "MSG_No_Line_Number_Spec"); } if (line <= 0) { return NbBundle.getMessage(LineBreakpointPanel.class, "MSG_NonPositive_Line_Number_Spec"); } int maxLine = findNumLines(breakpoint.getURL()); if (maxLine == 0) { // Not found maxLine = Integer.MAX_VALUE; // Not to bother the user when we did not find it } if (line > maxLine) { return NbBundle.getMessage(LineBreakpointPanel.class, "MSG_TooBig_Line_Number_Spec", Integer.toString(line), Integer.toString(maxLine)); } return null; }
@Override public void propertyChange(PropertyChangeEvent evt) { if (LineBreakpoint.PROP_LINE_NUMBER.equals(evt.getPropertyName())) { final Map<LineBreakpoint, Integer> bpLines; synchronized (LineTranslations.this) { bpLines = originalBreakpointLines.get(timeStamp); if (bpLines == null) { return ; } } LineBreakpoint lb = (LineBreakpoint) evt.getSource(); int line = getOriginalLineNumber(lb.getURL(), lb.getLineNumber(), timeStamp); synchronized (LineTranslations.this) { bpLines.put(lb, line); } } } };
/** * Updates timeStamp for gived url. * * @param timeStamp time stamp to be updated * @param url an url */ synchronized void updateTimeStamp (Object timeStamp, String url) { //System.err.println("LineTranslations.updateTimeStamp("+timeStamp+", "+url+")"); Registry registry = timeStampToRegistry.get (timeStamp); registry.register (getDataObject (url)); Map<LineBreakpoint, Integer> bpLines = originalBreakpointLines.get(timeStamp); if (bpLines != null) { Set<LineBreakpoint> bpts = new HashSet<LineBreakpoint>(bpLines.keySet()); for (LineBreakpoint bp : bpts) { if (url.equals(bp.getURL())) { bpLines.remove(bp); } } } }
@Override public void propertyChange(PropertyChangeEvent evt) { if (LineBreakpoint.PROP_LINE_NUMBER.equals(evt.getPropertyName())) { final Map<LineBreakpoint, Integer> bpLines; synchronized (LineTranslations.this) { bpLines = originalBreakpointLines.get(timeStamp); if (bpLines == null) { return ; } } LineBreakpoint lb = (LineBreakpoint) evt.getSource(); int line = getOriginalLineNumber(lb.getURL(), lb.getLineNumber(), timeStamp); synchronized (LineTranslations.this) { bpLines.put(lb, line); } } } };
/** * Updates timeStamp for gived url. * * @param timeStamp time stamp to be updated * @param url an url */ void updateTimeStamp (Object timeStamp, String url) { //System.err.println("LineTranslations.updateTimeStamp("+timeStamp+", "+url+")"); DataObject dobj = getDataObject (url); synchronized (this) { Registry registry = timeStampToRegistry.get (timeStamp); registry.register (dobj); Map<LineBreakpoint, Integer> bpLines = originalBreakpointLines.get(timeStamp); if (bpLines != null) { Set<LineBreakpoint> bpts = new HashSet<LineBreakpoint>(bpLines.keySet()); for (LineBreakpoint bp : bpts) { if (url.equals(bp.getURL())) { bpLines.remove(bp); } } } } }
/** * Updates timeStamp for gived url. * * @param timeStamp time stamp to be updated * @param url an url */ void updateTimeStamp (Object timeStamp, String url) { //System.err.println("LineTranslations.updateTimeStamp("+timeStamp+", "+url+")"); DataObject dobj = getDataObject (url); synchronized (this) { Registry registry = timeStampToRegistry.get (timeStamp); registry.register (dobj); Map<LineBreakpoint, Integer> bpLines = originalBreakpointLines.get(timeStamp); if (bpLines != null) { Set<LineBreakpoint> bpts = new HashSet<LineBreakpoint>(bpLines.keySet()); for (LineBreakpoint bp : bpts) { if (url.equals(bp.getURL())) { bpLines.remove(bp); } } } } }
private void setupConditionPane() { conditionsPanel.setupConditionPaneContext(breakpoint.getURL(), breakpoint.getLineNumber()); }
synchronized void registerForLineUpdates(LineBreakpoint lb) { //translatedBreakpoints.add(lb); DataObject dobj = getDataObject(lb.getURL()); if (dobj != null) { BreakpointLineUpdater blu = new BreakpointLineUpdater(lb, dobj); try { blu.attach(); lineUpdaters.put(lb, blu); } catch (IOException ioex) { // Ignore } } }
static LineBreakpoint findBreakpoint(String url, int lineNumber) { Breakpoint[] breakpoints = DebuggerManager.getDebuggerManager().getBreakpoints(); for (int i = 0; i < breakpoints.length; i++) { if (!(breakpoints[i] instanceof LineBreakpoint)) { continue; } LineBreakpoint lb = (LineBreakpoint) breakpoints[i]; if (!lb.getURL().equals(url)) { continue; } if (lb.getLineNumber() == lineNumber) { return lb; } } return null; } }
void registerForLineUpdates(LineBreakpoint lb) { //translatedBreakpoints.add(lb); DataObject dobj = getDataObject(lb.getURL()); if (dobj != null) { BreakpointLineUpdater blu = new BreakpointLineUpdater(lb, dobj); try { blu.attach(); synchronized (this) { lineUpdaters.put(lb, blu); } } catch (IOException ioex) { // Ignore } } }
void registerForLineUpdates(LineBreakpoint lb) { //translatedBreakpoints.add(lb); DataObject dobj = getDataObject(lb.getURL()); if (dobj != null) { BreakpointLineUpdater blu = new BreakpointLineUpdater(lb, dobj); try { blu.attach(); synchronized (this) { lineUpdaters.put(lb, blu); } } catch (IOException ioex) { // Ignore } } }
/** * Adds annotation to url:line where the given breakpoint is set. * * @param b breakpoint to annotate * * @return annotation or <code>null</code>, when the annotation can not be * created at the url:line where the given breakpoint is set. */ public static Object annotate(LineBreakpoint b) { String url = b.getURL(); int lineNumber = b.getLineNumber(); if (lineNumber < 1) { return null; } String condition = b.getCondition(); boolean isConditional = (condition != null) && !condition.trim().equals(""); // NOI18N String annotationType = b.isEnabled() ? (isConditional ? EditorContext.CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE : EditorContext.BREAKPOINT_ANNOTATION_TYPE) : (isConditional ? EditorContext.DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE : EditorContext.DISABLED_BREAKPOINT_ANNOTATION_TYPE); return annotate(url, lineNumber, annotationType, b); } }
/** Creates new form LineBreakpointPanel */ public LineBreakpointPanel (LineBreakpoint b) { breakpoint = b; initComponents (); String url = b.getURL(); try { URI uri = new URI(url); tfFileName.setText(uri.getPath()); } catch (Exception e) { tfFileName.setText(url); } tfFileName.setPreferredSize(new Dimension( 30*tfFileName.getFontMetrics(tfFileName.getFont()).charWidth('W'), tfFileName.getPreferredSize().height)); tfLineNumber.setText(Integer.toString(b.getLineNumber())); conditionsPanel = new ConditionsPanel(); setupConditionPane(); conditionsPanel.showClassFilter(false); conditionsPanel.setCondition(b.getCondition()); conditionsPanel.setHitCountFilteringStyle(b.getHitCountFilteringStyle()); conditionsPanel.setHitCount(b.getHitCountFilter()); cPanel.add(conditionsPanel, "Center"); actionsPanel = new ActionsPanel (b); pActions.add (actionsPanel, "Center"); }
public static Object annotate ( LineBreakpoint b ) { String url = b.getURL (); int lineNumber = b.getLineNumber (); if (lineNumber < 1) return null; String condition = b.getCondition (); boolean isConditional = (condition != null) && !"".equals (condition.trim ()); // NOI18N boolean isInvalid = b.getValidity() == VALIDITY.INVALID; String annotationType = b.isEnabled () ? (isConditional ? EditorContext.CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE : EditorContext.BREAKPOINT_ANNOTATION_TYPE) : (isConditional ? EditorContext.DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE : EditorContext.DISABLED_BREAKPOINT_ANNOTATION_TYPE); if (isInvalid && b.isEnabled ()) annotationType += "_broken"; return getContext().annotate ( url, lineNumber, annotationType, null ); }
@Override public void doAction (Object action) { DebuggerManager debugManager = DebuggerManager.getDebuggerManager (); // 1) get source name & line number int lineNumber = Context.getCurrentLineNumber (); String url = Context.getCurrentURL (); if (url == null) return; // 2) find and remove existing line breakpoint for (Breakpoint breakpoint : debugManager.getBreakpoints()) { if (breakpoint instanceof LineBreakpoint) { LineBreakpoint lineBreakpoint = ((LineBreakpoint) breakpoint); if (lineNumber == lineBreakpoint.getLineNumber() && url.equals(lineBreakpoint.getURL())) { debugManager.removeBreakpoint(breakpoint); return; } } } // 3) Add new groovy line breakpoint debugManager.addBreakpoint(GroovyLineBreakpointFactory.create(url, lineNumber)); } }