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.apisupport.project.ui.customizer;
043:
044: import java.beans.PropertyChangeEvent;
045: import org.netbeans.modules.apisupport.project.universe.NbPlatform;
046: import org.netbeans.spi.project.ui.support.ProjectCustomizer;
047: import org.openide.util.NbBundle;
048:
049: /**
050: * Represents <em>Compiling</em> panel in Netbeans Module customizer.
051: *
052: * @author Martin Krauskopf
053: */
054: final class CustomizerCompiling extends NbPropertyPanel.Single {
055:
056: CustomizerCompiling(final SingleModuleProperties props,
057: ProjectCustomizer.Category category) {
058: super (props, CustomizerCompiling.class, category);
059: initComponents();
060: initAccessibility();
061: refresh();
062: }
063:
064: void refresh() {
065: debug
066: .setSelected(getBooleanProperty(SingleModuleProperties.BUILD_COMPILER_DEBUG));
067: deprecation
068: .setSelected(getBooleanProperty(SingleModuleProperties.BUILD_COMPILER_DEPRECATION));
069: options
070: .setText(getProperty(SingleModuleProperties.JAVAC_COMPILERARGS));
071: NbPlatform platform = getProperties().getActivePlatform();
072: options
073: .setEnabled(platform == null
074: || platform.getHarnessVersion() >= NbPlatform.HARNESS_VERSION_50u1); // #71631
075: }
076:
077: @Override
078: public void propertyChange(PropertyChangeEvent evt) {
079: super .propertyChange(evt);
080: if (SingleModuleProperties.JAVAC_COMPILERARGS.equals(evt
081: .getPropertyName())) {
082: options
083: .setText(getProperty(SingleModuleProperties.JAVAC_COMPILERARGS));
084: }
085: if (SingleModuleProperties.NB_PLATFORM_PROPERTY.equals(evt
086: .getPropertyName())) {
087: NbPlatform platform = getProperties().getActivePlatform();
088: options
089: .setEnabled(platform == null
090: || platform.getHarnessVersion() >= NbPlatform.HARNESS_VERSION_50u1);
091: }
092: }
093:
094: @Override
095: public void store() {
096: setBooleanProperty(SingleModuleProperties.BUILD_COMPILER_DEBUG,
097: debug.isSelected());
098: setBooleanProperty(
099: SingleModuleProperties.BUILD_COMPILER_DEPRECATION,
100: deprecation.isSelected());
101: setProperty(SingleModuleProperties.JAVAC_COMPILERARGS, options
102: .getText());
103: }
104:
105: /** This method is called from within the constructor to
106: * initialize the form.
107: * WARNING: Do NOT modify this code. The content of this method is
108: * always regenerated by the Form Editor.
109: */
110: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
111: private void initComponents() {
112:
113: deprecation = new javax.swing.JCheckBox();
114: debug = new javax.swing.JCheckBox();
115: optionsLabel = new javax.swing.JLabel();
116: options = new javax.swing.JTextField();
117:
118: org.openide.awt.Mnemonics.setLocalizedText(deprecation,
119: org.openide.util.NbBundle.getMessage(
120: CustomizerCompiling.class,
121: "CTL_ReportDeprecation")); // NOI18N
122:
123: org.openide.awt.Mnemonics.setLocalizedText(debug,
124: org.openide.util.NbBundle.getMessage(
125: CustomizerCompiling.class,
126: "CTL_GenerateDebugInfo")); // NOI18N
127:
128: optionsLabel.setLabelFor(options);
129: org.openide.awt.Mnemonics.setLocalizedText(optionsLabel,
130: NbBundle.getMessage(CustomizerCompiling.class,
131: "LBL_additional_compiler_options")); // NOI18N
132:
133: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
134: this );
135: this .setLayout(layout);
136: layout
137: .setHorizontalGroup(layout
138: .createParallelGroup(
139: org.jdesktop.layout.GroupLayout.LEADING)
140: .add(
141: layout
142: .createSequentialGroup()
143: .add(
144: layout
145: .createParallelGroup(
146: org.jdesktop.layout.GroupLayout.LEADING)
147: .add(debug)
148: .add(
149: deprecation)
150: .add(
151: layout
152: .createSequentialGroup()
153: .add(
154: optionsLabel)
155: .addPreferredGap(
156: org.jdesktop.layout.LayoutStyle.RELATED)
157: .add(
158: options,
159: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
160: 193,
161: Short.MAX_VALUE)))
162: .addContainerGap()));
163: layout
164: .setVerticalGroup(layout
165: .createParallelGroup(
166: org.jdesktop.layout.GroupLayout.LEADING)
167: .add(
168: layout
169: .createSequentialGroup()
170: .add(debug)
171: .addPreferredGap(
172: org.jdesktop.layout.LayoutStyle.RELATED)
173: .add(deprecation)
174: .addPreferredGap(
175: org.jdesktop.layout.LayoutStyle.RELATED)
176: .add(
177: layout
178: .createParallelGroup(
179: org.jdesktop.layout.GroupLayout.BASELINE)
180: .add(
181: optionsLabel)
182: .add(
183: options,
184: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
185: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
186: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
187: .addContainerGap(233,
188: Short.MAX_VALUE)));
189:
190: options.getAccessibleContext().setAccessibleName(
191: org.openide.util.NbBundle.getMessage(
192: CustomizerCompiling.class,
193: "ACS_AdditionalCompilerOptions")); // NOI18N
194: options.getAccessibleContext().setAccessibleDescription(
195: org.openide.util.NbBundle.getMessage(
196: CustomizerCompiling.class,
197: "ACSD_AdditionalCompilerOptions")); // NOI18N
198: }// </editor-fold>//GEN-END:initComponents
199:
200: // Variables declaration - do not modify//GEN-BEGIN:variables
201: private javax.swing.JCheckBox debug;
202: private javax.swing.JCheckBox deprecation;
203: private javax.swing.JTextField options;
204: private javax.swing.JLabel optionsLabel;
205:
206: // End of variables declaration//GEN-END:variables
207:
208: private static String getMessage(String key) {
209: return NbBundle.getMessage(CustomizerCompiling.class, key);
210: }
211:
212: private void initAccessibility() {
213: debug.getAccessibleContext().setAccessibleDescription(
214: getMessage("ACSD_Debug"));
215: deprecation.getAccessibleContext().setAccessibleDescription(
216: getMessage("ACSD_Deprecation"));
217: }
218:
219: }
|