This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 42638
Collapse All | Expand All

(-)src/org/netbeans/modules/java/j2seproject/J2SEProject.java (+2 lines)
Lines 49-54 Link Here
49
import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
49
import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
50
import org.netbeans.modules.java.j2seproject.wsclient.J2SEProjectWebServicesClientSupport;
50
import org.netbeans.modules.java.j2seproject.wsclient.J2SEProjectWebServicesClientSupport;
51
import org.netbeans.modules.java.j2seproject.jaxws.J2SEProjectJAXWSClientSupport;
51
import org.netbeans.modules.java.j2seproject.jaxws.J2SEProjectJAXWSClientSupport;
52
import org.netbeans.modules.java.j2seproject.queries.J2SEProjectEncodingQueryImpl;
52
import org.netbeans.modules.java.j2seproject.queries.BinaryForSourceQueryImpl;
53
import org.netbeans.modules.java.j2seproject.queries.BinaryForSourceQueryImpl;
53
import org.netbeans.modules.java.j2seproject.wsclient.J2SEProjectWebServicesSupportProvider;
54
import org.netbeans.modules.java.j2seproject.wsclient.J2SEProjectWebServicesSupportProvider;
54
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
55
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
Lines 255-260 Link Here
255
            UILookupMergerSupport.createPrivilegedTemplatesMerger(),
256
            UILookupMergerSupport.createPrivilegedTemplatesMerger(),
256
            UILookupMergerSupport.createRecommendedTemplatesMerger(),
257
            UILookupMergerSupport.createRecommendedTemplatesMerger(),
257
            LookupProviderSupport.createSourcesMerger(),
258
            LookupProviderSupport.createSourcesMerger(),
259
            new J2SEProjectEncodingQueryImpl (evaluator()),
258
            new J2SEPropertyEvaluatorImpl(evaluator()),
260
            new J2SEPropertyEvaluatorImpl(evaluator()),
259
            new BinaryForSourceQueryImpl(this.sourceRoots, this.testRoots, this.helper, this.eval) //Does not use APH to get/put properties/cfgdata
261
            new BinaryForSourceQueryImpl(this.sourceRoots, this.testRoots, this.helper, this.eval) //Does not use APH to get/put properties/cfgdata
260
        });
262
        });
(-)src/org/netbeans/modules/java/j2seproject/J2SEProjectGenerator.java (-3 / +4 lines)
Lines 21-32 Link Here
21
21
22
import java.io.File;
22
import java.io.File;
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.util.Stack;
24
import java.nio.charset.Charset;
25
import org.netbeans.api.java.platform.JavaPlatform;
25
import org.netbeans.api.java.platform.JavaPlatform;
26
import org.netbeans.api.java.platform.JavaPlatformManager;
26
import org.netbeans.api.java.platform.JavaPlatformManager;
27
import org.netbeans.api.project.Project;
27
import org.netbeans.api.project.Project;
28
import org.netbeans.api.project.ProjectManager;
28
import org.netbeans.api.project.ProjectManager;
29
import org.netbeans.api.java.project.JavaProjectConstants;
29
import org.netbeans.api.java.project.JavaProjectConstants;
30
import org.netbeans.api.queries.FileEncodingQuery;
30
import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
31
import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
31
import org.netbeans.spi.project.support.ant.AntProjectHelper;
32
import org.netbeans.spi.project.support.ant.AntProjectHelper;
32
import org.netbeans.spi.project.support.ant.EditableProperties;
33
import org.netbeans.spi.project.support.ant.EditableProperties;
Lines 37-43 Link Here
37
import org.openide.filesystems.FileSystem;
38
import org.openide.filesystems.FileSystem;
38
import org.openide.filesystems.FileUtil;
39
import org.openide.filesystems.FileUtil;
39
import org.openide.filesystems.Repository;
40
import org.openide.filesystems.Repository;
40
import org.openide.filesystems.FileStateInvalidException;
41
import org.openide.loaders.DataFolder;
41
import org.openide.loaders.DataFolder;
42
import org.openide.loaders.DataObject;
42
import org.openide.loaders.DataObject;
43
import org.openide.modules.SpecificationVersion;
43
import org.openide.modules.SpecificationVersion;
Lines 270-276 Link Here
270
        ep.setProperty(J2SEProjectProperties.JAVADOC_WINDOW_TITLE, ""); // NOI18N
270
        ep.setProperty(J2SEProjectProperties.JAVADOC_WINDOW_TITLE, ""); // NOI18N
271
        ep.setProperty(J2SEProjectProperties.JAVADOC_ENCODING, ""); // NOI18N
271
        ep.setProperty(J2SEProjectProperties.JAVADOC_ENCODING, ""); // NOI18N
272
        ep.setProperty(J2SEProjectProperties.JAVADOC_ADDITIONALPARAM, ""); // NOI18N
272
        ep.setProperty(J2SEProjectProperties.JAVADOC_ADDITIONALPARAM, ""); // NOI18N
273
        
273
        Charset enc = FileEncodingQuery.getDefaultEncoding();
274
        ep.setProperty(J2SEProjectProperties.PROJECT_ENCODING, enc.name());
274
        if (manifestFile != null) {
275
        if (manifestFile != null) {
275
            ep.setProperty("manifest.file", manifestFile); // NOI18N
276
            ep.setProperty("manifest.file", manifestFile); // NOI18N
276
        }
277
        }
