001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2008 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: * If you wish your version of this file to be governed by only the CDDL
025: * or only the GPL Version 2, indicate your decision by adding
026: * "[Contributor] elects to include this software in this distribution
027: * under the [CDDL or GPL Version 2] license." If you do not indicate a
028: * single choice of license, a recipient has the option to distribute
029: * your version of this file under either the CDDL, the GPL Version 2 or
030: * to extend the choice of license to its licensees as provided above.
031: * However, if you add GPL Version 2 code and therefore, elected the GPL
032: * Version 2 license, then the option applies only if the new code is
033: * made subject to such option by the copyright holder.
034: *
035: * Contributor(s):
036: *
037: * Portions Copyrighted 2008 Sun Microsystems, Inc.
038: */
039:
040: package org.netbeans.modules.java.hints.errors;
041:
042: import java.util.prefs.Preferences;
043:
044: /**
045: *
046: * @author Jan Lahoda
047: */
048: public class SurroundWithTryCatchLog extends javax.swing.JPanel {
049:
050: private Preferences p;
051:
052: /** Creates new form SurroundWithTryCatchLog */
053: public SurroundWithTryCatchLog(Preferences p) {
054: initComponents();
055: this .p = p;
056: exceptions.setSelected(ErrorFixesFakeHint.isUseExceptions());
057: logger.setSelected(ErrorFixesFakeHint.isUseLogger());
058: }
059:
060: /** This method is called from within the constructor to
061: * initialize the form.
062: * WARNING: Do NOT modify this code. The content of this method is
063: * always regenerated by the Form Editor.
064: */
065: @SuppressWarnings("unchecked")
066: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
067: private void initComponents() {
068:
069: exceptions = new javax.swing.JCheckBox();
070: logger = new javax.swing.JCheckBox();
071: printStackTrace = new javax.swing.JCheckBox();
072: jLabel1 = new javax.swing.JLabel();
073:
074: exceptions.setSelected(true);
075: org.openide.awt.Mnemonics.setLocalizedText(exceptions,
076: org.openide.util.NbBundle.getBundle(
077: SurroundWithTryCatchLog.class).getString(
078: "SurroundWithTryCatchLog.exceptions.text")); // NOI18N
079: exceptions
080: .addActionListener(new java.awt.event.ActionListener() {
081: public void actionPerformed(
082: java.awt.event.ActionEvent evt) {
083: exceptionsActionPerformed(evt);
084: }
085: });
086:
087: logger.setSelected(true);
088: org.openide.awt.Mnemonics.setLocalizedText(logger,
089: org.openide.util.NbBundle.getBundle(
090: SurroundWithTryCatchLog.class).getString(
091: "SurroundWithTryCatchLog.logger.text")); // NOI18N
092: logger.addActionListener(new java.awt.event.ActionListener() {
093: public void actionPerformed(java.awt.event.ActionEvent evt) {
094: loggerActionPerformed(evt);
095: }
096: });
097:
098: printStackTrace.setSelected(true);
099: org.openide.awt.Mnemonics
100: .setLocalizedText(
101: printStackTrace,
102: org.openide.util.NbBundle
103: .getBundle(
104: SurroundWithTryCatchLog.class)
105: .getString(
106: "SurroundWithTryCatchLog.printStackTrace.text")); // NOI18N
107: printStackTrace.setEnabled(false);
108:
109: jLabel1.setText(org.openide.util.NbBundle.getBundle(
110: SurroundWithTryCatchLog.class).getString(
111: "SurroundWithTryCatchLog.jLabel1.text")); // NOI18N
112:
113: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
114: this );
115: this .setLayout(layout);
116: layout
117: .setHorizontalGroup(layout
118: .createParallelGroup(
119: org.jdesktop.layout.GroupLayout.LEADING)
120: .add(
121: layout
122: .createSequentialGroup()
123: .addContainerGap()
124: .add(
125: layout
126: .createParallelGroup(
127: org.jdesktop.layout.GroupLayout.LEADING)
128: .add(jLabel1)
129: .add(
130: layout
131: .createSequentialGroup()
132: .add(
133: 12,
134: 12,
135: 12)
136: .add(
137: layout
138: .createParallelGroup(
139: org.jdesktop.layout.GroupLayout.LEADING)
140: .add(
141: logger)
142: .add(
143: exceptions)
144: .add(
145: printStackTrace))))
146: .addContainerGap(57,
147: Short.MAX_VALUE)));
148: layout.setVerticalGroup(layout.createParallelGroup(
149: org.jdesktop.layout.GroupLayout.LEADING).add(
150: layout.createSequentialGroup().addContainerGap().add(
151: jLabel1).addPreferredGap(
152: org.jdesktop.layout.LayoutStyle.UNRELATED).add(
153: exceptions).addPreferredGap(
154: org.jdesktop.layout.LayoutStyle.UNRELATED).add(
155: logger).addPreferredGap(
156: org.jdesktop.layout.LayoutStyle.UNRELATED).add(
157: printStackTrace).addContainerGap(188,
158: Short.MAX_VALUE)));
159: }// </editor-fold>//GEN-END:initComponents
160:
161: private void loggerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loggerActionPerformed
162: ErrorFixesFakeHint.setUseLogger(p, logger.isSelected());
163: }//GEN-LAST:event_loggerActionPerformed
164:
165: private void exceptionsActionPerformed(
166: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exceptionsActionPerformed
167: ErrorFixesFakeHint.setUseExceptions(p, exceptions.isSelected());
168: }//GEN-LAST:event_exceptionsActionPerformed
169:
170: // Variables declaration - do not modify//GEN-BEGIN:variables
171: private javax.swing.JCheckBox exceptions;
172: private javax.swing.JLabel jLabel1;
173: private javax.swing.JCheckBox logger;
174: private javax.swing.JCheckBox printStackTrace;
175: // End of variables declaration//GEN-END:variables
176:
177: }
|