/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Contributor(s): * * The Original Software is NetBeans. The Initial Developer of the Original * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun * Microsystems, Inc. All Rights Reserved. * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. */ package org.netbeans.modules.scala.debugger.breakpoints; import java.awt.Dimension; import javax.swing.JPanel; import org.netbeans.api.debugger.DebuggerManager; import org.netbeans.api.debugger.Breakpoint.HIT_COUNT_FILTERING_STYLE; import org.netbeans.api.debugger.jpda.ThreadBreakpoint; import org.netbeans.spi.debugger.ui.Controller; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; /** * @author Jan Jancura */ // <RAVE> CR 6207738 - fix debugger help IDs // Implement HelpCtx.Provider interface to provide help ids for help system // public class ThreadBreakpointPanel extends JPanel implements Controller { // ==== public class ThreadBreakpointPanel extends JPanel implements Controller, org.openide.util.HelpCtx.Provider { // </RAVE> private ConditionsPanel conditionsPanel; private ActionsPanel actionsPanel; private ThreadBreakpoint breakpoint; private boolean createBreakpoint = false; private static ThreadBreakpoint creteBreakpoint () { ThreadBreakpoint mb = ThreadBreakpoint.create (); mb.setPrintText ( NbBundle.getBundle (ThreadBreakpointPanel.class).getString ("CTL_Thread_Breakpoint_Print_Text") ); return mb; } /** Creates new form LineBreakpointPanel */ public ThreadBreakpointPanel () { this (creteBreakpoint ()); createBreakpoint = true; } /** Creates new form LineBreakpointPanel */ public ThreadBreakpointPanel (ThreadBreakpoint b) { breakpoint = b; initComponents (); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Start")); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Death")); cbBreakpointType.addItem (java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle").getString("LBL_Thread_Breakpoint_Type_Start_or_Death")); switch (b.getBreakpointType ()) { case ThreadBreakpoint.TYPE_THREAD_STARTED: cbBreakpointType.setSelectedIndex (0); break; case ThreadBreakpoint.TYPE_THREAD_DEATH: cbBreakpointType.setSelectedIndex (1); break; case ThreadBreakpoint.TYPE_THREAD_STARTED_OR_DEATH: cbBreakpointType.setSelectedIndex (2); break; } conditionsPanel = new ConditionsPanel(); conditionsPanel.showClassFilter(false); conditionsPanel.showCondition(false); conditionsPanel.setHitCountFilteringStyle(b.getHitCountFilteringStyle()); conditionsPanel.setHitCount(b.getHitCountFilter()); cPanel.add(conditionsPanel, "Center"); actionsPanel = new ActionsPanel (b); pActions.add (actionsPanel, "Center"); // <RAVE> // The help IDs for the AddBreakpointPanel panels have to be different from the // values returned by getHelpCtx() because they provide different help // in the 'Add Breakpoint' dialog and when invoked in the 'Breakpoints' view putClientProperty("HelpID_AddBreakpointPanel", "debug.add.breakpoint.java.thread"); // NOI18N // </RAVE> } // <RAVE> // Implement getHelpCtx() with the correct helpID public org.openide.util.HelpCtx getHelpCtx() { return new org.openide.util.HelpCtx("NetbeansDebuggerBreakpointThreadJPDA"); // NOI18N } // </RAVE> /** 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. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; pSettings = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); cbBreakpointType = new javax.swing.JComboBox(); cPanel = new javax.swing.JPanel(); pActions = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/debugger/jpda/ui/breakpoints/Bundle"); // NOI18N pSettings.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("L_Thread_Breakpoint_BorderTitle"))); // NOI18N pSettings.setLayout(new java.awt.GridBagLayout()); jLabel4.setLabelFor(cbBreakpointType); org.openide.awt.Mnemonics.setLocalizedText(jLabel4, bundle.getString("L_Thread_Breakpoint_Type")); // NOI18N 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(bundle.getString("ACSD_L_Thread_Breakpoint_Type")); // NOI18N cbBreakpointType.setToolTipText(bundle.getString("TTT_CB_Thread_Breakpoint_Type")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); pSettings.add(cbBreakpointType, gridBagConstraints); cbBreakpointType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CB_Thread_Breakpoint_Type")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(pSettings, gridBagConstraints); cPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(cPanel, gridBagConstraints); pActions.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(pActions, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(jPanel1, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents // Controller implementation ............................................... /** * Called when "Ok" button is pressed. * * @return whether customizer can be closed */ public boolean ok () { String msg = valiadateMsg(); if (msg == null) { msg = conditionsPanel.valiadateMsg(); } if (msg != null) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg)); return false; } actionsPanel.ok (); switch (cbBreakpointType.getSelectedIndex ()) { case 0: breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_STARTED); break; case 1: breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_DEATH); break; case 2: breakpoint.setBreakpointType (ThreadBreakpoint.TYPE_THREAD_STARTED_OR_DEATH); break; } breakpoint.setHitCountFilter(conditionsPanel.getHitCount(), conditionsPanel.getHitCountFilteringStyle()); 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 <code>true</code> whether value of this customizer * is valid (and OK button can be enabled). * * @return <code>true</code> whether value of this customizer * is valid */ public boolean isValid () { return true; } private String valiadateMsg () { return null; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel cPanel; private javax.swing.JComboBox cbBreakpointType; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel pActions; private javax.swing.JPanel pSettings; // End of variables declaration//GEN-END:variables }