(-)src/org/netbeans/modules/java/j2seproject/queries/J2SEProjectEncodingQueryImpl.java (+73 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.modules.java.j2seproject.queries;
21
22
import java.beans.PropertyChangeEvent;
23
import java.beans.PropertyChangeListener;
24
import java.nio.charset.Charset;
25
import org.netbeans.api.queries.FileEncodingQuery;
26
import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
27
import org.netbeans.spi.queries.FileEncodingQueryImplementation;
28
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
29
import org.openide.filesystems.FileObject;
30
31
/**
32
 *
33
 * @author Tomas Zezula
34
 */
35
public class J2SEProjectEncodingQueryImpl implements FileEncodingQueryImplementation, PropertyChangeListener {
36
    
37
    
38
    private final PropertyEvaluator eval;
39
    private Charset cache;
40
    
41
    /** Creates a new instance of J2SEProjectEncodingQueryImpl */
42
    public J2SEProjectEncodingQueryImpl(final PropertyEvaluator eval) {
43
        assert eval != null;
44
        this.eval = eval;
45
        this.eval.addPropertyChangeListener(this);
46
    }
47
    
48
    public Charset getEncoding(FileObject file) {
49
        assert file != null;
50
        synchronized (this) {
51
            if (cache != null) {
52
                return cache;
53
            }
54
        }
55
        String enc = eval.getProperty(J2SEProjectProperties.PROJECT_ENCODING);
56
        synchronized (this) {
57
            if (cache == null) {
58
                cache = enc == null ? FileEncodingQuery.getDefaultEncoding() : Charset.forName(enc);
59
            }
60
            return cache;
61
        }
62
    }
63
   
64
    public void propertyChange(PropertyChangeEvent event) {        
65
        String propName = event.getPropertyName();
66
        if (propName == null || propName.equals(J2SEProjectProperties.PROJECT_ENCODING)) {
67
            synchronized (this) {
68
                cache = null;
69
            }
70
        }
71
    }
72
    
73
}
(-)src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl (+2 lines)
Lines 178-183 Link Here
178
                <property name="javac.debug" value="true"/>
178
                <property name="javac.debug" value="true"/>
179
                <property name="javadoc.preview" value="true"/>
179
                <property name="javadoc.preview" value="true"/>
180
                <property name="application.args" value=""/>
180
                <property name="application.args" value=""/>
181
                <property name="project.encoding" value="${{file.encoding}}"/>
181
            </target>
182
            </target>
182
183
183
            <target name="-post-init">
184
            <target name="-post-init">
Lines 264-269 Link Here
264
                            <xsl:attribute name="destdir">@{destdir}</xsl:attribute>
265
                            <xsl:attribute name="destdir">@{destdir}</xsl:attribute>
265
                            <xsl:attribute name="debug">@{debug}</xsl:attribute>
266
                            <xsl:attribute name="debug">@{debug}</xsl:attribute>
266
                            <xsl:attribute name="deprecation">${javac.deprecation}</xsl:attribute>
267
                            <xsl:attribute name="deprecation">${javac.deprecation}</xsl:attribute>
268
                            <xsl:attribute name="encoding">${project.encoding}</xsl:attribute>
267
                            <xsl:if test ="not(/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform/@explicit-source-supported ='false')">                            
269
                            <xsl:if test ="not(/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform/@explicit-source-supported ='false')">                            
268
                                <xsl:attribute name="source">${javac.source}</xsl:attribute>
270
                                <xsl:attribute name="source">${javac.source}</xsl:attribute>
269
                                <xsl:attribute name="target">${javac.target}</xsl:attribute>
271
                                <xsl:attribute name="target">${javac.target}</xsl:attribute>
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties (+2 lines)
Lines 497-502 Link Here
497
# {0} - name of configuration
497
# {0} - name of configuration
498
CustomizerRun.input.duplicate=Configuration {0} already exists.
498
CustomizerRun.input.duplicate=Configuration {0} already exists.
499
499
500
TXT_Encoding=&Encoding\:
501
500
CustomizerApplication.titleLabel.text=Title\:
502
CustomizerApplication.titleLabel.text=Title\:
501
CustomizerApplication.vendorLabel.text=Vendor\:
503
CustomizerApplication.vendorLabel.text=Vendor\:
502
CustomizerApplication.panelDescLabel.text=Common Application Properties
504
CustomizerApplication.panelDescLabel.text=Common Application Properties
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.form (-3 / +34 lines)
Lines 3-8 Link Here
3
<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
5
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
5
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
7
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
7
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
8
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
8
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
9
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
Lines 337-343 Link Here
337
          </Properties>
338
          </Properties>
338
          <Constraints>
339
          <Constraints>
339
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
340
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
340
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
341
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
341
            </Constraint>
342
            </Constraint>
342
          </Constraints>
343
          </Constraints>
343
        </Component>
344
        </Component>
Lines 357-375 Link Here
357
          </AccessibilityProperties>
358
          </AccessibilityProperties>
358
          <Constraints>
359
          <Constraints>
359
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
360
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
360
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="0" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.75" weightY="0.0"/>
361
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.75" weightY="0.0"/>
361
            </Constraint>
362
            </Constraint>
362
          </Constraints>
363
          </Constraints>
363
        </Component>
364
        </Component>
364
        <Container class="javax.swing.JPanel" name="jPanel2">
365
        <Container class="javax.swing.JPanel" name="jPanel2">
365
          <Constraints>
366
          <Constraints>
366
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
367
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
367
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="0" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
368
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
368
            </Constraint>
369
            </Constraint>
369
          </Constraints>
370
          </Constraints>
370
371
371
          <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
372
          <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
372
        </Container>
373
        </Container>
374
        <Component class="javax.swing.JLabel" name="jLabel5">
375
          <Properties>
376
            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
377
              <ComponentRef name="encoding"/>
378
            </Property>
379
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
380
              <ResourceString bundle="org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties" key="TXT_Encoding" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
381
            </Property>
382
          </Properties>
383
          <AuxValues>
384
            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
385
          </AuxValues>
386
          <Constraints>
387
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
388
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/>
389
            </Constraint>
390
          </Constraints>
391
        </Component>
392
        <Component class="javax.swing.JComboBox" name="encoding">
393
          <Properties>
394
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
395
              <StringArray count="0"/>
396
            </Property>
397
          </Properties>
398
          <Constraints>
399
            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
400
              <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
401
            </Constraint>
402
          </Constraints>
403
        </Component>
373
      </SubComponents>
404
      </SubComponents>
374
    </Container>
405
    </Container>
375
  </SubComponents>
406
  </SubComponents>
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.java (-30 / +136 lines)
Lines 19-31 Link Here
19
19
20
package org.netbeans.modules.java.j2seproject.ui.customizer;
20
package org.netbeans.modules.java.j2seproject.ui.customizer;
21
21
22
import java.awt.Component;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
22
import java.io.File;
25
import java.io.File;
26
import java.nio.charset.Charset;
27
import java.nio.charset.Charset;
28
import java.nio.charset.CharsetDecoder;
29
import java.nio.charset.CharsetEncoder;
30
import javax.swing.DefaultComboBoxModel;
31
import javax.swing.DefaultListCellRenderer;
32
import javax.swing.JList;
23
import javax.swing.event.ListDataEvent;
33
import javax.swing.event.ListDataEvent;
24
import javax.swing.event.ListDataListener;
34
import javax.swing.event.ListDataListener;
35
import org.netbeans.api.queries.FileEncodingQuery;
25
import org.openide.filesystems.FileObject;
36
import org.openide.filesystems.FileObject;
26
import org.openide.filesystems.FileUtil;
37
import org.openide.filesystems.FileUtil;
27
import org.openide.util.HelpCtx;
38
import org.openide.util.HelpCtx;
28
import org.openide.util.NbBundle;
29
import org.netbeans.modules.java.j2seproject.J2SEProject;
39
import org.netbeans.modules.java.j2seproject.J2SEProject;
30
40
31
/**
41
/**
Lines 33-38 Link Here
33
 * @author  Tomas Zezula
43
 * @author  Tomas Zezula
34
 */
44
 */
35
public class CustomizerSources extends javax.swing.JPanel implements HelpCtx.Provider {
45
public class CustomizerSources extends javax.swing.JPanel implements HelpCtx.Provider {
46
    
47
    
48
    private J2SEProjectProperties uiProperties;
49
    private String originalEncoding;
36
50
37
    public CustomizerSources( J2SEProjectProperties uiProperties ) {
51
    public CustomizerSources( J2SEProjectProperties uiProperties ) {
38
        initComponents();
52
        initComponents();
Lines 86-91 Link Here
86
            }                                    
100
            }                                    
87
        });
101
        });
