diff --git a/java.api.common/apichanges.xml b/java.api.common/apichanges.xml --- a/java.api.common/apichanges.xml +++ b/java.api.common/apichanges.xml @@ -105,6 +105,22 @@ + + + Added UI support for JRE profiles. + + + + + +

+ Addded factory methods to PlatformUiSupport to create + a model and renderer for JDK 8 profiles. +

+
+ + +
Added a helper method creating LibraryImplementation3 for ant and maven projects. diff --git a/java.api.common/manifest.mf b/java.api.common/manifest.mf --- a/java.api.common/manifest.mf +++ b/java.api.common/manifest.mf @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.java.api.common/0 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.44 +OpenIDE-Module-Specification-Version: 1.45 diff --git a/java.api.common/nbproject/project.xml b/java.api.common/nbproject/project.xml --- a/java.api.common/nbproject/project.xml +++ b/java.api.common/nbproject/project.xml @@ -29,7 +29,7 @@ 1 - 1.30 + 1.45 diff --git a/java.api.common/src/org/netbeans/modules/java/api/common/ui/Bundle.properties b/java.api.common/src/org/netbeans/modules/java/api/common/ui/Bundle.properties --- a/java.api.common/src/org/netbeans/modules/java/api/common/ui/Bundle.properties +++ b/java.api.common/src/org/netbeans/modules/java/api/common/ui/Bundle.properties @@ -54,3 +54,7 @@ Do you want to change the Java Platform and update the source level\n\ version? TXT_ChangePlatformTitle=Change Java Platform +TXT_Profile_Compact1=Compact 1 +TXT_Profile_Compact2=Compact 2 +TXT_Profile_Compact3=Compact 3 +TXT_Profile_Default=Full JRE diff --git a/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java b/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java --- a/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java +++ b/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java @@ -49,13 +49,21 @@ import java.beans.PropertyChangeListener; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.logging.Logger; import javax.swing.*; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; +import org.netbeans.api.annotations.common.CheckForNull; import org.netbeans.api.annotations.common.NonNull; import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.api.java.platform.JavaPlatform; @@ -81,7 +89,8 @@ */ public final class PlatformUiSupport { - private static final SpecificationVersion JDK_1_5 = new SpecificationVersion("1.5"); //NOI18N + private static final SpecificationVersion JDK_1_5 = new SpecificationVersion("1.5"); //NOI18N + private static final SpecificationVersion JDK_8 = new SpecificationVersion("1.8"); //NOI18N private static final Logger LOGGER = Logger.getLogger(PlatformUiSupport.class.getName()); private PlatformUiSupport() { @@ -148,7 +157,14 @@ @NonNull final String projectConfigurationNamespace, @NonNull final Object platformKey, @NullAllowed final Object sourceLevelKey) { - storePlatform(props, helper, projectConfigurationNamespace, platformKey, sourceLevelKey, true); + storePlatform( + props, + helper, + projectConfigurationNamespace, + platformKey, + sourceLevelKey, + null, + true); } /** @@ -168,16 +184,62 @@ @NonNull final Object platformKey, @NullAllowed final Object sourceLevelKey, final boolean updatePreferredPlatform) { + storePlatform( + props, + helper, + projectConfigurationNamespace, + platformKey, + sourceLevelKey, + null, + updatePreferredPlatform); + } + + /** + * Stores active platform, javac.source,javac.target and javac.profile into the project's metadata. + * @param props project's shared properties + * @param helper {@link UpdateHelper} that is capable to upgrade project metadata if needed. + * @param projectConfigurationNamespace project configuration namespace. + * @param platformKey the {@link PlatformKey} got from the platform model. + * @param sourceLevelKey {@link SourceLevelKey} representing source level; can be null. + * @param profileKey {@link Profile} representing required profile; can be null for full JRE. + * @param updatePreferredPlatform if true the {@link PreferredProjectPlatform} will be updated + * @since 1.45 + */ + public static void storePlatform( + @NonNull final EditableProperties props, + @NonNull final UpdateHelper helper, + @NonNull final String projectConfigurationNamespace, + @NonNull final Object platformKey, + @NullAllowed final Object sourceLevelKey, + @NullAllowed final Object profileKey, + final boolean updatePreferredPlatform) { Parameters.notNull("props", props); //NOI18N Parameters.notNull("helper", helper); //NOI18N Parameters.notNull("projectConfigurationNamespace", projectConfigurationNamespace); //NOI18N Parameters.notNull("platformKey", platformKey); //NOI18N - - assert platformKey instanceof PlatformKey; + if (!(platformKey instanceof PlatformKey)) { + throw new IllegalArgumentException(String.format( + "Unsupported platform key: %s of type: %s", //NOI18N + platformKey, + platformKey.getClass())); + } + if (sourceLevelKey != null && !(sourceLevelKey instanceof SourceLevelKey)) { + throw new IllegalArgumentException(String.format( + "Unsupported source level key: %s of type: %s", //NOI18N + sourceLevelKey, + sourceLevelKey.getClass())); + } + if (profileKey != null && !(profileKey instanceof Profile)) { + throw new IllegalArgumentException(String.format( + "Unsupported profile key: %s of type: %s", //NOI18N + profileKey, + profileKey.getClass())); + } final String javaPlatformKey = "platform.active"; //NOI18N final String javacSourceKey = "javac.source"; //NOI18N final String javacTargetKey = "javac.target"; //NOI18N + final String javacProfileKey = "javac.profile"; //NOI18N PlatformKey pk = (PlatformKey) platformKey; JavaPlatform platform = getPlatform(pk); @@ -251,7 +313,6 @@ if (sourceLevelKey == null) { sourceLevel = platform.getSpecification().getVersion(); } else { - assert sourceLevelKey instanceof SourceLevelKey; sourceLevel = ((SourceLevelKey) sourceLevelKey).getSourceLevel(); } String javacSource = sourceLevel.toString(); @@ -275,12 +336,47 @@ if (!javacTarget.equals(props.getProperty(javacTargetKey))) { props.setProperty(javacTargetKey, javacTarget); } + + final String javacProfile; + if (profileKey != null) { + javacProfile = ((Profile)profileKey).getName(); + } else { + javacProfile = null; + } + if (javacProfile != null) { + if(!javacProfile.equals(props.getProperty(javacProfileKey))) { + props.setProperty(javacProfileKey, javacProfile); + } + } else if (props.containsKey(javacProfileKey)) { + props.remove(javacProfileKey); + } if (changed) { helper.putPrimaryConfigurationData(root, true); } } + /** + * Returns a {@link SpecificationVersion} for an item obtained from the {@link ComboBoxModel} created by + * the {@link PlatformUiSupport#createSourceLevelComboBoxModel} method. This method + * can return null if the source level is broken. + * @param sourceLevelKey an item obtained from {@link ComboBoxModel} created by + * {@link PlatformUiSupport#createSourceLevelComboBoxModel}. + * @return {@link SpecificationVersion} or null in case when source level is broken. + * @throws IllegalArgumentException if the input parameter is not an object created by source level combobox model. + * @since 1.45 + */ + public static SpecificationVersion getSourceLevel(@NonNull final Object sourceLevelKey) { + Parameters.notNull("sourceLevelKey", sourceLevelKey); //NOI18N + if (!(sourceLevelKey instanceof SourceLevelKey)) { + throw new IllegalArgumentException(String.format( + "Unsupported source level key: %s of type: %s", //NOI18N + sourceLevelKey, + sourceLevelKey.getClass())); + } + return ((SourceLevelKey)sourceLevelKey).getSourceLevel(); + } + /** * Return a {@link JavaPlatform} for an item obtained from the ComboBoxModel created by @@ -345,6 +441,35 @@ } /** + * Create {@link ComboBoxModel} of JRE profiles for active source level. + * The model listens on the source level {@link ComboBoxModel} and update its + * state according to the changes. It is possible to define minimal required + * JRE profile. + * @param sourceLevelModel the source level model used for listening. + * @param initialProfile initial profile, null if unknown. + * @param minimalProfile minimal JRE profile to be displayed. + * It can be null if all the JRE profiles should be displayed. + * @return {@link ComboBoxModel}. + * @since 1.45 + */ + public static ComboBoxModel createProfileComboBoxModel( + @NonNull final ComboBoxModel sourceLevelModel, + @NullAllowed final String initialProfile, + @NullAllowed final String minimalProfile) { + return new ProfileComboBoxModel(sourceLevelModel, initialProfile, minimalProfile); + } + + /** + * Create {@link ListCellRenderer} for JRE profiles. + * This renderer highlights incorrect profile names. + * @return {@link ListCellRenderer} for JRE profiles. + * @since 1.45 + */ + public static ListCellRenderer createProfileListCellRenderer() { + return new ProfileListCellRenderer(); + } + + /** * This class represents a JavaPlatform in the {@link ListModel} * created by the {@link PlatformUiSupport#createPlatformComboBoxModel(String)} method. */ @@ -814,6 +939,269 @@ } } + private interface Profile { + @NonNull + String getName(); + + @NonNull + String getDisplayName(); + + int getRank(); + + boolean isSupportedIn(@NonNull final SpecificationVersion sourceLevel); + } + + private enum StandardProfile implements Profile { + COMPACT1( + "compact1", //NOI18N + NbBundle.getMessage(PlatformUiSupport.class, "TXT_Profile_Compact1"), + 0, + Arrays.asList(JDK_8)), + COMPACT2( + "compact2", //NOI18N + NbBundle.getMessage(PlatformUiSupport.class, "TXT_Profile_Compact2"), + 1, + Arrays.asList(JDK_8)), + COMPACT3( + "compact3", //NOI18N + NbBundle.getMessage(PlatformUiSupport.class, "TXT_Profile_Compact3"), + 2, + Arrays.asList(JDK_8)), + DEFAULT( + "default", //NOI18N + NbBundle.getMessage(PlatformUiSupport.class, "TXT_Profile_Default"), + Integer.MAX_VALUE-1, + Arrays.asList(JDK_8)); + + private static final Map profilesByName = + new HashMap(); + static { + for (Profile p : values()) { + profilesByName.put(p.getName(), p); + } + } + + private final String name; + private final String displayName; + private final int rank; + private final Set supportedIn; + + StandardProfile( + @NonNull final String name, + @NonNull final String displayName, + @NonNull final int rank, + @NonNull final Collection supportedIn) { + Parameters.notNull("name", name); //NOI18N + Parameters.notNull("displayName", displayName); //NOI18N + this.name = name; + this.displayName = displayName; + this.rank = rank; + this.supportedIn = Collections.unmodifiableSet( + new HashSet(supportedIn)); + } + + @Override + public String getName() { + return name; + } + + @Override + public String getDisplayName() { + return displayName; + } + + @Override + public int getRank() { + return rank; + } + + @Override + public boolean isSupportedIn(SpecificationVersion sourceLevel) { + return supportedIn.contains(sourceLevel); + } + + @Override + public String toString() { + return String.format( + "%s (%s)", //NOI18N + displayName, + name); + } + + @CheckForNull + static Profile forName(@NonNull final String id) { + return profilesByName.get(id); + } + + } + + private static final class ProfileComboBoxModel extends AbstractListModel implements ComboBoxModel, ListDataListener { + + private final ComboBoxModel sourceLevelModel; + private final String initialProfileName; + private final String minimalProfileName; + + private Profile[] profiles; + private Profile selectedItem; + + ProfileComboBoxModel( + @NonNull final ComboBoxModel sourceLevelModel, + @NullAllowed final String initialProfileName, + @NullAllowed final String minimalProfileName) { + this.sourceLevelModel = sourceLevelModel; + this.initialProfileName = initialProfileName; + this.minimalProfileName = minimalProfileName; + this.sourceLevelModel.addListDataListener(this); + } + + @Override + public int getSize() { + final Profile[] p = init(); + return p.length; + } + + @Override + @CheckForNull + public Object getElementAt(final int index) { + final Profile[] p = init(); + if (index < 0 || index >= p.length) { + throw new IndexOutOfBoundsException(String.format( + "Index: %d, Profiles count: %d", //NOI18N + index, + p.length)); + } + return p[index]; + } + + @Override + public void setSelectedItem(@NullAllowed final Object anItem) { + assert anItem == null || anItem instanceof Profile; + selectedItem = (Profile) anItem; + } + + @Override + @CheckForNull + public Object getSelectedItem() { + return selectedItem; + } + + @Override + public void intervalAdded(ListDataEvent e) { + } + + @Override + public void intervalRemoved(ListDataEvent e) { + } + + @Override + public void contentsChanged(ListDataEvent e) { + final int oldSize = getSize(); + profiles = null; + fireContentsChanged(this, 0, oldSize); + } + + private Profile[] init() { + if (profiles == null) { + final Comparator c = new Comparator() { + @Override + public int compare( + @NonNull final Profile p1, + @NonNull final Profile p2) { + final int r1 = p1.getRank(); + final int r2 = p2.getRank(); + return r1 < r2 ? + -1 : + r1 == r2 ? + 0 : + 1; + } + }; + Profile minimalProfile = null; + if (minimalProfileName != null) { + minimalProfile = StandardProfile.forName(minimalProfileName); + } + final Collection pc = new TreeSet(c); + final Object slk = sourceLevelModel.getSelectedItem(); + final SpecificationVersion sl; + if (slk instanceof SourceLevelKey) { + sl = ((SourceLevelKey)slk).getSourceLevel(); + } else { + sl = null; + } + for (StandardProfile p : StandardProfile.values()) { + if (minimalProfile != null && + c.compare(minimalProfile, selectedItem) > 0) { + continue; + } + if (sl != null && !p.isSupportedIn(sl)) { + continue; + } + pc.add(p); + } + if (selectedItem == null) { + if (initialProfileName != null && !initialProfileName.isEmpty()) { + selectedItem = StandardProfile.forName(initialProfileName); + if (selectedItem == null) { + selectedItem = new Profile() { + @Override + public String getName() { + return initialProfileName; + } + @Override + public String getDisplayName() { + return getName(); + } + @Override + public int getRank() { + return Integer.MAX_VALUE; + } + @Override + public boolean isSupportedIn(SpecificationVersion sourceLevel) { + return true; + } + }; + pc.add(selectedItem); + } + } else { + selectedItem = StandardProfile.DEFAULT; + } + } + this.profiles = pc.toArray(new Profile[pc.size()]); + } + return profiles; + } + } + + private static final class ProfileListCellRenderer implements ListCellRenderer { + + private final ListCellRenderer delegate; + + ProfileListCellRenderer() { + delegate = HtmlRenderer.createRenderer(); + } + + @Override + public Component getListCellRendererComponent( + @NonNull final JList list, + @NullAllowed Object value, + final int index, + final boolean isSelected, + final boolean cellHasFocus) { + if (value instanceof Profile) { + final Profile p = (Profile) value; + if (StandardProfile.forName(p.getName()) == null) { + value = "" + //NOI18N + p.getDisplayName(); + } else { + value = p.getDisplayName(); + } + } + return delegate.getListCellRendererComponent( + list, value, index, isSelected, cellHasFocus); + } + + } + /** * Retturns a {@link JavaPlatform} for given {@link PlatformKey} * or null when the platformKey is either null or not bound to a platform. diff --git a/java.j2seproject/nbproject/project.xml b/java.j2seproject/nbproject/project.xml --- a/java.j2seproject/nbproject/project.xml +++ b/java.j2seproject/nbproject/project.xml @@ -142,7 +142,7 @@ 0-1 - 1.37 + 1.45 diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties --- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties +++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties @@ -629,3 +629,6 @@ If selected, Additional Compiler Options are not used for running files or project. AddProcessorOption.valueTextField.text= TXT_CopyLibraries=Copy Dependent &Libraries +LBL_Profile=&Profile: +AN_Profile=Profile: +AD_Profile=JDK 8 Compact Profile diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.form b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.form --- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.form +++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.form @@ -1,4 +1,4 @@ - +
@@ -406,7 +406,7 @@ - + @@ -429,7 +429,7 @@ - + @@ -446,19 +446,67 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.java --- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.java +++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerSources.java @@ -58,6 +58,7 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.netbeans.modules.java.api.common.project.ui.customizer.SourceRootsUi; +import org.netbeans.modules.java.api.common.ui.PlatformUiSupport; import org.netbeans.spi.java.project.support.ui.IncludeExcludeVisualizer; import org.netbeans.spi.project.ui.support.ProjectCustomizer; import org.openide.DialogDescriptor; @@ -65,6 +66,7 @@ import org.openide.NotifyDescriptor; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.modules.SpecificationVersion; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; @@ -122,21 +124,28 @@ emTSR.setRelatedEditMediator( emSR ); this.sourceLevel.setEditable(false); this.sourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL); - this.sourceLevel.setRenderer(uiProperties.JAVAC_SOURCE_RENDERER); + this.sourceLevel.setRenderer(uiProperties.JAVAC_SOURCE_RENDERER); uiProperties.JAVAC_SOURCE_MODEL.addListDataListener(new ListDataListener () { public void intervalAdded(ListDataEvent e) { enableSourceLevel (); + enableProfiles(); } public void intervalRemoved(ListDataEvent e) { enableSourceLevel (); + enableProfiles(); } public void contentsChanged(ListDataEvent e) { enableSourceLevel (); + enableProfiles(); } }); + this.profile.setEditable(false); + this.profile.setModel(uiProperties.JAVAC_PROFILE_MODEL); + this.profile.setRenderer(uiProperties.JAVAC_PROFILE_RENDERER); enableSourceLevel (); + enableProfiles(); this.originalEncoding = this.uiProperties.getProject().evaluator().getProperty(J2SEProjectProperties.SOURCE_ENCODING); if (this.originalEncoding == null) { this.originalEncoding = Charset.defaultCharset().name(); @@ -245,6 +254,15 @@ private void enableSourceLevel () { this.sourceLevel.setEnabled(sourceLevel.getItemCount()>0); } + + private void enableProfiles() { + final Object si = this.sourceLevel.getSelectedItem(); + final boolean pe = si != null && + PlatformUiSupport.getSourceLevel(si) != null && + new SpecificationVersion("1.8").compareTo(PlatformUiSupport.getSourceLevel(si)) <= 0; //NOI18N + this.profile.setEnabled(pe); + this.jLabel6.setEnabled(pe); + } private static class ResizableRowHeightTable extends JTable { @@ -339,6 +357,8 @@ jLabel5 = new javax.swing.JLabel(); encoding = new javax.swing.JComboBox(); jPanel2 = new javax.swing.JPanel(); + jLabel6 = new javax.swing.JLabel(); + profile = new javax.swing.JComboBox(); setLayout(new java.awt.GridBagLayout()); @@ -610,6 +630,7 @@ } }); gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; jPanel1.add(includeExcludeButton, gridBagConstraints); includeExcludeButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_Include")); // NOI18N @@ -618,7 +639,7 @@ org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CustomizerSources.class, "TXT_Encoding")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; + gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; @@ -628,18 +649,41 @@ encoding.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridy = 2; gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); jPanel1.add(encoding, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; jPanel1.add(jPanel2, gridBagConstraints); + jLabel6.setLabelFor(profile); + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(CustomizerSources.class, "LBL_Profile")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.insets = new java.awt.Insets(4, 12, 0, 12); + jPanel1.add(jLabel6, gridBagConstraints); + jLabel6.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "LBL_Profile")); // NOI18N + + profile.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); + jPanel1.add(profile, gridBagConstraints); + profile.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AN_Profile")); // NOI18N + profile.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AD_Profile")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; @@ -675,10 +719,12 @@ private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JComboBox profile; private javax.swing.JTextField projectLocation; private javax.swing.JButton removeSourceRoot; private javax.swing.JButton removeTestRoot; diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java --- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java +++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java @@ -147,6 +147,7 @@ public static final String JAR_COMPRESS = "jar.compress"; // NOI18N public static final String JAVAC_SOURCE = "javac.source"; // NOI18N public static final String JAVAC_TARGET = "javac.target"; // NOI18N + public static final String JAVAC_PROFILE = "javac.profile"; // NOI18N public static final String JAVAC_DEBUG = "javac.debug"; // NOI18N public static final String JAVAC_DEPRECATION = "javac.deprecation"; // NOI18N public static final String JAVAC_COMPILER_ARG = "javac.compilerargs"; //NOI18N @@ -195,6 +196,7 @@ DefaultTableModel SOURCE_ROOTS_MODEL; DefaultTableModel TEST_ROOTS_MODEL; ComboBoxModel JAVAC_SOURCE_MODEL; + ComboBoxModel JAVAC_PROFILE_MODEL; // CustomizerLibraries DefaultListModel JAVAC_CLASSPATH_MODEL; @@ -207,6 +209,7 @@ ListCellRenderer CLASS_PATH_LIST_RENDERER; ListCellRenderer PLATFORM_LIST_RENDERER; ListCellRenderer JAVAC_SOURCE_RENDERER; + ListCellRenderer JAVAC_PROFILE_RENDERER; Document SHARED_LIBRARIES_MODEL; // CustomizerCompile @@ -325,6 +328,9 @@ PLATFORM_LIST_RENDERER = PlatformUiSupport.createPlatformListCellRenderer(); JAVAC_SOURCE_MODEL = PlatformUiSupport.createSourceLevelComboBoxModel (PLATFORM_MODEL, evaluator.getProperty(JAVAC_SOURCE), evaluator.getProperty(JAVAC_TARGET)); JAVAC_SOURCE_RENDERER = PlatformUiSupport.createSourceLevelListCellRenderer (); + JAVAC_PROFILE_MODEL = PlatformUiSupport.createProfileComboBoxModel(JAVAC_SOURCE_MODEL, evaluator.getProperty(JAVAC_PROFILE), null); + JAVAC_PROFILE_RENDERER = PlatformUiSupport.createProfileListCellRenderer(); + SHARED_LIBRARIES_MODEL = new PlainDocument(); try { SHARED_LIBRARIES_MODEL.insertString(0, project.getAntProjectHelper().getLibrariesLocation(), null); @@ -578,6 +584,7 @@ J2SEProject.PROJECT_CONFIGURATION_NAMESPACE, PLATFORM_MODEL.getSelectedItem(), JAVAC_SOURCE_MODEL.getSelectedItem(), + JAVAC_PROFILE_MODEL.getSelectedItem(), !isFXProject); // Handle other special cases