This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new beab7120c5 Use source levels supported by underlying Java platform in
Ant APISupport UI.
new 14a851acdf Merge pull request #3987 from neilcsmith-net/apisupport-ant
beab7120c5 is described below
commit beab7120c5b610e8d61e981eb176487b5906d06b
Author: Neil C Smith <[email protected]>
AuthorDate: Thu Apr 14 18:16:15 2022 +0100
Use source levels supported by underlying Java platform in Ant APISupport
UI.
---
.../project/ui/customizer/CustomizerSources.form | 6 ++++-
.../project/ui/customizer/CustomizerSources.java | 28 ++++++++++++++++++++--
.../ui/customizer/SingleModuleProperties.java | 1 -
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.form
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.form
index e2d49fc603..9b64d244fd 100644
---
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.form
+++
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.form
@@ -21,9 +21,13 @@
-->
-<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+<Form version="1.2" maxVersion="1.2"
type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean"
value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode"
type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean"
value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle"
type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean"
value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer"
value="2"/>
diff --git
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.java
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.java
index 5f6b95ed18..3975dd6c24 100644
---
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.java
+++
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/CustomizerSources.java
@@ -22,10 +22,14 @@ package
org.netbeans.modules.apisupport.project.ui.customizer;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.java.platform.JavaPlatform;
import org.netbeans.modules.apisupport.project.ui.ApisupportAntUIUtils;
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
import org.openide.NotifyDescriptor;
import org.openide.modules.SpecificationVersion;
+import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
/**
@@ -87,8 +91,9 @@ final class CustomizerSources extends NbPropertyPanel.Single {
srcLevelValueBeingUpdated = true;
try {
srcLevelValue.removeAllItems();
- for (int i = 0; i < SingleModuleProperties.SOURCE_LEVELS.length;
i++) {
- srcLevelValue.addItem(SingleModuleProperties.SOURCE_LEVELS[i]);
+ String[] levels =
sourceLevels(getProperties().getActiveJavaPlatform());
+ for (String level : levels) {
+ srcLevelValue.addItem(level);
}
srcLevelValue.setSelectedItem(getProperty(SingleModuleProperties.JAVAC_SOURCE));
} finally {
@@ -204,4 +209,23 @@ final class CustomizerSources extends
NbPropertyPanel.Single {
prjFolderValue.getAccessibleContext().setAccessibleDescription(getMessage("ACS_PrjFolderValue"));
}
+ private String[] sourceLevels(JavaPlatform platform) {
+ List<String> levels = new ArrayList<>();
+ levels.add("1.4");
+ levels.add("1.5");
+ levels.add("1.6");
+ levels.add("1.7");
+ levels.add("1.8");
+ try {
+ String platformVersion =
platform.getSpecification().getVersion().toString();
+ int maxLevel = Integer.parseInt(platformVersion.split("\\.")[0]);
+ for (int level = 9; level <= maxLevel; level++) {
+ levels.add(Integer.toString(level));
+ }
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ return levels.toArray(new String[0]);
+ }
+
}
diff --git
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
index b9e9d76446..5067387380 100644
---
a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
+++
b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
@@ -118,7 +118,6 @@ public final class SingleModuleProperties extends
ModuleProperties {
public static final String SPEC_VERSION_BASE = "spec.version.base"; //
NOI18N
/** @see "#66278" */
public static final String JAVAC_COMPILERARGS = "javac.compilerargs"; //
NOI18N
- static final String[] SOURCE_LEVELS = {"1.4", "1.5", "1.6", "1.7", "1.8",
"9", "10", "11", "12", "13", "14"}; // NOI18N
private static final Map<String, String> DEFAULTS;
private static final Logger LOG =
Logger.getLogger(SingleModuleProperties.class.getName());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists