KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > jpda > ui > breakpoints > ActionsPanel


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.debugger.jpda.ui.breakpoints;
21
22 import org.netbeans.api.debugger.jpda.JPDABreakpoint;
23
24 /**
25  * @author jj97931
26  */

27 public class ActionsPanel extends javax.swing.JPanel JavaDoc {
28
29     private JPDABreakpoint breakpoint;
30
31     /** Creates new form LineBreakpointPanel */
32     public ActionsPanel (JPDABreakpoint b) {
33         breakpoint = b;
34         initComponents ();
35
36         cbSuspend.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_CB_Actions_Panel_Suspend_None"));
37         cbSuspend.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_CB_Actions_Panel_Suspend_Current"));
38         cbSuspend.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_CB_Actions_Panel_Suspend_All"));
39         switch (b.getSuspend ()) {
40             case JPDABreakpoint.SUSPEND_NONE:
41                 cbSuspend.setSelectedIndex (0);
42                 break;
43             case JPDABreakpoint.SUSPEND_EVENT_THREAD:
44                 cbSuspend.setSelectedIndex (1);
45                 break;
46             case JPDABreakpoint.SUSPEND_ALL:
47                 cbSuspend.setSelectedIndex (2);
48                 break;
49         }
50         if (b.getPrintText () != null)
51             tfPrintText.setText (b.getPrintText ());
52     }
53     
54     /** This method is called from within the constructor to
55      * initialize the form.
56      * WARNING: Do NOT modify this code. The content of this method is
57      * always regenerated by the Form Editor.
58      */

59     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
60
private void initComponents() {
61         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
62
63         tfPrintText = new javax.swing.JTextField JavaDoc();
64         jLabel1 = new javax.swing.JLabel JavaDoc();
65         cbSuspend = new javax.swing.JComboBox JavaDoc();
66         jLabel2 = new javax.swing.JLabel JavaDoc();
67
68         setLayout(new java.awt.GridBagLayout JavaDoc());
69
70         java.util.ResourceBundle JavaDoc bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle"); // NOI18N
71
setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("L_Actions_Panel_BorderTitle"))); // NOI18N
72
tfPrintText.setToolTipText(bundle.getString("TTT_TF_Actions_Panel_Print_Text")); // NOI18N
73
tfPrintText.addActionListener(new java.awt.event.ActionListener JavaDoc() {
74             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
75                 tfPrintTextActionPerformed(evt);
76             }
77         });
78
79         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
80         gridBagConstraints.gridx = 1;
81         gridBagConstraints.gridy = 1;
82         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
83         gridBagConstraints.weightx = 1.0;
84         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
85         add(tfPrintText, gridBagConstraints);
86         tfPrintText.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_TF_Actions_Panel_Print_Text")); // NOI18N
87

88         jLabel1.setLabelFor(cbSuspend);
89         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, bundle.getString("L_Actions_Panel_Suspend")); // NOI18N
90
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
91         gridBagConstraints.gridx = 0;
92         gridBagConstraints.gridy = 0;
93         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
94         add(jLabel1, gridBagConstraints);
95         jLabel1.getAccessibleContext().setAccessibleDescription(bundle.getString("ASCD_L_Actions_Panel_Suspend")); // NOI18N
96

97         cbSuspend.setToolTipText(bundle.getString("TTT_CB_Actions_Panel_Suspend")); // NOI18N
98
cbSuspend.addActionListener(new java.awt.event.ActionListener JavaDoc() {
99             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
100                 cbSuspendActionPerformed(evt);
101             }
102         });
103
104         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
105         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
106         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
107         add(cbSuspend, gridBagConstraints);
108         cbSuspend.getAccessibleContext().setAccessibleDescription(bundle.getString("ASCD_CB_Actions_Panel_Suspend")); // NOI18N
109

110         jLabel2.setLabelFor(tfPrintText);
111         org.openide.awt.Mnemonics.setLocalizedText(jLabel2, bundle.getString("L_Actions_Panel_Print_Text")); // NOI18N
112
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
113         gridBagConstraints.gridx = 0;
114         gridBagConstraints.gridy = 1;
115         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
116         add(jLabel2, gridBagConstraints);
117
118     }// </editor-fold>//GEN-END:initComponents
119

120     private void tfPrintTextActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_tfPrintTextActionPerformed
121
{//GEN-HEADEREND:event_tfPrintTextActionPerformed
122
// TODO add your handling code here:
123
}//GEN-LAST:event_tfPrintTextActionPerformed
124

125     private void cbSuspendActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_cbSuspendActionPerformed
126
{//GEN-HEADEREND:event_cbSuspendActionPerformed
127
// TODO add your handling code here:
128
}//GEN-LAST:event_cbSuspendActionPerformed
129

130     /**
131      * Called when "Ok" button is pressed.
132      */

133     public void ok () {
134         String JavaDoc printText = tfPrintText.getText ();
135         if (printText.trim ().length () > 0)
136             breakpoint.setPrintText (printText.trim ());
137         else
138             breakpoint.setPrintText (null);
139         
140         switch (cbSuspend.getSelectedIndex ()) {
141             case 0:
142                 breakpoint.setSuspend (JPDABreakpoint.SUSPEND_NONE);
143                 break;
144             case 1:
145                 breakpoint.setSuspend (JPDABreakpoint.SUSPEND_EVENT_THREAD);
146                 break;
147             case 2:
148                 breakpoint.setSuspend (JPDABreakpoint.SUSPEND_ALL);
149                 break;
150         }
151     }
152     
153     
154     // Variables declaration - do not modify//GEN-BEGIN:variables
155
private javax.swing.JComboBox JavaDoc cbSuspend;
156     private javax.swing.JLabel JavaDoc jLabel1;
157     private javax.swing.JLabel JavaDoc jLabel2;
158     private javax.swing.JTextField JavaDoc tfPrintText;
159     // End of variables declaration//GEN-END:variables
160

161 }
162
Popular Tags