KickJava   Java API By Example, From Geeks To Geeks.

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


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
23 import org.netbeans.api.debugger.jpda.*;
24 import org.netbeans.modules.web.debug.Context;
25
26 import org.netbeans.spi.viewmodel.NodeModel;
27 import org.netbeans.spi.viewmodel.ModelListener;
28 import org.netbeans.spi.viewmodel.UnknownTypeException;
29
30 import org.openide.util.NbBundle;
31
32
33 /**
34  * @author Martin Grebac
35  */

36 public class JspBreakpointsNodeModel implements NodeModel {
37
38     public static final String JavaDoc LINE_BREAKPOINT =
39         "org/netbeans/modules/debugger/resources/breakpointsView/Breakpoint";
40     
41     public String JavaDoc getDisplayName (Object JavaDoc o) throws UnknownTypeException {
42         if (o instanceof JspLineBreakpoint) {
43             JspLineBreakpoint b = (JspLineBreakpoint) o;
44             return NbBundle.getMessage (JspBreakpointsNodeModel.class,
45                     "CTL_Jsp_Line_Breakpoint",
46                     Context.getFileName (b),
47                     "" + b.getLineNumber()
48                 );
49         }
50         throw new UnknownTypeException(o);
51     }
52     
53     public String JavaDoc getShortDescription (Object JavaDoc o) throws UnknownTypeException {
54         if (o instanceof JspLineBreakpoint) {
55             return NbBundle.getMessage (
56                     JspBreakpointsNodeModel.class,
57                     "CTL_Jsp_Line_Breakpoint",
58                     Context.getFileName ((JspLineBreakpoint) o),
59                     "" + ((JspLineBreakpoint) o).getLineNumber ()
60                 );
61         }
62         throw new UnknownTypeException (o);
63     }
64     
65     public String JavaDoc getIconBase (Object JavaDoc o) throws UnknownTypeException {
66         if (o instanceof JspLineBreakpoint) {
67             return LINE_BREAKPOINT;
68         }
69         throw new UnknownTypeException (o);
70     }
71
72     /**
73      *
74      * @param l the listener to add
75      */

76     public void addModelListener (ModelListener l) {
77 // listeners.add (l);
78
}
79
80     /**
81      *
82      * @param l the listener to remove
83      */

84     public void removeModelListener (ModelListener l) {
85 // listeners.remove (l);
86
}
87     
88 // private void fireTreeChanged () {
89
// Vector v = (Vector) listeners.clone ();
90
// int i, k = v.size ();
91
// for (i = 0; i < k; i++)
92
// ((TreeModelListener) v.get (i)).treeChanged ();
93
// }
94
//
95
// private void fireTreeNodeChanged (Object parent) {
96
// Vector v = (Vector) listeners.clone ();
97
// int i, k = v.size ();
98
// for (i = 0; i < k; i++)
99
// ((TreeModelListener) v.get (i)).treeNodeChanged (parent);
100
// }
101

102 // static String getShort (String s) {
103
// if (s.indexOf ('*') >= 0) return s;
104
// int i = s.lastIndexOf ('.');
105
// if (i < 0) return s;
106
// return s.substring (i + 1);
107
// }
108
}
109
Popular Tags