88
        enableSourceLevel ();
102
        enableSourceLevel ();
103
        this.uiProperties = uiProperties;
104
        this.originalEncoding = this.uiProperties.getProject().evaluator().getProperty(J2SEProjectProperties.PROJECT_ENCODING);
105
        if (this.originalEncoding == null) {
106
            this.originalEncoding = FileEncodingQuery.getDefaultEncoding().name();
107
        }
108
        
109
        this.encoding.setModel(new EncodingModel(this.originalEncoding));
110
        this.encoding.setRenderer(new EncodingRenderer());
111
        
112
113
        this.encoding.addActionListener(new ActionListener () {
114
            public void actionPerformed(ActionEvent arg0) {
115
                handleEncodingChange();
116
            }            
117
        });
118
    }
119
    
120
    
121
    private void handleEncodingChange () {
122
            Charset enc = (Charset) encoding.getSelectedItem();
123
            String encName;
124
            if (enc != null) {
125
                encName = enc.name();
126
            }
127
            else {
128
                encName = originalEncoding;
129
            }
130
            this.uiProperties.putAdditionalProperty(J2SEProjectProperties.PROJECT_ENCODING, encName);
89
    }
131
    }
90
132
91
    public HelpCtx getHelpCtx() {
133
    public HelpCtx getHelpCtx() {
Lines 96-101 Link Here
96
        this.sourceLevel.setEnabled(sourceLevel.getItemCount()>0);
138
        this.sourceLevel.setEnabled(sourceLevel.getItemCount()>0);
97
    }
139
    }
98
    
140
    
141
    
142
    private static class EncodingRenderer extends DefaultListCellRenderer {
143
        
144
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
145
            assert value instanceof Charset; 
146
            return super.getListCellRendererComponent(list, ((Charset)value).displayName(), index, isSelected, cellHasFocus);
147
        }
148
    }
149
    
