KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > debug > breakpoints > JspBreakpointsReader


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.debug.breakpoints;
21
22 import org.netbeans.api.debugger.*;
23 import org.netbeans.api.debugger.jpda.*;
24
25 /**
26  *
27  * @author Martin Grebac
28  */

29 public class JspBreakpointsReader implements Properties.Reader {
30
31     public String JavaDoc [] getSupportedClassNames () {
32         return new String JavaDoc[] { JspLineBreakpoint.class.getName () };
33     }
34
35     public Object JavaDoc read (String JavaDoc typeID, Properties properties) {
36
37         JspLineBreakpoint b = null;
38         if (typeID.equals (JspLineBreakpoint.class.getName ())) {
39             b = JspLineBreakpoint.create (
40                 properties.getString(JspLineBreakpoint.PROP_URL, null),
41                 properties.getInt(JspLineBreakpoint.PROP_LINE_NUMBER, 1)
42             );
43             b.setCondition(properties.getString (JspLineBreakpoint.PROP_CONDITION, ""));
44             b.setPrintText(properties.getString (JspLineBreakpoint.PROP_PRINT_TEXT, ""));
45             b.setGroupName(properties.getString (Breakpoint.PROP_GROUP_NAME, ""));
46             b.setSuspend(properties.getInt (JspLineBreakpoint.PROP_SUSPEND, JspLineBreakpoint.SUSPEND_ALL));
47             if (properties.getBoolean (JspLineBreakpoint.PROP_ENABLED, true)) {
48                 b.enable ();
49             } else {
50                 b.disable ();
51             }
52         }
53
54         return b;
55     }
56     
57     public void write (Object JavaDoc object, Properties properties) {
58
59         if (object instanceof JspLineBreakpoint) {
60             JspLineBreakpoint b = (JspLineBreakpoint) object;
61             properties.setString (JspLineBreakpoint.PROP_PRINT_TEXT, b.getPrintText ());
62             properties.setString (JspLineBreakpoint.PROP_GROUP_NAME, b.getGroupName ());
63             properties.setInt (JspLineBreakpoint.PROP_SUSPEND, b.getSuspend ());
64             properties.setBoolean (JspLineBreakpoint.PROP_ENABLED, b.isEnabled ());
65             properties.setString (JspLineBreakpoint.PROP_URL, b.getURL ());
66             properties.setInt (JspLineBreakpoint.PROP_LINE_NUMBER, b.getLineNumber ());
67             properties.setString (JspLineBreakpoint.PROP_CONDITION, b.getCondition ());
68         }
69         return;
70     }
71 }
72
Popular Tags