KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > scripting > php > dbginterface > DebuggerAnnotation


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.scripting.php.dbginterface;
21
22 import org.openide.text.Annotatable;
23 import org.openide.text.Annotation;
24 import org.openide.util.NbBundle;
25
26
27 /**
28  * Debugger Annotation class.
29  *
30  * @author Jan Jancura
31  */

32 public class DebuggerAnnotation extends Annotation {
33
34     /** Annotation type constants. */
35     public static final String JavaDoc BREAKPOINT_ANNOTATION_TYPE = "Breakpoint";
36     public static final String JavaDoc DISABLED_BREAKPOINT_ANNOTATION_TYPE = "DisabledBreakpoint";
37     public static final String JavaDoc CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE = "CondBreakpoint";
38     public static final String JavaDoc DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE = "DisabledCondBreakpoint";
39     public static final String JavaDoc CURRENT_LINE_ANNOTATION_TYPE = "CurrentPC";
40     public static final String JavaDoc CURRENT_LINE_ANNOTATION_TYPE2 = "CurrentPC2";
41     public static final String JavaDoc CURRENT_LINE_PART_ANNOTATION_TYPE = "CurrentPCLinePart";
42     public static final String JavaDoc CURRENT_LINE_PART_ANNOTATION_TYPE2 = "CurrentPC2LinePart";
43     public static final String JavaDoc CALL_STACK_FRAME_ANNOTATION_TYPE = "CallSite";
44     public static final String JavaDoc ERROR_ANNOTATION_TYPE = "PHPError";
45     public static final String JavaDoc NOTICE_ANNOTATION_TYPE = "PHPNotice";
46     public static final String JavaDoc WARNING_ANNOTATION_TYPE = "PHPWarning";
47     
48     private Annotatable annotatable;
49     private String JavaDoc type;
50     private String JavaDoc message;
51
52     public DebuggerAnnotation(String JavaDoc type, Annotatable annotatable) {
53         this.type = type;
54         this.annotatable = annotatable;
55         attach(annotatable);
56     }
57
58     public DebuggerAnnotation(String JavaDoc type, Annotatable annotatable, String JavaDoc message) {
59         this.type = type;
60         this.annotatable = annotatable;
61         this.message = message;
62         
63         attach(annotatable);
64     }
65     
66     public String JavaDoc getAnnotationType() {
67         return type;
68     }
69
70     public String JavaDoc getShortDescription() {
71         if (type == BREAKPOINT_ANNOTATION_TYPE) {
72             return NbBundle.getBundle(DebuggerAnnotation.class).getString(
73                     "TT_BREAKPOINT"); // NOI18N
74
} else if (type == DISABLED_BREAKPOINT_ANNOTATION_TYPE) {
75             return NbBundle.getBundle(DebuggerAnnotation.class).getString(
76                     "TT_DISABLED_BREAKPOINT"); // NOI18N
77
} else if (type == CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE) {
78             return NbBundle.getBundle(DebuggerAnnotation.class).getString(
79                     "TT_CONDITIONAL_BREAKPOINT"); // NOI18N
80
} else if (type == DISABLED_CONDITIONAL_BREAKPOINT_ANNOTATION_TYPE) {
81             return NbBundle.getBundle(DebuggerAnnotation.class).getString(
82                     "TT_DISABLED_CONDITIONAL_BREAKPOINT"); // NOI18N
83
} else if (type == CURRENT_LINE_ANNOTATION_TYPE) {
84             return NbBundle.getMessage(DebuggerAnnotation.class,
85                     "TT_CURRENT_PC"); // NOI18N
86
} else if (type == CURRENT_LINE_ANNOTATION_TYPE2) {
87             return NbBundle.getMessage(DebuggerAnnotation.class,
88                     "TT_CURRENT_PC_2"); // NOI18N
89
} else if (type == CURRENT_LINE_PART_ANNOTATION_TYPE) {
90             return NbBundle.getMessage(DebuggerAnnotation.class,
91                     "TT_CURRENT_PC"); // NOI18N
92
} else if (type == CALL_STACK_FRAME_ANNOTATION_TYPE) {
93             return NbBundle.getBundle(DebuggerAnnotation.class).getString(
94                     "TT_CALLSITE"); // NOI18N
95
}
96         else if (message != null) {
97             return message;
98         }
99         
100         return null;
101     }
102 }
103
Popular Tags