150
    private static class EncodingModel extends DefaultComboBoxModel {
151
        
152
        public EncodingModel (String originalEncoding) {
153
            Charset defEnc = null;
154
            for (Charset c : Charset.availableCharsets().values()) {
155
                if (c.name().equals(originalEncoding)) {
156
                    defEnc = c;
157
                }
158
                addElement(c);
159
            }
160
            if (defEnc == null) {
161
                //Create artificial Charset to keep the original value
162
                //May happen when the project was set up on the platform
163
                //which supports more encodings
164
                defEnc = new UnknownCharset (originalEncoding);
165
                addElement(defEnc);
166
            }            
167
            setSelectedItem(defEnc);
168
        }
169
    }
170
    
171
    private static class UnknownCharset extends Charset {
172
        
173
        UnknownCharset (String name) {
174
            super (name, new String[0]);
175
        }
176
    
177
        public boolean contains(Charset c) {
178
            throw new UnsupportedOperationException();
179
        }
180
181
        public CharsetDecoder newDecoder() {
182
            throw new UnsupportedOperationException();
183
        }
184
185
        public CharsetEncoder newEncoder() {
186
            throw new UnsupportedOperationException();
187
        }
188
}
189
    
99
    /** This method is called from within the constructor to
190
    /** This method is called from within the constructor to
100
     * initialize the form.
191
     * initialize the form.
101
     * WARNING: Do NOT modify this code. The content of this method is
192
     * WARNING: Do NOT modify this code. The content of this method is
Lines 127-138 Link Here
127
        jLabel4 = new javax.swing.JLabel();
218
        jLabel4 = new javax.swing.JLabel();
128
        sourceLevel = new javax.swing.JComboBox();
219
        sourceLevel = new javax.swing.JComboBox();
129
        jPanel2 = new javax.swing.JPanel();
220
        jPanel2 = new javax.swing.JPanel();
221
        jLabel5 = new javax.swing.JLabel();
222
        encoding = new javax.swing.JComboBox();
130
223
131
        setLayout(new java.awt.GridBagLayout());
224
        setLayout(new java.awt.GridBagLayout());
132
225
133
        jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_ProjectFolder").charAt(0));
226
        jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_ProjectFolder").charAt(0));
134
        jLabel1.setLabelFor(projectLocation);
227
        jLabel1.setLabelFor(projectLocation);
135
        jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_ProjectFolder"));
228
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle"); // NOI18N
229
        jLabel1.setText(bundle.getString("CTL_ProjectFolder")); // NOI18N
136
        gridBagConstraints = new java.awt.GridBagConstraints();
230
        gridBagConstraints = new java.awt.GridBagConstraints();
137
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
231
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
138
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
232
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
Lines 145-157 Link Here
145
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
239
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
146
        gridBagConstraints.weightx = 1.0;
240
        gridBagConstraints.weightx = 1.0;
147
        add(projectLocation, gridBagConstraints);
241
        add(projectLocation, gridBagConstraints);
148
        projectLocation.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_projectLocation"));
242
        projectLocation.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_projectLocation")); // NOI18N
149
243
150
        sourceRootsPanel.setLayout(new java.awt.GridBagLayout());
244
        sourceRootsPanel.setLayout(new java.awt.GridBagLayout());
151
245
152
        jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_SourceRoots").charAt(0));
246
        jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_SourceRoots").charAt(0));
153
        jLabel2.setLabelFor(sourceRoots);
247
        jLabel2.setLabelFor(sourceRoots);
154
        jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_SourceRoots"));
248
        jLabel2.setText(bundle.getString("CTL_SourceRoots")); // NOI18N
155
        gridBagConstraints = new java.awt.GridBagConstraints();
249
        gridBagConstraints = new java.awt.GridBagConstraints();
156
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
250
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
157
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
251
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
Lines 186-192 Link Here
186
            }
280
            }
187
        });
281
        });
188
        jScrollPane1.setViewportView(sourceRoots);
282
        jScrollPane1.setViewportView(sourceRoots);
189
        sourceRoots.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_sourceRoots"));
283
        sourceRoots.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_sourceRoots")); // NOI18N
190
284
191
        gridBagConstraints = new java.awt.GridBagConstraints();
285
        gridBagConstraints = new java.awt.GridBagConstraints();
192
        gridBagConstraints.gridx = 0;
286
        gridBagConstraints.gridx = 0;
Lines 200-206 Link Here
200
        sourceRootsPanel.add(jScrollPane1, gridBagConstraints);
294
        sourceRootsPanel.add(jScrollPane1, gridBagConstraints);
201
295
202
        addSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_AddSourceRoot").charAt(0));
296
        addSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_AddSourceRoot").charAt(0));
203
        addSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_AddSourceRoot"));
297
        addSourceRoot.setText(bundle.getString("CTL_AddSourceRoot")); // NOI18N
204
        gridBagConstraints = new java.awt.GridBagConstraints();
298
        gridBagConstraints = new java.awt.GridBagConstraints();
205
        gridBagConstraints.gridx = 1;
299
        gridBagConstraints.gridx = 1;
206
        gridBagConstraints.gridy = 1;
300
        gridBagConstraints.gridy = 1;
Lines 208-217 Link Here
208
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
302
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
209
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
303
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
210
        sourceRootsPanel.add(addSourceRoot, gridBagConstraints);
304
        sourceRootsPanel.add(addSourceRoot, gridBagConstraints);
211
        addSourceRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_addSourceRoot"));
305
        addSourceRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_addSourceRoot")); // NOI18N
212
306
213
        removeSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_RemoveSourceRoot").charAt(0));
307
        removeSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_RemoveSourceRoot").charAt(0));
214
        removeSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_RemoveSourceRoot"));
308
        removeSourceRoot.setText(bundle.getString("CTL_RemoveSourceRoot")); // NOI18N
215
        gridBagConstraints = new java.awt.GridBagConstraints();
309
        gridBagConstraints = new java.awt.GridBagConstraints();
216
        gridBagConstraints.gridx = 1;
310
        gridBagConstraints.gridx = 1;
217
        gridBagConstraints.gridy = 2;
311
        gridBagConstraints.gridy = 2;
Lines 220-229 Link Here
220
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
314
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
221
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
315
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
222
        sourceRootsPanel.add(removeSourceRoot, gridBagConstraints);
316
        sourceRootsPanel.add(removeSourceRoot, gridBagConstraints);
223
        removeSourceRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_removeSourceRoot"));
317
        removeSourceRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_removeSourceRoot")); // NOI18N
224
318
225
        upSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_UpSourceRoot").charAt(0));
319
        upSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_UpSourceRoot").charAt(0));
226
        upSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_UpSourceRoot"));
320
        upSourceRoot.setText(bundle.getString("CTL_UpSourceRoot")); // NOI18N
227
        gridBagConstraints = new java.awt.GridBagConstraints();
321
        gridBagConstraints = new java.awt.GridBagConstraints();
228
        gridBagConstraints.gridx = 1;
322
        gridBagConstraints.gridx = 1;
229
        gridBagConstraints.gridy = 3;
323
        gridBagConstraints.gridy = 3;
Lines 232-241 Link Here
232
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
326
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
233
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
327
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
234
        sourceRootsPanel.add(upSourceRoot, gridBagConstraints);
328
        sourceRootsPanel.add(upSourceRoot, gridBagConstraints);
235
        upSourceRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_upSourceRoot"));
329
        upSourceRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_upSourceRoot")); // NOI18N
236
330
237
        downSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_DownSourceRoot").charAt(0));
331
        downSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_DownSourceRoot").charAt(0));
238
        downSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_DownSourceRoot"));
332
        downSourceRoot.setText(bundle.getString("CTL_DownSourceRoot")); // NOI18N
239
        gridBagConstraints = new java.awt.GridBagConstraints();
333
        gridBagConstraints = new java.awt.GridBagConstraints();
240
        gridBagConstraints.gridx = 1;
334
        gridBagConstraints.gridx = 1;
241
        gridBagConstraints.gridy = 4;
335
        gridBagConstraints.gridy = 4;
Lines 244-250 Link Here
244
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
338
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
245
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
339
        gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
246
        sourceRootsPanel.add(downSourceRoot, gridBagConstraints);
340
        sourceRootsPanel.add(downSourceRoot, gridBagConstraints);
247
        downSourceRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_downSourceRoot"));
341
        downSourceRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_downSourceRoot")); // NOI18N
248
342
249
        gridBagConstraints = new java.awt.GridBagConstraints();
343
        gridBagConstraints = new java.awt.GridBagConstraints();
250
        gridBagConstraints.gridx = 0;
344
        gridBagConstraints.gridx = 0;
Lines 260-266 Link Here
260
354
261
        jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_TestRoots").charAt(0));
355
        jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_TestRoots").charAt(0));
262
        jLabel3.setLabelFor(testRoots);
356
        jLabel3.setLabelFor(testRoots);
263
        jLabel3.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_TestRoots"));
357
        jLabel3.setText(bundle.getString("CTL_TestRoots")); // NOI18N
264
        gridBagConstraints = new java.awt.GridBagConstraints();
358
        gridBagConstraints = new java.awt.GridBagConstraints();
265
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
359
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
266
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
360
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
Lines 296-302 Link Here
296
            }
390
            }
297
        });
391
        });
298
        jScrollPane2.setViewportView(testRoots);
392
        jScrollPane2.setViewportView(testRoots);
299
        testRoots.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_testRoots"));
393
        testRoots.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_testRoots")); // NOI18N
300
394
301
        gridBagConstraints = new java.awt.GridBagConstraints();
395
        gridBagConstraints = new java.awt.GridBagConstraints();
302
        gridBagConstraints.gridx = 0;
396
        gridBagConstraints.gridx = 0;
Lines 309-315 Link Here
309
        testRootsPanel.add(jScrollPane2, gridBagConstraints);
403
        testRootsPanel.add(jScrollPane2, gridBagConstraints);
310
404
311
        addTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_AddTestRoot").charAt(0));
405
        addTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_AddTestRoot").charAt(0));
312
        addTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_AddTestRoot"));
406
        addTestRoot.setText(bundle.getString("CTL_AddTestRoot")); // NOI18N
313
        gridBagConstraints = new java.awt.GridBagConstraints();
407
        gridBagConstraints = new java.awt.GridBagConstraints();
314
        gridBagConstraints.gridx = 1;
408
        gridBagConstraints.gridx = 1;
315
        gridBagConstraints.gridy = 1;
409
        gridBagConstraints.gridy = 1;
Lines 318-327 Link Here
318
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
412
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
319
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0);
413
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0);
320
        testRootsPanel.add(addTestRoot, gridBagConstraints);
414
        testRootsPanel.add(addTestRoot, gridBagConstraints);
321
        addTestRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_addTestRoot"));
415
        addTestRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_addTestRoot")); // NOI18N
322
416
323
        removeTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_RemoveTestRoot").charAt(0));
417
        removeTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_RemoveTestRoot").charAt(0));
324
        removeTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_RemoveTestRoot"));
418
        removeTestRoot.setText(bundle.getString("CTL_RemoveTestRoot")); // NOI18N
325
        gridBagConstraints = new java.awt.GridBagConstraints();
419
        gridBagConstraints = new java.awt.GridBagConstraints();
326
        gridBagConstraints.gridx = 1;
420
        gridBagConstraints.gridx = 1;
327
        gridBagConstraints.gridy = 2;
421
        gridBagConstraints.gridy = 2;
Lines 330-339 Link Here
330
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
424
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
331
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
425
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0);
332
        testRootsPanel.add(removeTestRoot, gridBagConstraints);
426
        testRootsPanel.add(removeTestRoot, gridBagConstraints);
333
        removeTestRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_removeTestRoot"));
427
        removeTestRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_removeTestRoot")); // NOI18N
334
428
335
        upTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_UpTestRoot").charAt(0));
429
        upTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_UpTestRoot").charAt(0));
336
        upTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_UpTestRoot"));
430
        upTestRoot.setText(bundle.getString("CTL_UpTestRoot")); // NOI18N
337
        gridBagConstraints = new java.awt.GridBagConstraints();
431
        gridBagConstraints = new java.awt.GridBagConstraints();
338
        gridBagConstraints.gridx = 1;
432
        gridBagConstraints.gridx = 1;
339
        gridBagConstraints.gridy = 3;
433
        gridBagConstraints.gridy = 3;
Lines 342-351 Link Here
342
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
436
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
343
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0);
437
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 0);
344
        testRootsPanel.add(upTestRoot, gridBagConstraints);
438
        testRootsPanel.add(upTestRoot, gridBagConstraints);
345
        upTestRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_upTestRoot"));
439
        upTestRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_upTestRoot")); // NOI18N
346
440
347
        downTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_DownTestRoot").charAt(0));
441
        downTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_DownTestRoot").charAt(0));
348
        downTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("CTL_DownTestRoot"));
442
        downTestRoot.setText(bundle.getString("CTL_DownTestRoot")); // NOI18N
349
        gridBagConstraints = new java.awt.GridBagConstraints();
443
        gridBagConstraints = new java.awt.GridBagConstraints();
350
        gridBagConstraints.gridx = 1;
444
        gridBagConstraints.gridx = 1;
351
        gridBagConstraints.gridy = 4;
445
        gridBagConstraints.gridy = 4;
Lines 354-360 Link Here
354
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
448
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
355
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
449
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
356
        testRootsPanel.add(downTestRoot, gridBagConstraints);
450
        testRootsPanel.add(downTestRoot, gridBagConstraints);
357
        downTestRoot.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_CustomizerSources_downTestRoot"));
451
        downTestRoot.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_CustomizerSources_downTestRoot")); // NOI18N
358
452
359
        gridBagConstraints = new java.awt.GridBagConstraints();
453
        gridBagConstraints = new java.awt.GridBagConstraints();
360
        gridBagConstraints.gridx = 0;
454
        gridBagConstraints.gridx = 0;
Lines 371-401 Link Here
371
465
372
        jLabel4.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_SourceLevel").charAt(0));
466
        jLabel4.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("MNE_SourceLevel").charAt(0));
373
        jLabel4.setLabelFor(sourceLevel);
467
        jLabel4.setLabelFor(sourceLevel);
374
        jLabel4.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("TXT_SourceLevel"));
468
        jLabel4.setText(bundle.getString("TXT_SourceLevel")); // NOI18N
375
        gridBagConstraints = new java.awt.GridBagConstraints();
469
        gridBagConstraints = new java.awt.GridBagConstraints();
376
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
377
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
470
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
378
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
471
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
379
        jPanel1.add(jLabel4, gridBagConstraints);
472
        jPanel1.add(jLabel4, gridBagConstraints);
380
473
381
        sourceLevel.setMinimumSize(this.sourceLevel.getPreferredSize());
474
        sourceLevel.setMinimumSize(this.sourceLevel.getPreferredSize());
382
        gridBagConstraints = new java.awt.GridBagConstraints();
475
        gridBagConstraints = new java.awt.GridBagConstraints();
383
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
384
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
476
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
385
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
477
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
386
        gridBagConstraints.weightx = 0.75;
478
        gridBagConstraints.weightx = 0.75;
387
        jPanel1.add(sourceLevel, gridBagConstraints);
479
        jPanel1.add(sourceLevel, gridBagConstraints);
388
        sourceLevel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AN_SourceLevel"));
480
        sourceLevel.getAccessibleContext().setAccessibleName(bundle.getString("AN_SourceLevel")); // NOI18N
389
        sourceLevel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/java/j2seproject/ui/customizer/Bundle").getString("AD_SourceLevel"));
481
        sourceLevel.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_SourceLevel")); // NOI18N
390
482
391
        gridBagConstraints = new java.awt.GridBagConstraints();
483
        gridBagConstraints = new java.awt.GridBagConstraints();
392
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
484
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
393
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
394
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
485
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
395
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
486
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
396
        gridBagConstraints.weightx = 1.0;
487
        gridBagConstraints.weightx = 1.0;
397
        jPanel1.add(jPanel2, gridBagConstraints);
488
        jPanel1.add(jPanel2, gridBagConstraints);
398
489
490
        jLabel5.setLabelFor(encoding);
491
        org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CustomizerSources.class, "TXT_Encoding")); // NOI18N
492
        gridBagConstraints = new java.awt.GridBagConstraints();
493
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
494
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
495
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 12);
496
        jPanel1.add(jLabel5, gridBagConstraints);
497
498
        gridBagConstraints = new java.awt.GridBagConstraints();
499
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
500
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
501
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
502
        jPanel1.add(encoding, gridBagConstraints);
503
399
        gridBagConstraints = new java.awt.GridBagConstraints();
504
        gridBagConstraints = new java.awt.GridBagConstraints();
400
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
505
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
401
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
506
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
Lines 403-409 Link Here
403
        gridBagConstraints.weightx = 1.0;
508
        gridBagConstraints.weightx = 1.0;
404
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
509
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
405
        add(jPanel1, gridBagConstraints);
510
        add(jPanel1, gridBagConstraints);
406
407
    }// </editor-fold>//GEN-END:initComponents
511
    }// </editor-fold>//GEN-END:initComponents
408
    
512
    
409
    
513
    
Lines 412-421 Link Here
412
    private javax.swing.JButton addTestRoot;
516
    private javax.swing.JButton addTestRoot;
413
    private javax.swing.JButton downSourceRoot;
517
    private javax.swing.JButton downSourceRoot;
414
    private javax.swing.JButton downTestRoot;
518
    private javax.swing.JButton downTestRoot;
519
    private javax.swing.JComboBox encoding;
415
    private javax.swing.JLabel jLabel1;
520
    private javax.swing.JLabel jLabel1;
416
    private javax.swing.JLabel jLabel2;
521
    private javax.swing.JLabel jLabel2;
417
    private javax.swing.JLabel jLabel3;
522
    private javax.swing.JLabel jLabel3;
418
    private javax.swing.JLabel jLabel4;
523
    private javax.swing.JLabel jLabel4;
524
    private javax.swing.JLabel jLabel5;
419
    private javax.swing.JPanel jPanel1;
525
    private javax.swing.JPanel jPanel1;
420
    private javax.swing.JPanel jPanel2;
526
    private javax.swing.JPanel jPanel2;
421
    private javax.swing.JScrollPane jScrollPane1;
527
    private javax.swing.JScrollPane jScrollPane1;
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java (-3 / +13 lines)
Lines 23-34 Link Here
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.net.MalformedURLException;
24
import java.net.MalformedURLException;
25
import java.net.URL;
25
import java.net.URL;
26
import java.nio.charset.Charset;
27
import java.nio.charset.UnsupportedCharsetException;
26
import java.util.Comparator;
28
import java.util.Comparator;
27
import java.util.HashMap;
29
import java.util.HashMap;
28
import java.util.HashSet;
30
import java.util.HashSet;
29
import java.util.Iterator;
31
import java.util.Iterator;
30
import java.util.Map;
32
import java.util.Map;
31
import java.util.Map.Entry;
32
import java.util.Properties;
33
import java.util.Properties;
33
import java.util.Set;
34
import java.util.Set;
34
import java.util.TreeMap;
35
import java.util.TreeMap;
Lines 42-47 Link Here
42
import javax.swing.table.DefaultTableModel;
43
import javax.swing.table.DefaultTableModel;
43
import javax.swing.text.BadLocationException;
44
import javax.swing.text.BadLocationException;
44
import javax.swing.text.Document;
45
import javax.swing.text.Document;
46
import org.netbeans.api.queries.FileEncodingQuery;
45
import org.netbeans.api.project.ProjectManager;
47
import org.netbeans.api.project.ProjectManager;
46
import org.netbeans.api.project.ProjectUtils;
48
import org.netbeans.api.project.ProjectUtils;
47
import org.netbeans.modules.java.j2seproject.J2SEProject;
49
import org.netbeans.modules.java.j2seproject.J2SEProject;
Lines 107-113 Link Here
107
    public static final String DIST_JAVADOC_DIR = "dist.javadoc.dir"; // NOI18N
109
    public static final String DIST_JAVADOC_DIR = "dist.javadoc.dir"; // NOI18N
108
    public static final String NO_DEPENDENCIES="no.dependencies"; // NOI18N
110
    public static final String NO_DEPENDENCIES="no.dependencies"; // NOI18N
109
    public static final String DEBUG_TEST_CLASSPATH = "debug.test.classpath"; // NOI18N
111
    public static final String DEBUG_TEST_CLASSPATH = "debug.test.classpath"; // NOI18N
110
    
112
    public static final String PROJECT_ENCODING="project.encoding"; // NOI18N
111
    
113
    
112
    public static final String JAVADOC_PRIVATE="javadoc.private"; // NOI18N
114
    public static final String JAVADOC_PRIVATE="javadoc.private"; // NOI18N
113
    public static final String JAVADOC_NO_TREE="javadoc.notree"; // NOI18N
115
    public static final String JAVADOC_NO_TREE="javadoc.notree"; // NOI18N
Lines 436-443 Link Here
436
        
438
        
437
        // Store the property changes into the project
439
        // Store the property changes into the project
438
        updateHelper.putProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties );
440
        updateHelper.putProperties( AntProjectHelper.PROJECT_PROPERTIES_PATH, projectProperties );
439
        updateHelper.putProperties( AntProjectHelper.PRIVATE_PROPERTIES_PATH, privateProperties );        
441
        updateHelper.putProperties( AntProjectHelper.PRIVATE_PROPERTIES_PATH, privateProperties );
440
        
442
        
443
        String value = additionalProperties.getProperty(PROJECT_ENCODING);
444
        if (value != null) {
445
            try {
446
                FileEncodingQuery.setDefaultEncoding(Charset.forName(value));
447
            } catch (UnsupportedCharsetException e) {
448
                //When the encoding is not supported by JVM do not set it as default
449
            }
450
        }
441
    }
451
    }
442
  
452
  
443
    private void storeAdditionalProperties(EditableProperties projectProperties) {
453
    private void storeAdditionalProperties(EditableProperties projectProperties) {
(-)test/unit/src/org/netbeans/modules/java/j2seproject/queries/FileEncodingQueryTest.java (+122 lines)
Added Link Here
1
/*
2
 * The contents of this file are subject to the terms of the Common Development
3
 * and Distribution License (the License). You may not use this file except in
4
 * compliance with the License.
5
 *
6
 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7
 * or http://www.netbeans.org/cddl.txt.
8
 *
9
 * When distributing Covered Code, include this CDDL Header Notice in each file
10
 * and include the License file at http://www.netbeans.org/cddl.txt.
11
 * If applicable, add the following below the CDDL Header, with the fields
12
 * enclosed by brackets [] replaced by your own identifying information:
13
 * "Portions Copyrighted [year] [name of copyright owner]"
14
 *
15
 * The Original Software is NetBeans. The Initial Developer of the Original
16
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17
 * Microsystems, Inc. All Rights Reserved.
18
 */
