1 19 20 package org.netbeans.modules.debugger.jpda.ui.breakpoints; 21 22 import javax.swing.JPanel ; 23 import org.netbeans.api.debugger.DebuggerManager; 24 25 import org.netbeans.api.debugger.jpda.ThreadBreakpoint; 26 import org.netbeans.modules.debugger.jpda.ui.EditorContextBridge; 27 import org.netbeans.spi.debugger.ui.Controller; 28 import org.openide.util.NbBundle; 29 30 33 public class ThreadBreakpointPanel extends JPanel implements Controller, org.openide.util.HelpCtx.Provider { 38 40 private ActionsPanel actionsPanel; 41 private ThreadBreakpoint breakpoint; 42 private boolean createBreakpoint = false; 43 44 45 private static ThreadBreakpoint creteBreakpoint () { 46 ThreadBreakpoint mb = ThreadBreakpoint.create (); 47 mb.setPrintText ( 48 NbBundle.getBundle (ThreadBreakpointPanel.class).getString 49 ("CTL_Thread_Breakpoint_Print_Text") 50 ); 51 return mb; 52 } 53 54 55 56 public ThreadBreakpointPanel () { 57 this (creteBreakpoint ()); 58 createBreakpoint = true; 59 } 60 61 62 public ThreadBreakpointPanel (ThreadBreakpoint b) { 63 breakpoint = b; 64 initComponents (); 65 66 cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Start")); 67 cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Death")); 68 cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Start_or_Death")); 69 switch (b.getBreakpointType ()) { 70 case ThreadBreakpoint.TYPE_THREAD_STARTED: 71 cbBreakpointType.setSelectedIndex (0); 72 break; 73 case ThreadBreakpoint.TYPE_THREAD_DEATH: 74 cbBreakpointType.setSelectedIndex (1); 75 break; 76 case ThreadBreakpoint.TYPE_THREAD_STARTED_OR_DEATH: 77 cbBreakpointType.setSelectedIndex (2); 78 break; 79 } 80 81 actionsPanel = new ActionsPanel (b); 82 pActions.add (actionsPanel, "Center"); 83 putClientProperty("HelpID_AddBreakpointPanel", "debug.add.breakpoint.java.thread"); } 90 91 public org.openide.util.HelpCtx getHelpCtx() { 94 return new org.openide.util.HelpCtx("NetbeansDebuggerBreakpointThreadJPDA"); } 96 98 103 private void initComponents() { 105 java.awt.GridBagConstraints gridBagConstraints; 106 107 pSettings = new javax.swing.JPanel (); 108 jLabel4 = new javax.swing.JLabel (); 109 cbBreakpointType = new javax.swing.JComboBox (); 110 pActions = new javax.swing.JPanel (); 111 jPanel1 = new javax.swing.JPanel (); 112 113 setLayout(new java.awt.GridBagLayout ()); 114 115 pSettings.setLayout(new java.awt.GridBagLayout ()); 116 117 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle"); pSettings.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("L_Thread_Breakpoint_BorderTitle"))); jLabel4.setLabelFor(cbBreakpointType); 120 org.openide.awt.Mnemonics.setLocalizedText(jLabel4, bundle.getString("L_Thread_Breakpoint_Type")); gridBagConstraints = new java.awt.GridBagConstraints (); 122 gridBagConstraints.gridx = 0; 123 gridBagConstraints.gridy = 3; 124 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 125 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 126 gridBagConstraints.insets = new java.awt.Insets (3, 3, 3, 3); 127 pSettings.add(jLabel4, gridBagConstraints); 128 jLabel4.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_L_Thread_Breakpoint_Type")); 130 cbBreakpointType.setToolTipText(bundle.getString("TTT_CB_Thread_Breakpoint_Type")); gridBagConstraints = new java.awt.GridBagConstraints (); 132 gridBagConstraints.gridx = 1; 133 gridBagConstraints.gridy = 3; 134 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 135 gridBagConstraints.weightx = 1.0; 136 gridBagConstraints.insets = new java.awt.Insets (3, 3, 3, 3); 137 pSettings.add(cbBreakpointType, gridBagConstraints); 138 cbBreakpointType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CB_Thread_Breakpoint_Type")); 140 gridBagConstraints = new java.awt.GridBagConstraints (); 141 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 142 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 143 gridBagConstraints.weightx = 1.0; 144 add(pSettings, gridBagConstraints); 145 146 pActions.setLayout(new java.awt.BorderLayout ()); 147 148 gridBagConstraints = new java.awt.GridBagConstraints (); 149 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 150 gridBagConstraints.weightx = 1.0; 151 add(pActions, gridBagConstraints); 152 153 gridBagConstraints = new java.awt.GridBagConstraints (); 154 gridBagConstraints.gridx = 0; 155 gridBagConstraints.gridy = 2; 156 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 157 gridBagConstraints.weightx = 1.0; 158 gridBagConstraints.weighty = 1.0; 159 add(jPanel1, gridBagConstraints); 160 161 } 163 164 166 171 public boolean ok () { 172 actionsPanel.ok (); 173 switch (cbBreakpointType.getSelectedIndex ()) { 174 case 0: 175 breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_STARTED); 176 break; 177 case 1: 178 breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_DEATH); 179 break; 180 case 2: 181 breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_STARTED_OR_DEATH); 182 break; 183 } 184 185 if (createBreakpoint) 186 DebuggerManager.getDebuggerManager ().addBreakpoint (breakpoint); 187 return true; 188 } 189 190 195 public boolean cancel () { 196 return true; 197 } 198 199 206 public boolean isValid () { 207 return true; 208 } 209 210 211 private javax.swing.JComboBox cbBreakpointType; 213 private javax.swing.JLabel jLabel4; 214 private javax.swing.JPanel jPanel1; 215 private javax.swing.JPanel pActions; 216 private javax.swing.JPanel pSettings; 217 219 } 220 | Popular Tags |