|
What this is
Other links
The source code/* * LineBreakpointPanel.java * * Created on 24. bøezen 2004, 16:18 */ package org.netbeans.modules.debugger.jpda.ui.breakpoints; import javax.swing.JPanel; import org.netbeans.api.debugger.DebuggerManager; import org.netbeans.api.debugger.jpda.ExceptionBreakpoint; import org.netbeans.modules.debugger.jpda.ui.EditorContextBridge; import org.netbeans.spi.debugger.ui.Controller; import org.openide.util.NbBundle; /** * * @author Jan Jancura */ public class ExceptionBreakpointPanel extends JPanel implements Controller { private ActionsPanel actionsPanel; private ExceptionBreakpoint breakpoint; private boolean createBreakpoint = false; private static ExceptionBreakpoint creteBreakpoint () { ExceptionBreakpoint mb = ExceptionBreakpoint.create ( EditorContextBridge.getCurrentClassName (), ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED_UNCATCHED ); mb.setPrintText ( NbBundle.getBundle (ExceptionBreakpointPanel.class).getString ("CTL_Exception_Breakpoint_Print_Text") ); return mb; } /** Creates new form LineBreakpointPanel */ public ExceptionBreakpointPanel () { this (creteBreakpoint ()); createBreakpoint = true; } /** Creates new form LineBreakpointPanel */ public ExceptionBreakpointPanel (ExceptionBreakpoint b) { breakpoint = b; initComponents (); String className = b.getExceptionClassName (); int i = className.lastIndexOf ('.'); if (i < 0) { cbPackageName.setSelectedItem (""); cbExceptionClassName.setSelectedItem (className); } else { cbPackageName.setSelectedItem (className.substring (0, i)); cbExceptionClassName.setSelectedItem (className.substring (i + 1, className.length ())); } cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Exception_Breakpoint_Type_Catched")); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Exception_Breakpoint_Type_Uncatched")); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Exception_Breakpoint_Type_Catched_or_Uncatched")); switch (b.getCatchType ()) { case ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED: cbBreakpointType.setSelectedIndex (0); break; case ExceptionBreakpoint.TYPE_EXCEPTION_UNCATCHED: cbBreakpointType.setSelectedIndex (1); break; case ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED_UNCATCHED: cbBreakpointType.setSelectedIndex (2); break; } tfCondition.setText (b.getCondition ()); actionsPanel = new ActionsPanel (b); pActions.add (actionsPanel, "Center"); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; pSettings = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); cbBreakpointType = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); tfCondition = new javax.swing.JTextField(); cbPackageName = new javax.swing.JComboBox(); cbExceptionClassName = new javax.swing.JComboBox(); pActions = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); pSettings.setLayout(new java.awt.GridBagLayout()); pSettings.setBorder(new javax.swing.border.TitledBorder(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_BorderTitle"))); jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_filter_hint")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(jLabel1, gridBagConstraints); jLabel1.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Exception_Breakpoint_filter_hint")); jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Exception_Breakpoint_Package_Name").charAt(0)); jLabel2.setLabelFor(cbPackageName); jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_Package_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(jLabel2, gridBagConstraints); jLabel2.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Exception_Breakpoint_Package_Name")); jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Exception_Breakpoint_Class_Name").charAt(0)); jLabel3.setLabelFor(cbExceptionClassName); jLabel3.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_Class_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(jLabel3, gridBagConstraints); jLabel3.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Exception_Breakpoint_Class_Name")); jLabel4.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Exception_Breakpoint_Type").charAt(0)); jLabel4.setLabelFor(cbBreakpointType); jLabel4.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_Type")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(jLabel4, gridBagConstraints); jLabel4.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ASCD_L_Exception_Breakpoint_Type")); cbBreakpointType.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_CB_Exception_Breakpoint_Type")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(cbBreakpointType, gridBagConstraints); cbBreakpointType.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_CB_Exception_Breakpoint_Type")); jLabel5.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Exception_Breakpoint_Condition").charAt(0)); jLabel5.setLabelFor(tfCondition); jLabel5.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Exception_Breakpoint_Condition")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(jLabel5, gridBagConstraints); jLabel5.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Exception_Breakpoint_Condition")); tfCondition.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Exception_Breakpoint_Condition")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(tfCondition, gridBagConstraints); tfCondition.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Exception_Breakpoint_Condition")); cbPackageName.setEditable(true); cbPackageName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_CB_Exception_Breakpoint_Package_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(cbPackageName, gridBagConstraints); cbPackageName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_CB_Exception_Breakpoint_Package_Name")); cbExceptionClassName.setEditable(true); cbExceptionClassName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_CB_Exception_Breakpoint_Class_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(cbExceptionClassName, gridBagConstraints); cbExceptionClassName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_CB_Exception_Breakpoint_Class_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(pSettings, gridBagConstraints); pActions.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(pActions, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(jPanel1, gridBagConstraints); }//GEN-END:initComponents // Controller implementation ............................................... /** * Called when "Ok" button is pressed. * * @return whether customizer can be closed */ public boolean ok () { actionsPanel.ok (); String className = ((String) cbPackageName.getSelectedItem ()).trim (); if (className.length () > 0) className += '.'; className += ((String) cbExceptionClassName.getSelectedItem ()).trim (); breakpoint.setExceptionClassName (className); switch (cbBreakpointType.getSelectedIndex ()) { case 0: breakpoint.setCatchType (ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED); break; case 1: breakpoint.setCatchType (ExceptionBreakpoint.TYPE_EXCEPTION_UNCATCHED); break; case 2: breakpoint.setCatchType (ExceptionBreakpoint.TYPE_EXCEPTION_CATCHED_UNCATCHED); break; } breakpoint.setCondition (tfCondition.getText ()); if (createBreakpoint) DebuggerManager.getDebuggerManager ().addBreakpoint (breakpoint); return true; } /** * Called when "Cancel" button is pressed. * * @return whether customizer can be closed */ public boolean cancel () { return true; } /** * Return |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.