|
What this is
Other links
The source code/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.web.debug.breakpoints;
import org.netbeans.api.debugger.*;
import org.netbeans.api.debugger.jpda.*;
import org.netbeans.modules.web.debug.util.Utils;
import java.util.*;
import org.openide.ErrorManager;
import org.openide.util.NbBundle;
/**
*
* @author Martin Grebac
*/
public class JspLineBreakpoint extends Breakpoint {
/** Property name for enabled status of the breakpoint. */
public static final String PROP_ENABLED = JPDABreakpoint.PROP_ENABLED;
public static final String PROP_SUSPEND = JPDABreakpoint.PROP_SUSPEND;
public static final String PROP_HIDDEN = JPDABreakpoint.PROP_HIDDEN;
public static final String PROP_PRINT_TEXT = JPDABreakpoint.PROP_PRINT_TEXT;
public static final int SUSPEND_ALL = JPDABreakpoint.SUSPEND_ALL;
public static final int SUSPEND_EVENT_THREAD = JPDABreakpoint.SUSPEND_EVENT_THREAD;
public static final int SUSPEND_NONE = JPDABreakpoint.SUSPEND_NONE;
public static final String PROP_LINE_NUMBER = LineBreakpoint.PROP_LINE_NUMBER;
public static final String PROP_URL = LineBreakpoint.PROP_URL;
public static final String PROP_CONDITION = LineBreakpoint.PROP_CONDITION;
private boolean enabled = true;
private boolean hidden = false;
private int suspend = SUSPEND_ALL;
private String printText;
private String url = ""; // NOI18N
private int lineNumber;
private String condition = ""; // NOI18N
private LineBreakpoint javalb;
/** Creates a new instance of JspLineBreakpoint */
public JspLineBreakpoint() { }
/** Creates a new instance of JspLineBreakpoint with url, linenumber*/
public JspLineBreakpoint(String url, int lineNumber) {
super();
this.url = url;
this.lineNumber = lineNumber;
String pt = NbBundle.getMessage(JspLineBreakpoint.class, "CTL_Default_Print_Text");
this.printText = org.openide.util.Utilities.replaceString(pt, "{jspName}", Utils.getJspName(url));
DebuggerManager d = DebuggerManager.getDebuggerManager();
Utils.getEM().log("jsp url: " + url);
String filter = Utils.getClassFilter(url);
Utils.getEM().log("filter: " + filter);
javalb = LineBreakpoint.create(filter, lineNumber);
javalb.setStratum("JSP"); // NOI18N
javalb.setSourceName(Utils.getJspName(url));
javalb.setHidden(true);
javalb.setPrintText(printText);
String context = Utils.getContextPath(url);
String condition = "request.getContextPath().equals(\"" + context + "\")"; // NOI18N
javalb.setCondition(condition);
Utils.getEM().log("condition: " + condition);
d.addBreakpoint(javalb);
this.setURL(url);
this.setLineNumber(lineNumber);
}
/**
* Creates a new breakpoint for given parameters.
*
* @param url a url
* @param lineNumber a line number
* @return a new breakpoint for given parameters
*/
public static JspLineBreakpoint create(String url, int lineNumber) {
return new JspLineBreakpoint(url, lineNumber);
}
/**
* Gets value of suspend property.
*
* @return value of suspend property
*/
public int getSuspend () {
return suspend;
}
/**
* Sets value of suspend property.
*
* @param s a new value of suspend property
*/
public void setSuspend (int s) {
if (s == suspend) return;
int old = suspend;
suspend = s;
if (javalb != null) {
javalb.setSuspend(s);
}
firePropertyChange(PROP_SUSPEND, new Integer(old), new Integer(s));
}
/**
* Gets value of hidden property.
*
* @return value of hidden property
*/
public boolean isHidden () {
return hidden;
}
/**
* Sets value of hidden property.
*
* @param h a new value of hidden property
*/
public void setHidden (boolean h) {
if (h == hidden) return;
boolean old = hidden;
hidden = h;
firePropertyChange(PROP_HIDDEN, new Boolean(old), new Boolean(h));
}
/**
* Gets value of print text property.
*
* @return value of print text property
*/
public String getPrintText () {
return printText;
}
/**
* Sets value of print text property.
*
* @param printText a new value of print text property
*/
public void setPrintText (String printText) {
if (this.printText == printText) return;
String old = this.printText;
this.printText = printText;
if (javalb != null) {
javalb.setPrintText(printText);
}
firePropertyChange(PROP_PRINT_TEXT, old, printText);
}
/**
* Called when breakpoint is removed.
*/
protected void dispose() {
if (javalb != null) {
DebuggerManager.getDebuggerManager().removeBreakpoint(javalb);
}
}
/**
* Test whether the breakpoint is enabled.
*
* @return
|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.