19
20
package org.netbeans.modules.java.j2seproject.queries;
21
22
import java.io.File;
23
import java.io.IOException;
24
import java.nio.charset.Charset;
25
import org.netbeans.api.queries.FileEncodingQuery;
26
import org.netbeans.api.project.FileOwnerQuery;
27
import org.netbeans.api.project.Project;
28
import org.netbeans.junit.NbTestCase;
29
import org.netbeans.modules.java.j2seproject.J2SEProject;
30
import org.netbeans.modules.java.j2seproject.J2SEProjectGenerator;
31
import org.openide.filesystems.FileObject;
32
import org.netbeans.junit.MockServices;
33
import org.netbeans.spi.queries.FileEncodingQueryImplementation;
34
import org.netbeans.spi.project.support.ant.AntProjectHelper;
35
import org.netbeans.spi.project.support.ant.EditableProperties;
36
import org.openide.filesystems.FileUtil;
37
import org.openide.filesystems.FileUtil;
38
import org.openide.modules.SpecificationVersion;
39
40
/**
41
 * Tests for FileEncodingQuery
42
 *
43
 * @author Tomas Zezula
44
 */
45
public class FileEncodingQueryTest extends NbTestCase {        
46
47
    public FileEncodingQueryTest(String testName) {
48
        super(testName);        
49
    }
50
    
51
    private FileObject scratch;
52
    private FileObject projdir;
53
    private FileObject sources;
54
    private AntProjectHelper helper;
55
    private J2SEProject prj;
56
57
    protected void setUp() throws Exception {        
58
        MockServices.setServices(DummyXMLEncodingImpl.class);
59
        super.setUp();        
60
        this.clearWorkDir();
61
    }
62
63
    protected void tearDown() throws Exception {
64
        scratch = null;
65
        projdir = null;
66
        prj = null;
67
        super.tearDown();
68
    }
69
70
71
    private void prepareProject () throws IOException {
72
        File wd = getWorkDir();
73
        scratch = FileUtil.toFileObject(wd);
74
        assertNotNull(wd);
75
        projdir = scratch.createFolder("proj");        
76
        J2SEProjectGenerator.setDefaultSourceLevel(new SpecificationVersion ("1.4"));   //NOI18N
77
        helper = J2SEProjectGenerator.createProject(FileUtil.toFile(projdir),"proj",null,null);
78
        Project p = FileOwnerQuery.getOwner(projdir);
79
        assertNotNull(p);
80
        prj = p.getLookup().lookup(J2SEProject.class);
81
        assertNotNull(prj);
82
        sources = projdir.getFileObject("src");
83
    }
84
85
    public void testFileEncodingQuery () throws Exception {
86
        this.prepareProject();
87
        final Charset UTF8 = Charset.forName("UTF-8");
88
        final Charset ISO15 = Charset.forName("ISO-8859-15");
89
        final Charset CP1252 = Charset.forName("CP1252");
90
        FileObject java = sources.createData("a.java");
91
        Charset enc = FileEncodingQuery.getEncoding(java);
92
        assertEquals(UTF8,enc);
93
        FileObject xml = sources.createData("b.xml");
94
        enc = FileEncodingQuery.getEncoding(xml);
95
        assertEquals(ISO15,enc);
96
        EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
97
        ep.setProperty("project.encoding", CP1252.name());
98
        helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, ep);
99
        enc = FileEncodingQuery.getEncoding(java);
100
        assertEquals(CP1252,enc);
101
        FileObject standAloneJava = scratch.createData("b.java");
102
        enc = FileEncodingQuery.getEncoding(standAloneJava);
103
        assertEquals(UTF8,enc);
104
    }
105
106
107
    public static class DummyXMLEncodingImpl implements FileEncodingQueryImplementation {
108
               
109
                            
110
        public Charset getEncoding(FileObject file) {
111
            if ("xml".equals(file.getExt())) {
112
                return Charset.forName("ISO-8859-15");
113
            }
114
            else {
115
                return null;
116
            }
117
        }
118
    }
119
120
121
122
}

Return to bug 42638