001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.web.debug.breakpoints;
043:
044: import org.openide.util.NbBundle;
045:
046: /**
047: * @author Martin Grebac
048: */
049: public class ActionsPanel extends javax.swing.JPanel {
050:
051: private JspLineBreakpoint breakpoint;
052:
053: /** Creates new form LineBreakpointPanel */
054: public ActionsPanel(JspLineBreakpoint b) {
055: breakpoint = b;
056: initComponents();
057:
058: cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class,
059: "LBL_CB_Actions_Panel_Suspend_None"));
060: cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class,
061: "LBL_CB_Actions_Panel_Suspend_Current"));
062: cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class,
063: "LBL_CB_Actions_Panel_Suspend_All"));
064: switch (b.getSuspend()) {
065: case JspLineBreakpoint.SUSPEND_NONE:
066: cbSuspend.setSelectedIndex(0);
067: break;
068: case JspLineBreakpoint.SUSPEND_EVENT_THREAD:
069: cbSuspend.setSelectedIndex(1);
070: break;
071: case JspLineBreakpoint.SUSPEND_ALL:
072: cbSuspend.setSelectedIndex(2);
073: break;
074: }
075: if (b.getPrintText() != null)
076: tfPrintText.setText(b.getPrintText());
077: }
078:
079: private void initComponents() {
080: java.awt.GridBagConstraints gridBagConstraints;
081:
082: tfPrintText = new javax.swing.JTextField();
083: jLabel1 = new javax.swing.JLabel();
084: cbSuspend = new javax.swing.JComboBox();
085: jLabel2 = new javax.swing.JLabel();
086:
087: setLayout(new java.awt.GridBagLayout());
088:
089: setBorder(new javax.swing.border.TitledBorder(NbBundle
090: .getMessage(ActionsPanel.class, "LBL_Actions")));
091: tfPrintText.setToolTipText(NbBundle.getMessage(
092: ActionsPanel.class, "TTT_TF_Actions_Panel_Print_Text"));
093: tfPrintText
094: .addActionListener(new java.awt.event.ActionListener() {
095: public void actionPerformed(
096: java.awt.event.ActionEvent evt) {
097: //TODO
098: }
099: });
100:
101: gridBagConstraints = new java.awt.GridBagConstraints();
102: gridBagConstraints.gridx = 1;
103: gridBagConstraints.gridy = 1;
104: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
105: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
106: gridBagConstraints.weightx = 1.0;
107: add(tfPrintText, gridBagConstraints);
108: tfPrintText.getAccessibleContext().setAccessibleDescription(
109: NbBundle.getMessage(ActionsPanel.class,
110: "ACSD_TF_Actions_Panel_Print_Text"));
111:
112: jLabel1.setDisplayedMnemonic(NbBundle.getMessage(
113: ActionsPanel.class, "MN_L_Actions_Panel_Suspend")
114: .charAt(0));
115: jLabel1.setLabelFor(cbSuspend);
116: jLabel1.setText(NbBundle.getMessage(ActionsPanel.class,
117: "L_Actions_Panel_Suspend"));
118: gridBagConstraints = new java.awt.GridBagConstraints();
119: gridBagConstraints.gridx = 0;
120: gridBagConstraints.gridy = 0;
121: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
122: add(jLabel1, gridBagConstraints);
123: jLabel1.getAccessibleContext().setAccessibleDescription(
124: NbBundle.getMessage(ActionsPanel.class,
125: "ASCD_L_Actions_Panel_Suspend"));
126:
127: cbSuspend.setToolTipText(NbBundle.getMessage(
128: ActionsPanel.class, "TTT_CB_Actions_Panel_Suspend"));
129: cbSuspend
130: .addActionListener(new java.awt.event.ActionListener() {
131: public void actionPerformed(
132: java.awt.event.ActionEvent evt) {
133: //TODO
134: }
135: });
136:
137: gridBagConstraints = new java.awt.GridBagConstraints();
138: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
139: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
140: add(cbSuspend, gridBagConstraints);
141: cbSuspend.getAccessibleContext().setAccessibleDescription(
142: NbBundle.getMessage(ActionsPanel.class,
143: "ASCD_CB_Actions_Panel_Suspend"));
144:
145: jLabel2.setDisplayedMnemonic(NbBundle.getMessage(
146: ActionsPanel.class, "MN_L_Actions_Panel_Print_Text")
147: .charAt(0));
148: jLabel2.setLabelFor(tfPrintText);
149: jLabel2.setText(NbBundle.getMessage(ActionsPanel.class,
150: "L_Actions_Panel_Print_Text"));
151: gridBagConstraints = new java.awt.GridBagConstraints();
152: gridBagConstraints.gridx = 0;
153: gridBagConstraints.gridy = 1;
154: gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
155: add(jLabel2, gridBagConstraints);
156:
157: }
158:
159: /**
160: * Called when "Ok" button is pressed.
161: *
162: * @return whether customizer can be closed
163: */
164: public void ok() {
165: String printText = tfPrintText.getText();
166: if (printText.trim().length() > 0) {
167: breakpoint.setPrintText(printText.trim());
168: } else {
169: breakpoint.setPrintText(null);
170: }
171:
172: switch (cbSuspend.getSelectedIndex()) {
173: case 0:
174: breakpoint.setSuspend(JspLineBreakpoint.SUSPEND_NONE);
175: break;
176: case 1:
177: breakpoint
178: .setSuspend(JspLineBreakpoint.SUSPEND_EVENT_THREAD);
179: break;
180: case 2:
181: breakpoint.setSuspend(JspLineBreakpoint.SUSPEND_ALL);
182: break;
183: }
184: }
185:
186: // Variables declaration - do not modify
187: private javax.swing.JComboBox cbSuspend;
188: private javax.swing.JLabel jLabel1;
189: private javax.swing.JLabel jLabel2;
190: private javax.swing.JTextField tfPrintText;
191: // End of variables declaration
192:
193: }
|