|
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.FieldBreakpoint; 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 FieldBreakpointPanel extends JPanel implements Controller { private ActionsPanel actionsPanel; private FieldBreakpoint breakpoint; private boolean createBreakpoint = false; private static FieldBreakpoint creteBreakpoint () { FieldBreakpoint mb = FieldBreakpoint.create ( EditorContextBridge.getCurrentClassName (), EditorContextBridge.getCurrentFieldName (), FieldBreakpoint.TYPE_ACCESS ); mb.setPrintText ( NbBundle.getBundle (FieldBreakpointPanel.class).getString ("CTL_Field_Breakpoint_Print_Text") ); return mb; } /** Creates new form LineBreakpointPanel */ public FieldBreakpointPanel () { this (creteBreakpoint ()); createBreakpoint = true; } /** Creates new form LineBreakpointPanel */ public FieldBreakpointPanel (FieldBreakpoint b) { breakpoint = b; initComponents (); String className = b.getClassName (); int i = className.lastIndexOf ('.'); if (i < 0) { tfPackageName.setText (""); tfClassName.setText (className); } else { tfPackageName.setText (className.substring (0, i)); tfClassName.setText (className.substring (i + 1, className.length ())); } tfFieldName.setText (b.getFieldName()); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Field_Breakpoint_Type_Access")); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Field_Breakpoint_Type_Modification")); switch (b.getBreakpointType ()) { case FieldBreakpoint.TYPE_ACCESS: cbBreakpointType.setSelectedIndex (0); break; case FieldBreakpoint.TYPE_MODIFICATION: cbBreakpointType.setSelectedIndex (1); 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(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); tfCondition = new javax.swing.JTextField(); tfPackageName = new javax.swing.JTextField(); tfClassName = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); tfFieldName = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); cbBreakpointType = 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_Field_Breakpoint_BorderTitle"))); jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Field_Breakpoint_Package_Name").charAt(0)); jLabel2.setLabelFor(tfPackageName); jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Field_Breakpoint_Package_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; 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_Field_Breakpoint_Package_Name")); jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Field_Breakpoint_Class_Name").charAt(0)); jLabel3.setLabelFor(tfClassName); jLabel3.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Field_Breakpoint_Class_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(jLabel3, gridBagConstraints); jLabel3.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Field_Breakpoint_Class_Name")); jLabel5.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Field_Breakpoint_Condition").charAt(0)); jLabel5.setLabelFor(tfCondition); jLabel5.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Field_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_Field_Breakpoint_Condition")); tfCondition.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Field_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_Field_Breakpoint_Condition")); tfPackageName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Field_Breakpoint_Package_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(tfPackageName, gridBagConstraints); tfPackageName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Field_Breakpoint_Package_Name")); tfClassName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Field_Breakpoint_Class_Name")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(tfClassName, gridBagConstraints); tfClassName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Field_Breakpoint_Class_Name")); jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Field_Breakpoint_Field_Name").charAt(0)); jLabel1.setLabelFor(tfFieldName); jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Field_Breakpoint_Field_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(jLabel1, gridBagConstraints); jLabel1.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Field_Breakpoint_Field_Name")); tfFieldName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Field_Breakpoint_Field_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(tfFieldName, gridBagConstraints); tfFieldName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Field_Breakpoint_Field_Name")); jLabel4.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Field_Breakpoint_Type").charAt(0)); jLabel4.setLabelFor(cbBreakpointType); jLabel4.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Field_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("ACSD_L_Field_Breakpoint_Type")); cbBreakpointType.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_CB_Field_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_Field_Breakpoint_Type")); 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) tfPackageName.getText ()).trim (); if (className.length () > 0) className += '.'; className += tfClassName.getText ().trim (); breakpoint.setClassName (className); breakpoint.setFieldName (tfFieldName.getText ().trim ()); switch (cbBreakpointType.getSelectedIndex ()) { case 0: breakpoint.setBreakpointType (FieldBreakpoint.TYPE_ACCESS); break; case 1: breakpoint.setBreakpointType (FieldBreakpoint.TYPE_MODIFICATION); 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.