001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.bpel.debugger.api.breakpoints;
021:
022: /**
023: *
024: * @author Alexander Zgursky
025: */
026: public final class LineBreakpoint extends BpelBreakpoint {
027:
028: /** Property name constant. */
029: public static final String PROP_LINE_NUMBER = "lineNumber"; // NOI18N
030: /** Property name constant. */
031: public static final String PROP_URL = "url"; // NOI18N
032: /** Property name constant. */
033: public static final String PROP_XPATH = "xpath"; // NOI18N
034:
035: private String myUrl;
036: private String myXpath;
037: private int myLineNumber;
038:
039: private LineBreakpoint() {
040: // does nothing
041: }
042:
043: public static LineBreakpoint create(final String url,
044: final String xpath, final int lineNumber) {
045:
046: final LineBreakpoint breakpoint = new LineBreakpoint();
047:
048: breakpoint.setURL(url);
049: breakpoint.setXpath(xpath);
050: breakpoint.setLineNumber(lineNumber);
051:
052: return breakpoint;
053: }
054:
055: /**
056: * Gets full path of a source file to stop on.
057: *
058: * @return full path of a source file to stop on
059: */
060: public String getURL() {
061: return myUrl;
062: }
063:
064: /**
065: * Sets full path of a source file to stop on.
066: *
067: * @param newUrl full path of a source file to stop on
068: */
069: public void setURL(final String newUrl) {
070:
071: final String oldUrl = myUrl;
072: myUrl = newUrl;
073: firePropertyChange(PROP_URL, oldUrl, newUrl);
074: }
075:
076: /**
077: *
078: * @param newXpath
079: */
080: public void setXpath(final String newXpath) {
081:
082: final String oldXpath = myXpath;
083: myXpath = newXpath;
084: firePropertyChange(PROP_XPATH, oldXpath, newXpath);
085: }
086:
087: /**
088: *
089: * @return
090: */
091: public String getXpath() {
092: return myXpath;
093: }
094:
095: /**
096: *
097: * @param lineNumber
098: */
099: public void setLineNumber(final int lineNumber) {
100:
101: final int oldLineNumber = myLineNumber;
102: myLineNumber = lineNumber;
103: firePropertyChange(PROP_LINE_NUMBER, oldLineNumber,
104: myLineNumber);
105: }
106:
107: /**
108: * Gets line number to stop on.
109: *
110: * @return line number to stop on
111: */
112: public int getLineNumber() {
113: return myLineNumber;
114: }
115:
116: //TODO:remove this method sometimes: it's a hack to notify the views
117: //that the information, associated with the breakpoint has changed
118: /**
119: * Notify all the property change listeners
120: * about "change"
121: */
122: public void touch() {
123: firePropertyChange(null, null, null);
124: }
125:
126: @Override
127: public String toString() {
128: return "LineBreakpoint " + myUrl + ":" + myLineNumber + // NOI18N
129: (myXpath != null ? " (" + myXpath + ")" : ""); // NOI18N
130: }
131: }
|