|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.debugger.jpda.ui.breakpoints; import javax.swing.JPanel; import org.netbeans.api.debugger.DebuggerManager; import org.netbeans.api.debugger.jpda.LineBreakpoint; import org.netbeans.modules.debugger.jpda.ui.EditorContextBridge; import org.netbeans.spi.debugger.ui.Controller; import java.net.URI; import org.openide.util.NbBundle; /** * Panel for customizing line breakpoints. * * @author Maros Sandor */ public class LineBreakpointPanel extends JPanel implements Controller { private ActionsPanel actionsPanel; private LineBreakpoint breakpoint; private boolean createBreakpoint = false; private static LineBreakpoint creteBreakpoint () { LineBreakpoint mb = LineBreakpoint.create ( EditorContextBridge.getCurrentURL (), EditorContextBridge.getCurrentLineNumber () ); mb.setPrintText ( NbBundle.getBundle (LineBreakpointPanel.class).getString ("CTL_Line_Breakpoint_Print_Text") ); return mb; } /** Creates new form LineBreakpointPanel */ public LineBreakpointPanel () { this (creteBreakpoint ()); createBreakpoint = true; } /** Creates new form LineBreakpointPanel */ public LineBreakpointPanel (LineBreakpoint b) { breakpoint = b; initComponents (); String url = b.getURL(); try { URI uri = new URI(url); tfFileName.setText(uri.getPath()); } catch (Exception e) { tfFileName.setText(url); } tfLineNumber.setText(Integer.toString(b.getLineNumber())); 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(); jLabel3 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); tfCondition = new javax.swing.JTextField(); tfFileName = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); tfLineNumber = new javax.swing.JTextField(); 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_Line_Breakpoint_BorderTitle"))); jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Line_Breakpoint_File_Name").charAt(0)); jLabel3.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Line_Breakpoint_File_Name")); jLabel3.setLabelFor(tfFileName); 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_Line_Breakpoint_File_Name")); jLabel5.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Line_Breakpoint_Condition").charAt(0)); jLabel5.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Line_Breakpoint_Condition")); jLabel5.setLabelFor(tfCondition); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; 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_Line_Breakpoint_Condition")); tfCondition.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Line_Breakpoint_Condition")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(tfCondition, gridBagConstraints); tfCondition.getAccessibleContext().setAccessibleName("Condition"); tfCondition.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Line_Breakpoint_Condition")); tfFileName.setEditable(false); tfFileName.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Line_Breakpoint_File_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(tfFileName, gridBagConstraints); tfFileName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Line_Breakpoint_File_Name")); jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("MN_L_Line_Breakpoint_Line_Number").charAt(0)); jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("L_Line_Breakpoint_Line_Number")); jLabel1.setLabelFor(tfLineNumber); 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(jLabel1, gridBagConstraints); jLabel1.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_L_Line_Breakpoint_Line_Number")); tfLineNumber.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("TTT_TF_Line_Breakpoint_Line_Number")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(tfLineNumber, gridBagConstraints); tfLineNumber.getAccessibleContext().setAccessibleName("Line number"); tfLineNumber.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("ACSD_TF_Line_Breakpoint_Line_Number")); 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 () { if (!isValid()) return false; actionsPanel.ok (); breakpoint.setLineNumber(Integer.parseInt(tfLineNumber.getText().trim())); 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.