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 212540
Collapse All | Expand All

(-)a/j2ee.clientproject/nbproject/project.xml (-1 / +1 lines)
Lines 235-241 Link Here
235
                    <compile-dependency/>
235
                    <compile-dependency/>
236
                    <run-dependency>
236
                    <run-dependency>
237
                        <release-version>1</release-version>
237
                        <release-version>1</release-version>
238
                        <specification-version>1.41</specification-version>
238
                        <specification-version>1.46</specification-version>
239
                    </run-dependency>
239
                    </run-dependency>
240
                </dependency>
240
                </dependency>
241
                <dependency>
241
                <dependency>
(-)a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/api/AppClientProjectGenerator.java (-1 / +2 lines)
Lines 78-83 Link Here
78
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
78
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
79
import org.netbeans.modules.java.api.common.project.ProjectProperties;
79
import org.netbeans.modules.java.api.common.project.ProjectProperties;
80
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
80
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
81
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
81
import org.netbeans.spi.project.support.ant.AntProjectHelper;
82
import org.netbeans.spi.project.support.ant.AntProjectHelper;
82
import org.netbeans.spi.project.support.ant.EditableProperties;
83
import org.netbeans.spi.project.support.ant.EditableProperties;
83
import org.netbeans.spi.project.support.ant.ProjectGenerator;
84
import org.netbeans.spi.project.support.ant.ProjectGenerator;
Lines 788-794 Link Here
788
                                EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
789
                                EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
789
                                String finalPlatformName = platformName;
790
                                String finalPlatformName = platformName;
790
                                if (finalPlatformName == null) {
791
                                if (finalPlatformName == null) {
791
                                    finalPlatformName = JavaPlatformManager.getDefault().getDefaultPlatform().getDisplayName();
792
                                    finalPlatformName = PreferredProjectPlatform.getPreferredPlatform(JavaPlatform.getDefault().getSpecification().getName()).getDisplayName();
792
                                }
793
                                }
793
794
794
                                // #89131: these levels are not actually distinct from 1.5.
795
                                // #89131: these levels are not actually distinct from 1.5.
(-)a/j2ee.common/nbproject/project.xml (+1 lines)
Lines 227-232 Link Here
227
                    <compile-dependency/>
227
                    <compile-dependency/>
228
                    <run-dependency>
228
                    <run-dependency>
229
                        <release-version>1</release-version>
229
                        <release-version>1</release-version>
230
                        <specification-version>1.46</specification-version>
230
                    </run-dependency>
231
                    </run-dependency>
231
                </dependency>
232
                </dependency>
232
                <dependency>
233
                <dependency>
(-)a/j2ee.common/src/org/netbeans/modules/j2ee/common/project/ui/J2eeVersionWarningPanel.java (-4 / +19 lines)
Lines 44-53 Link Here
44
44
45
package org.netbeans.modules.j2ee.common.project.ui;
45
package org.netbeans.modules.j2ee.common.project.ui;
46
46
47
import org.netbeans.api.annotations.common.NullAllowed;
47
import org.netbeans.api.java.platform.JavaPlatform;
48
import org.netbeans.api.java.platform.JavaPlatform;
48
import org.netbeans.api.java.platform.JavaPlatformManager;
49
import org.netbeans.api.java.platform.JavaPlatformManager;
49
import org.netbeans.api.java.platform.Specification;
50
import org.netbeans.api.java.platform.Specification;
50
import org.netbeans.api.j2ee.core.Profile;
51
import org.netbeans.api.j2ee.core.Profile;
52
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
51
import org.openide.modules.SpecificationVersion;
53
import org.openide.modules.SpecificationVersion;
52
import org.openide.util.NbBundle;
54
import org.openide.util.NbBundle;
53
55
Lines 136-152 Link Here
136
    public String getSuggestedJavaPlatformName() {
138
    public String getSuggestedJavaPlatformName() {
137
        if (WARN_SET_JDK_14.equals(warningType) ) {
139
        if (WARN_SET_JDK_14.equals(warningType) ) {
138
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.4");
140
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.4");
139
            return javaPlatforms[0].getDisplayName();
141
            return getPreferredPlatform(javaPlatforms).getDisplayName();
140
        }
142
        }
141
        if (WARN_SET_JDK_15.equals(warningType) ) {
143
        if (WARN_SET_JDK_15.equals(warningType) ) {
142
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.5");
144
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.5");
143
            return javaPlatforms[0].getDisplayName();
145
            return getPreferredPlatform(javaPlatforms).getDisplayName();
144
        }
146
        }
145
        if (WARN_SET_JDK_6.equals(warningType) ) {
147
        if (WARN_SET_JDK_6.equals(warningType) ) {
146
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.6");
148
            JavaPlatform[] javaPlatforms = getJavaPlatforms("1.6");
147
            return javaPlatforms[0].getDisplayName();
149
            return getPreferredPlatform(javaPlatforms).getDisplayName();
148
        }
150
        }
149
        return null;
151
        return getPreferredPlatform(null).getDisplayName();
152
    }
153
    
154
    private static JavaPlatform getPreferredPlatform(@NullAllowed final JavaPlatform[] platforms) {
155
        final JavaPlatform pp = PreferredProjectPlatform.getPreferredPlatform(JavaPlatform.getDefault().getSpecification().getName());
156
        if (platforms == null) {
157
            return pp;
158
        }
159
        for (JavaPlatform jp : platforms) {
160
            if (jp.equals(pp)) {
161
                return jp;
162
            }
163
        }
164
        return platforms[0];
150
    }
165
    }
151
166
152
    public static String findWarningType(Profile j2eeProfile) {
167
    public static String findWarningType(Profile j2eeProfile) {
(-)a/j2ee.ejbjarproject/nbproject/project.xml (-1 / +1 lines)
Lines 272-278 Link Here
272
                    <compile-dependency/>
272
                    <compile-dependency/>
273
                    <run-dependency>
273
                    <run-dependency>
274
                        <release-version>1</release-version>
274
                        <release-version>1</release-version>
275
                        <specification-version>1.41</specification-version>
275
                        <specification-version>1.46</specification-version>
276
                    </run-dependency>
276
                    </run-dependency>
277
                </dependency>
277
                </dependency>
278
                <dependency>
278
                <dependency>
(-)a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/api/EjbJarProjectGenerator.java (-1 / +2 lines)
Lines 78-83 Link Here
78
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
78
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
79
import org.netbeans.modules.java.api.common.project.ProjectProperties;
79
import org.netbeans.modules.java.api.common.project.ProjectProperties;
80
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
80
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
81
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
81
import org.openide.filesystems.FileSystem;
82
import org.openide.filesystems.FileSystem;
82
import org.openide.filesystems.FileSystem.AtomicAction;
83
import org.openide.filesystems.FileSystem.AtomicAction;
83
import org.openide.modules.SpecificationVersion;
84
import org.openide.modules.SpecificationVersion;
Lines 662-668 Link Here
662
                                EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
663
                                EditableProperties ep = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
663
                                String finalPlatformName = platformName;
664
                                String finalPlatformName = platformName;
664
                                if (finalPlatformName == null) {
665
                                if (finalPlatformName == null) {
665
                                    finalPlatformName = JavaPlatformManager.getDefault().getDefaultPlatform().getDisplayName();
666
                                    finalPlatformName = PreferredProjectPlatform.getPreferredPlatform(JavaPlatform.getDefault().getSpecification().getName()).getDisplayName();
666
                                }
667
                                }
667
668
668
                                PlatformUiSupport.storePlatform(ep, updateHelper, EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, finalPlatformName, sourceLevel != null ? new SpecificationVersion(sourceLevel) : null);
669
                                PlatformUiSupport.storePlatform(ep, updateHelper, EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, finalPlatformName, sourceLevel != null ? new SpecificationVersion(sourceLevel) : null);
(-)a/java.api.common/apichanges.xml (+16 lines)
Lines 105-110 Link Here
105
105
106
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
    <!-- ACTUAL CHANGES BEGIN HERE: -->
107
    <changes>
107
    <changes>
108
        <change id="PlatformUiSupport-preferred-platform">
109
            <api name="java-api-common"/>
110
            <summary>Added <code>PlatformUiSupport.storePlatform</code> with <code>updatePreferredPlatform</code> parameter</summary>
111
            <version major="1" minor="37"/>
112
            <date day="20" month="5" year="2012"/>
113
            <author login="tzezula"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
                <p>
117
                    Added <code>PlatformUiSupport.storePlatform</code> with <code>updatePreferredPlatform</code> parameter allowing
118
                    the API clients to specify if the <code>PreferredProjectPlatform</code> should be updated.
119
                </p>
120
            </description>
121
            <class package="org.netbeans.modules.java.api.common.ui" name="PlatformUiSupport"/>
122
            <issue number="208528"/>
123
        </change>
108
        <change id="ant-hooks">
124
        <change id="ant-hooks">
109
            <api name="java-api-common"/>
125
            <api name="java-api-common"/>
110
            <summary>Added methods to track ant invocation</summary>
126
            <summary>Added methods to track ant invocation</summary>
(-)a/java.api.common/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.36
4
OpenIDE-Module-Specification-Version: 1.37
(-)a/java.api.common/nbproject/project.xml (-1 / +1 lines)
Lines 82-88 Link Here
82
                    <compile-dependency/>
82
                    <compile-dependency/>
83
                    <run-dependency>
83
                    <run-dependency>
84
                        <release-version>1</release-version>
84
                        <release-version>1</release-version>
85
                        <specification-version>1.13</specification-version>
85
                        <specification-version>1.46</specification-version>
86
                    </run-dependency>
86
                    </run-dependency>
87
                </dependency>
87
                </dependency>
88
                <dependency>
88
                <dependency>
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/ui/PlatformUiSupport.java (-3 / +33 lines)
Lines 56-65 Link Here
56
import javax.swing.*;
56
import javax.swing.*;
57
import javax.swing.event.ListDataEvent;
57
import javax.swing.event.ListDataEvent;
58
import javax.swing.event.ListDataListener;
58
import javax.swing.event.ListDataListener;
59
import org.netbeans.api.annotations.common.NonNull;
60
import org.netbeans.api.annotations.common.NullAllowed;
59
import org.netbeans.api.java.platform.JavaPlatform;
61
import org.netbeans.api.java.platform.JavaPlatform;
60
import org.netbeans.api.java.platform.JavaPlatformManager;
62
import org.netbeans.api.java.platform.JavaPlatformManager;
61
import org.netbeans.api.java.platform.Specification;
63
import org.netbeans.api.java.platform.Specification;
62
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
64
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
65
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
63
import org.netbeans.spi.project.support.ant.EditableProperties;
66
import org.netbeans.spi.project.support.ant.EditableProperties;
64
import org.openide.DialogDisplayer;
67
import org.openide.DialogDisplayer;
65
import org.openide.NotifyDescriptor;
68
import org.openide.NotifyDescriptor;
Lines 129-134 Link Here
129
        }
132
        }
130
        storePlatform(props, helper, projectConfigurationNamespace, platformKey, new SourceLevelKey(sourceLevel));
133
        storePlatform(props, helper, projectConfigurationNamespace, platformKey, new SourceLevelKey(sourceLevel));
131
    }
134
    }
135
    
136
    
137
    /**
138
     * Stores active platform, <i>javac.source</i> and <i>javac.target</i> into the project's metadata.
139
     * @param props project's shared properties
140
     * @param helper {@link UpdateHelper} that is capable to upgrade project metadata if needed.
141
     * @param projectConfigurationNamespace project configuration namespace.
142
     * @param platformKey the {@link PlatformKey} got from the platform model.
143
     * @param sourceLevelKey {@link SourceLevelKey} representing source level; can be <code>null</code>.
144
     */
145
    public static void storePlatform(
146
            @NonNull final EditableProperties props,
147
            @NonNull final UpdateHelper helper,
148
            @NonNull final String projectConfigurationNamespace,
149
            @NonNull final Object platformKey,
150
            @NullAllowed final Object sourceLevelKey) {
151
        storePlatform(props, helper, projectConfigurationNamespace, platformKey, sourceLevelKey, true);
152
    }
132
153
133
    /**
154
    /**
134
     * Stores active platform, <i>javac.source</i> and <i>javac.target</i> into the project's metadata.
155
     * Stores active platform, <i>javac.source</i> and <i>javac.target</i> into the project's metadata.
Lines 137-145 Link Here
137
     * @param projectConfigurationNamespace project configuration namespace.
158
     * @param projectConfigurationNamespace project configuration namespace.
138
     * @param platformKey the {@link PlatformKey} got from the platform model.
159
     * @param platformKey the {@link PlatformKey} got from the platform model.
139
     * @param sourceLevelKey {@link SourceLevelKey} representing source level; can be <code>null</code>.
160
     * @param sourceLevelKey {@link SourceLevelKey} representing source level; can be <code>null</code>.
161
     * @param updatePreferredPlatform if true the {@link PreferredProjectPlatform} will be updated
162
     * @since 1.37
140
     */
163
     */
141
    public static void storePlatform(EditableProperties props, UpdateHelper helper,
164
    public static void storePlatform(
142
            String projectConfigurationNamespace, Object platformKey, Object sourceLevelKey) {
165
            @NonNull final EditableProperties props,
166
            @NonNull final UpdateHelper helper,
167
            @NonNull final String projectConfigurationNamespace,
168
            @NonNull final Object platformKey,
169
            @NullAllowed final Object sourceLevelKey,
170
            final boolean updatePreferredPlatform) {
143
        Parameters.notNull("props", props); //NOI18N
171
        Parameters.notNull("props", props); //NOI18N
144
        Parameters.notNull("helper", helper); //NOI18N
172
        Parameters.notNull("helper", helper); //NOI18N
145
        Parameters.notNull("projectConfigurationNamespace", projectConfigurationNamespace); //NOI18N
173
        Parameters.notNull("projectConfigurationNamespace", projectConfigurationNamespace); //NOI18N
Lines 157-163 Link Here
157
        if (platform == null) {
185
        if (platform == null) {
158
            return;
186
            return;
159
        }
187
        }
160
188
        if (updatePreferredPlatform) {
189
            PreferredProjectPlatform.setPreferredPlatform(platform);
190
        }
161
        SpecificationVersion jdk13 = new SpecificationVersion("1.3"); //NOI18N
191
        SpecificationVersion jdk13 = new SpecificationVersion("1.3"); //NOI18N
162
        String platformAntName = platform.getProperties().get("platform.ant.name"); //NOI18N
192
        String platformAntName = platform.getProperties().get("platform.ant.name"); //NOI18N
163
        assert platformAntName != null;
193
        assert platformAntName != null;
(-)a/java.j2seproject/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
javac.compilerargs=-Xlint -Xlint:-serial
43
javac.compilerargs=-Xlint -Xlint:-serial
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=1.52.0
45
spec.version.base=1.53.0
46
46
47
javadoc.arch=${basedir}/arch.xml
47
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
(-)a/java.j2seproject/nbproject/project.xml (-2 / +2 lines)
Lines 142-148 Link Here
142
                    <compile-dependency/>
142
                    <compile-dependency/>
143
                    <run-dependency>
143
                    <run-dependency>
144
                        <release-version>0-1</release-version>
144
                        <release-version>0-1</release-version>
145
                        <specification-version>1.35</specification-version>
145
                        <specification-version>1.37</specification-version>
146
                    </run-dependency>
146
                    </run-dependency>
147
                </dependency>
147
                </dependency>
148
                <dependency>
148
                <dependency>
Lines 159-165 Link Here
159
                    <compile-dependency/>
159
                    <compile-dependency/>
160
                    <run-dependency>
160
                    <run-dependency>
161
                        <release-version>1</release-version>
161
                        <release-version>1</release-version>
162
                        <specification-version>1.41</specification-version>
162
                        <specification-version>1.46</specification-version>
163
                    </run-dependency>
163
                    </run-dependency>
164
                </dependency>
164
                </dependency>
165
                <dependency>
165
                <dependency>
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProjectGenerator.java (+10 lines)
Lines 46-52 Link Here
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.io.IOException;
48
import java.io.IOException;
49
import org.netbeans.api.java.platform.JavaPlatform;
50
import org.netbeans.api.java.platform.JavaPlatformManager;
49
import org.netbeans.modules.java.j2seproject.api.J2SEProjectBuilder;
51
import org.netbeans.modules.java.j2seproject.api.J2SEProjectBuilder;
52
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
50
import org.netbeans.spi.project.support.ant.AntProjectHelper;
53
import org.netbeans.spi.project.support.ant.AntProjectHelper;
51
import org.openide.modules.SpecificationVersion;
54
import org.openide.modules.SpecificationVersion;
52
import org.openide.util.Parameters;
55
import org.openide.util.Parameters;
Lines 77-82 Link Here
77
                setManifest(manifestFile).
80
                setManifest(manifestFile).
78
                setLibrariesDefinitionFile(librariesDefinition).
81
                setLibrariesDefinitionFile(librariesDefinition).
79
                setSourceLevel(defaultSourceLevel).
82
                setSourceLevel(defaultSourceLevel).
83
                setJavaPlatform(getPlatform()).
80
                build();
84
                build();
81
    }
85
    }
82
86
Lines 96-103 Link Here
96
                setLibrariesDefinitionFile(librariesDefinition).
100
                setLibrariesDefinitionFile(librariesDefinition).
97
                setBuildXmlName(buildXmlName).
101
                setBuildXmlName(buildXmlName).
98
                setSourceLevel(defaultSourceLevel).
102
                setSourceLevel(defaultSourceLevel).
103
                setJavaPlatform(getPlatform()).
99
                build();
104
                build();
100
    }
105
    }
106
    
107
    private static JavaPlatform getPlatform() {
108
        return PreferredProjectPlatform.getPreferredPlatform(
109
            JavaPlatformManager.getDefault().getDefaultPlatform().getSpecification().getName());
110
    }
101
                    
111
                    
102
    //------------ Used by unit tests -------------------
112
    //------------ Used by unit tests -------------------
103
    private static SpecificationVersion defaultSourceLevel;
113
    private static SpecificationVersion defaultSourceLevel;
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SEProjectBuilder.java (-8 / +37 lines)
Lines 99-105 Link Here
99
 * @author Tomas Zezula
99
 * @author Tomas Zezula
100
 * @since 1.42
100
 * @since 1.42
101
 */
101
 */
102
public class J2SEProjectBuilder {   
102
public class J2SEProjectBuilder {
103
    
104
    private static final String PLATFORM_ANT_NAME = "platform.ant.name";    //NOI18N
105
    private static final String DEFAULT_PLATFORM_ID = "default_platform";   //NOI18N
103
    
106
    
104
    private final File projectDirectory;
107
    private final File projectDirectory;
105
    private final String name;
108
    private final String name;
Lines 118-123 Link Here
118
    private String buildXmlName;
121
    private String buildXmlName;
119
    private String distFolder;
122
    private String distFolder;
120
    private String mainClassTemplate;
123
    private String mainClassTemplate;
124
    private JavaPlatform platform;
121
    
125
    
122
    /**
126
    /**
123
     * Creates a new instance of {@link J2SEProjectBuilder}
127
     * Creates a new instance of {@link J2SEProjectBuilder}
Lines 136-141 Link Here
136
        this.jvmArgs = new StringBuilder();
140
        this.jvmArgs = new StringBuilder();
137
        this.compileLibraries = new ArrayList<Library>();
141
        this.compileLibraries = new ArrayList<Library>();
138
        this.runtimeLibraries = new ArrayList<Library>();
142
        this.runtimeLibraries = new ArrayList<Library>();
143
        this.platform = JavaPlatformManager.getDefault().getDefaultPlatform();
139
    }
144
    }
140
    
145
    
141
    /**
146
    /**
Lines 295-300 Link Here
295
    }
300
    }
296
    
301
    
297
    /**
302
    /**
303
     * Sets a platform to be used for a new project
304
     * @param platform to be used
305
     * @return the builder
306
     * @since 1.53
307
     */
308
    public J2SEProjectBuilder setJavaPlatform (@NonNull final JavaPlatform platform) {
309
        Parameters.notNull("platform", platform);
310
        if (platform.getProperties().get(PLATFORM_ANT_NAME) == null) {
311
            throw new IllegalArgumentException("Invalid platform, the platform has no platform.ant.name");  //NOI18N
312
        }
313
        this.platform = platform;
314
        return this;
315
    }
316
    
317
    /**
298
     * Creates the J2SEProject
318
     * Creates the J2SEProject
299
     * @return the {@link AntProjectHelper} of the created project
319
     * @return the {@link AntProjectHelper} of the created project
300
     * @throws IOException when creation fails
320
     * @throws IOException when creation fails
Lines 305-311 Link Here
305
        dirFO.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
325
        dirFO.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() {
306
            @Override
326
            @Override
307
            public void run() throws IOException {
327
            public void run() throws IOException {
308
                final SpecificationVersion sourceLevel = getDefaultSourceLevel();
328
                final SpecificationVersion sourceLevel = getSourceLevel();
309
                h[0] = createProject(
329
                h[0] = createProject(
310
                        dirFO,
330
                        dirFO,
311
                        name, 
331
                        name, 
Lines 321-327 Link Here
321
                        librariesDefinition,
341
                        librariesDefinition,
322
                        jvmArgs.toString(),
342
                        jvmArgs.toString(),
323
                        toClassPathElements(compileLibraries),
343
                        toClassPathElements(compileLibraries),
324
                        toClassPathElements(runtimeLibraries, "${javac.classpath}:", "${build.classes.dir}"));   //NOI18N
344
                        toClassPathElements(runtimeLibraries, "${javac.classpath}:", "${build.classes.dir}"),
345
                        platform.getProperties().get(PLATFORM_ANT_NAME));   //NOI18N
325
                final J2SEProject p = (J2SEProject) ProjectManager.getDefault().findProject(dirFO);
346
                final J2SEProject p = (J2SEProject) ProjectManager.getDefault().findProject(dirFO);
326
                ProjectManager.getDefault().saveProject(p);
347
                ProjectManager.getDefault().saveProject(p);
327
                final ReferenceHelper refHelper = p.getReferenceHelper();
348
                final ReferenceHelper refHelper = p.getReferenceHelper();
Lines 377-383 Link Here
377
            String librariesDefinition,
398
            String librariesDefinition,
378
            String jvmArgs,
399
            String jvmArgs,
379
            String[] compileClassPath,
400
            String[] compileClassPath,
380
            String[] runtimeClassPath) throws IOException {
401
            String[] runtimeClassPath,
402
            @NonNull final String platformId
403
            ) throws IOException {
381
        
404
        
382
        AntProjectHelper h = ProjectGenerator.createProject(dirFO, J2SEProject.TYPE, librariesDefinition);
405
        AntProjectHelper h = ProjectGenerator.createProject(dirFO, J2SEProject.TYPE, librariesDefinition);
383
        Element data = h.getPrimaryConfigurationData(true);
406
        Element data = h.getPrimaryConfigurationData(true);
Lines 386-391 Link Here
386
        nameEl.appendChild(doc.createTextNode(name));
409
        nameEl.appendChild(doc.createTextNode(name));
387
        data.appendChild(nameEl);
410
        data.appendChild(nameEl);
388
        EditableProperties ep = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
411
        EditableProperties ep = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
412
        if (!DEFAULT_PLATFORM_ID.equals(platformId)) {
413
            final Element platformEl = doc.createElementNS(J2SEProject.PROJECT_CONFIGURATION_NAMESPACE, "explicit-platform");   //NOI18N
414
            final SpecificationVersion jdk13 = new SpecificationVersion("1.3");     //NOI18N
415
            final boolean supportsExplicitSource = jdk13.compareTo(sourceLevel) < 0;
416
            platformEl.setAttribute("explicit-source-supported", Boolean.toString(supportsExplicitSource)); //NOI18N
417
            data.appendChild(platformEl);
418
        }
389
        Element sourceRoots = doc.createElementNS(J2SEProject.PROJECT_CONFIGURATION_NAMESPACE,"source-roots");  //NOI18N
419
        Element sourceRoots = doc.createElementNS(J2SEProject.PROJECT_CONFIGURATION_NAMESPACE,"source-roots");  //NOI18N
390
        if (srcRoot != null) {
420
        if (srcRoot != null) {
391
            Element root = doc.createElementNS (J2SEProject.PROJECT_CONFIGURATION_NAMESPACE,"root");   //NOI18N
421
            Element root = doc.createElementNS (J2SEProject.PROJECT_CONFIGURATION_NAMESPACE,"root");   //NOI18N
Lines 467-473 Link Here
467
        ep.setProperty("build.test.results.dir", "${build.dir}/test/results"); // NOI18N
497
        ep.setProperty("build.test.results.dir", "${build.dir}/test/results"); // NOI18N
468
        ep.setProperty("build.classes.excludes", "**/*.java,**/*.form"); // NOI18N
498
        ep.setProperty("build.classes.excludes", "**/*.java,**/*.form"); // NOI18N
469
        ep.setProperty("dist.javadoc.dir", "${dist.dir}/javadoc"); // NOI18N
499
        ep.setProperty("dist.javadoc.dir", "${dist.dir}/javadoc"); // NOI18N
470
        ep.setProperty("platform.active", "default_platform"); // NOI18N
500
        ep.setProperty("platform.active", platformId); // NOI18N
471
501
472
        ep.setProperty(ProjectProperties.RUN_JVM_ARGS, jvmArgs); // NOI18N
502
        ep.setProperty(ProjectProperties.RUN_JVM_ARGS, jvmArgs); // NOI18N
473
        ep.setComment(ProjectProperties.RUN_JVM_ARGS, new String[] {
503
        ep.setComment(ProjectProperties.RUN_JVM_ARGS, new String[] {
Lines 559-570 Link Here
559
        Logger.getLogger(loggerName).log(logRecord);
589
        Logger.getLogger(loggerName).log(logRecord);
560
    }
590
    }
561
591
562
    private SpecificationVersion getDefaultSourceLevel () {
592
    private SpecificationVersion getSourceLevel () {
563
        if (defaultSourceLevel != null) {
593
        if (defaultSourceLevel != null) {
564
            return defaultSourceLevel;
594
            return defaultSourceLevel;
565
        } else {
595
        } else {
566
            final JavaPlatform defaultPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
596
            final SpecificationVersion v = platform.getSpecification().getVersion();
567
            final SpecificationVersion v = defaultPlatform.getSpecification().getVersion();
568
            return v;
597
            return v;
569
        }
598
        }
570
    }
599
    }
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/J2SEProjectProperties.java (-2 / +9 lines)
Lines 540-546 Link Here
540
        projectGroup.store( projectProperties );        
540
        projectGroup.store( projectProperties );        
541
        privateGroup.store( privateProperties );
541
        privateGroup.store( privateProperties );
542
        
542
        
543
        if(!isFXProject()) {
543
        final boolean isFXProject = isFXProject();
544
        if(!isFXProject) {
544
            storeRunConfigs(RUN_CONFIGS, projectProperties, privateProperties);
545
            storeRunConfigs(RUN_CONFIGS, projectProperties, privateProperties);
545
            EditableProperties ep = updateHelper.getProperties("nbproject/private/config.properties");
546
            EditableProperties ep = updateHelper.getProperties("nbproject/private/config.properties");
546
            if (activeConfig == null) {
547
            if (activeConfig == null) {
Lines 571-577 Link Here
571
        projectProperties.setProperty( ProjectProperties.ENDORSED_CLASSPATH, endorsed_cp );
572
        projectProperties.setProperty( ProjectProperties.ENDORSED_CLASSPATH, endorsed_cp );
572
        
573
        
573
        //Handle platform selection and javac.source javac.target properties
574
        //Handle platform selection and javac.source javac.target properties
574
        PlatformUiSupport.storePlatform (projectProperties, updateHelper, J2SEProject.PROJECT_CONFIGURATION_NAMESPACE, PLATFORM_MODEL.getSelectedItem(), JAVAC_SOURCE_MODEL.getSelectedItem());
575
        PlatformUiSupport.storePlatform (
576
                projectProperties,
577
                updateHelper,
578
                J2SEProject.PROJECT_CONFIGURATION_NAMESPACE,
579
                PLATFORM_MODEL.getSelectedItem(),
580
                JAVAC_SOURCE_MODEL.getSelectedItem(),
581
                !isFXProject);
575
                                
582
                                
576
        // Handle other special cases
583
        // Handle other special cases
577
        if ( NO_DEPENDENCIES_MODEL.isSelected() ) { // NOI18N
584
        if ( NO_DEPENDENCIES_MODEL.isSelected() ) { // NOI18N
(-)a/java.project/apichanges.xml (+16 lines)
Lines 109-114 Link Here
109
    <!-- ACTUAL CHANGES BEGIN HERE: -->
109
    <!-- ACTUAL CHANGES BEGIN HERE: -->
110
110
111
    <changes>
111
    <changes>
112
        <change id="PreferredProjectPlatform">
113
            <api name="general"/>
114
            <summary>Added <code>PreferredProjectPlatform</code></summary>
115
            <version major="1" minor="46"/>
116
            <date day="20" month="5" year="2012"/>
117
            <author login="tzezula"/>
118
            <compatibility addition="yes"/>
119
            <description>
120
                <p>
121
                    Added <code>PreferredProjectPlatform</code> to provide a 
122
                    <code>JavaPlatform</code> which should be used for a new project.
123
                </p>
124
            </description>
125
            <class package="org.netbeans.spi.java.project.support" name="PreferredProjectPlatform"/>
126
            <issue number="208528"/>
127
        </change>
112
        <change id="ProfilerActions">
128
        <change id="ProfilerActions">
113
            <api name="general"/>
129
            <api name="general"/>
114
            <summary>Added 
130
            <summary>Added 
(-)a/java.project/manifest.mf (-1 / +1 lines)
Lines 3-9 Link Here
3
OpenIDE-Module-Layer: org/netbeans/modules/java/project/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/java/project/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/project/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/project/Bundle.properties
5
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
5
OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker
6
OpenIDE-Module-Specification-Version: 1.45
6
OpenIDE-Module-Specification-Version: 1.46
7
OpenIDE-Module-Recommends: org.netbeans.spi.java.project.runner.JavaRunnerImplementation
7
OpenIDE-Module-Recommends: org.netbeans.spi.java.project.runner.JavaRunnerImplementation
8
AutoUpdate-Show-In-Client: false
8
AutoUpdate-Show-In-Client: false
9
9
(-)a/java.project/src/org/netbeans/spi/java/project/support/PreferredProjectPlatform.java (+108 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.spi.java.project.support;
43
44
import java.text.MessageFormat;
45
import org.netbeans.api.annotations.common.CheckForNull;
46
import org.netbeans.api.annotations.common.NonNull;
47
import org.netbeans.api.java.platform.JavaPlatform;
48
import org.netbeans.api.java.platform.JavaPlatformManager;
49
import org.netbeans.api.java.platform.Specification;
50
import org.openide.util.NbPreferences;
51
import org.openide.util.Parameters;
52
53
/**
54
 * Returns a preferred {@link JavaPlatform} for a new project.
55
 * @author Tomas Zezula
56
 * @since 1.46
57
 */
58
public final  class PreferredProjectPlatform {
59
    
60
    private static final String PREFERRED_PLATFORM = "preferred.platform.{0}";  //NOI18N
61
    private static final String PLATFORM_ANT_NAME = "platform.ant.name";    //NOI18N
62
    
63
    private PreferredProjectPlatform() {
64
        throw new AssertionError();
65
    }
66
    
67
    /**
68
     * Returns a preferred {@link JavaPlatform} for a new project.
69
     * @param platformType the platform type as specified by {@link Specification#getName()}
70
     * @return the preferred {@link JavaPlatform}
71
     */
72
    @CheckForNull
73
    public static JavaPlatform getPreferredPlatform(@NonNull final String platformType) {
74
        Parameters.notNull("platformType", platformType);   //NOI18N
75
        final String platformId = NbPreferences.forModule(PreferredProjectPlatform.class).get(
76
                MessageFormat.format(PREFERRED_PLATFORM, platformType),
77
                null);
78
        final JavaPlatformManager jpm = JavaPlatformManager.getDefault();
79
        if (platformId != null) {
80
            for (JavaPlatform jp : jpm.getInstalledPlatforms()) {
81
                if (platformId.equals(jp.getProperties().get(PLATFORM_ANT_NAME)) &&
82
                    platformType.equals(jp.getSpecification().getName())) {
83
                    return jp;
84
                }
85
            }
86
        }
87
        final JavaPlatform defaultPlatform = jpm.getDefaultPlatform();
88
        return platformType.equals(defaultPlatform.getSpecification().getName())?
89
               defaultPlatform:
90
               null;
91
    }
92
    
93
    /**
94
     * Sets a preferred {@link JavaPlatform} for a new project.
95
     * @param platform the preferred {@link JavaPlatform}
96
     */
97
    public static void setPreferredPlatform(@NonNull final JavaPlatform platform) {
98
        Parameters.notNull("platform", platform);   //NOI18N
99
        final String platformId = platform.getProperties().get(PLATFORM_ANT_NAME);
100
        if (platformId == null) {
101
            throw new IllegalArgumentException("Invalid platform, the platform has no platform.ant.name");  //NOI18N
102
        }
103
        final String platformType = platform.getSpecification().getName();
104
        NbPreferences.forModule(PreferredProjectPlatform.class).put(
105
                MessageFormat.format(PREFERRED_PLATFORM, platformType),
106
                platformId);
107
    }
108
}
(-)a/java.project/test/unit/src/org/netbeans/spi/java/project/support/PreferredProjectPlatformTest.java (+214 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.spi.java.project.support;
43
44
import java.beans.PropertyChangeListener;
45
import java.net.URL;
46
import java.util.Collection;
47
import java.util.Collections;
48
import java.util.HashMap;
49
import java.util.List;
50
import java.util.Map;
51
import org.netbeans.api.annotations.common.NonNull;
52
import org.netbeans.api.java.classpath.ClassPath;
53
import org.netbeans.api.java.platform.JavaPlatform;
54
import org.netbeans.api.java.platform.JavaPlatformManager;
55
import org.netbeans.api.java.platform.Specification;
56
import org.netbeans.junit.MockServices;
57
import org.netbeans.junit.NbTestCase;
58
import org.netbeans.modules.java.platform.JavaPlatformProvider;
59
import org.openide.filesystems.FileObject;
60
import org.openide.modules.SpecificationVersion;
61
62
63
/**
64
 *
65
 * @author Tomas Zezula
66
 */
67
public class PreferredProjectPlatformTest extends NbTestCase {
68
    
69
    private static final String J2SE = "j2se";  //NOI18N
70
    private static final String J2ME = "j2me";  //NOI18N
71
    
72
    public PreferredProjectPlatformTest(final String name) {
73
        super(name);
74
    }
75
76
    @Override
77
    protected void setUp() throws Exception {
78
        super.setUp();
79
        MockServices.setServices(MockJavaPlatformProvider.class);
80
    }
81
    
82
83
    public void testPreferredPlatforms() {
84
        final JavaPlatform defaultPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
85
        final JavaPlatform[] javaPlatforms = JavaPlatformManager.getDefault().getInstalledPlatforms();
86
        final JavaPlatform[] nonDefaultJ2SEPlatforms = new JavaPlatform[javaPlatforms.length - 2];
87
        JavaPlatform j2mePlatform = null;
88
        for (int i = 0, j = 0; i < javaPlatforms.length; i++ ) {
89
            if (!javaPlatforms[i].equals(defaultPlatform) &&
90
                J2SE.equals(javaPlatforms[i].getSpecification().getName())) {
91
                nonDefaultJ2SEPlatforms[j++] = javaPlatforms[i];
92
            }
93
            if (J2ME.equals(javaPlatforms[i].getSpecification().getName())) {
94
                j2mePlatform = javaPlatforms[i];
95
            }
96
        }
97
        assertEquals(defaultPlatform, PreferredProjectPlatform.getPreferredPlatform(J2SE));
98
        PreferredProjectPlatform.setPreferredPlatform(nonDefaultJ2SEPlatforms[0]);
99
        assertEquals(nonDefaultJ2SEPlatforms[0], PreferredProjectPlatform.getPreferredPlatform(J2SE));
100
        PreferredProjectPlatform.setPreferredPlatform(nonDefaultJ2SEPlatforms[1]);
101
        assertEquals(nonDefaultJ2SEPlatforms[1], PreferredProjectPlatform.getPreferredPlatform(J2SE));
102
        PreferredProjectPlatform.setPreferredPlatform(defaultPlatform);
103
        assertEquals(defaultPlatform, PreferredProjectPlatform.getPreferredPlatform(J2SE));
104
        assertNull(PreferredProjectPlatform.getPreferredPlatform(J2ME));
105
        PreferredProjectPlatform.setPreferredPlatform(j2mePlatform);
106
        assertEquals(j2mePlatform, PreferredProjectPlatform.getPreferredPlatform(J2ME));
107
    }
108
    
109
    
110
    public static final class MockJavaPlatformProvider implements JavaPlatformProvider {
111
        
112
        private final JavaPlatform[] platforms;
113
114
        public MockJavaPlatformProvider() {
115
            this.platforms = new JavaPlatform[4];
116
            this.platforms[0] = new MockJavaPlatform("default_platform", J2SE);       //NOI18N
117
            this.platforms[1] = new MockJavaPlatform("nondefault_platform_1", J2SE);  //NOI18N
118
            this.platforms[2] = new MockJavaPlatform("nondefault_platform_2", J2SE);  //NOI18N
119
            this.platforms[3] = new MockJavaPlatform("j2me_platform", J2ME);  //NOI18N
120
        }
121
122
        @Override
123
        public JavaPlatform[] getInstalledPlatforms() {
124
            return platforms;
125
        }
126
127
        @Override
128
        public JavaPlatform getDefaultPlatform() {
129
            return platforms[0];
130
        }
131
132
        @Override
133
        public void addPropertyChangeListener(PropertyChangeListener listener) {
134
        }
135
136
        @Override
137
        public void removePropertyChangeListener(PropertyChangeListener listener) {
138
        }
139
        
140
    }
141
    
142
    private static final class MockJavaPlatform extends JavaPlatform {
143
        
144
        private final String displayName;
145
        private final String platformType;
146
        private final Map<String,String> props;
147
        
148
        MockJavaPlatform(
149
                @NonNull final String name,
150
                @NonNull final String platformType) {
151
            super();
152
            this.displayName = name;
153
            this.props = new HashMap<String, String>();
154
            this.props.put("platform.ant.name",name);                   //NOI18N
155
            this.platformType = platformType;
156
        }
157
158
        @Override
159
        public String getDisplayName() {
160
            return displayName;
161
        }
162
163
        @Override
164
        public Map<String, String> getProperties() {
165
            return props;
166
        }
167
168
        @Override
169
        public ClassPath getBootstrapLibraries() {
170
            return ClassPath.EMPTY;
171
        }
172
173
        @Override
174
        public ClassPath getStandardLibraries() {
175
            return ClassPath.EMPTY;
176
        }
177
178
        @Override
179
        public String getVendor() {
180
            return "me";    //NOI18N
181
        }
182
183
        @Override
184
        public Specification getSpecification() {
185
            return new Specification(platformType, new SpecificationVersion("1.6"));  //NOI18N
186
        }
187
188
        @Override
189
        public Collection<FileObject> getInstallFolders() {
190
            return Collections.<FileObject>emptySet();
191
        }
192
193
        @Override
194
        public FileObject findTool(String toolName) {
195
            return null;
196
        }
197
198
        @Override
199
        public ClassPath getSourceFolders() {
200
            return ClassPath.EMPTY;
201
        }
202
203
        @Override
204
        public List<URL> getJavadocFolders() {
205
            return Collections.<URL>emptyList();
206
        }
207
208
        @Override
209
        public String toString() {
210
            return displayName;
211
        }
212
        
213
    }
214
}
(-)a/web.project/nbproject/project.xml (-1 / +1 lines)
Lines 266-272 Link Here
266
                    <compile-dependency/>
266
                    <compile-dependency/>
267
                    <run-dependency>
267
                    <run-dependency>
268
                        <release-version>1</release-version>
268
                        <release-version>1</release-version>
269
                        <specification-version>1.41</specification-version>
269
                        <specification-version>1.46</specification-version>
270
                    </run-dependency>
270
                    </run-dependency>
271
                </dependency>
271
                </dependency>
272
                <dependency>
272
                <dependency>
(-)a/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java (+5 lines)
Lines 101-112 Link Here
101
import org.netbeans.modules.j2ee.dd.api.web.WelcomeFileList;
101
import org.netbeans.modules.j2ee.dd.api.web.WelcomeFileList;
102
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
102
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
103
import org.netbeans.api.j2ee.core.Profile;
103
import org.netbeans.api.j2ee.core.Profile;
104
import org.netbeans.api.java.platform.JavaPlatform;
104
import org.netbeans.modules.j2ee.common.project.ui.DeployOnSaveUtils;
105
import org.netbeans.modules.j2ee.common.project.ui.DeployOnSaveUtils;
105
import org.netbeans.modules.j2ee.common.project.ui.J2EEProjectProperties;
106
import org.netbeans.modules.j2ee.common.project.ui.J2EEProjectProperties;
106
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
107
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
107
import org.netbeans.modules.java.api.common.project.ProjectProperties;
108
import org.netbeans.modules.java.api.common.project.ProjectProperties;
108
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
109
import org.netbeans.modules.java.api.common.ui.PlatformUiSupport;
109
import org.netbeans.modules.websvc.spi.webservices.WebServicesConstants;
110
import org.netbeans.modules.websvc.spi.webservices.WebServicesConstants;
111
import org.netbeans.spi.java.project.support.PreferredProjectPlatform;
110
import org.openide.filesystems.URLMapper;
112
import org.openide.filesystems.URLMapper;
111
import org.openide.loaders.DataFolder;
113
import org.openide.loaders.DataFolder;
112
import org.openide.loaders.DataObject;
114
import org.openide.loaders.DataObject;
Lines 209-214 Link Here
209
        assert sourceStructure != null: "Source structure can't be null"; //NOI18N
211
        assert sourceStructure != null: "Source structure can't be null"; //NOI18N
210
        assert j2eeProfile != null: "Java EE version can't be null"; //NOI18N
212
        assert j2eeProfile != null: "Java EE version can't be null"; //NOI18N
211
        
213
        
214
        if (javaPlatformName == null) {
215
            javaPlatformName = PreferredProjectPlatform.getPreferredPlatform(JavaPlatform.getDefault().getSpecification().getName()).getDisplayName();
216
        }
212
        final boolean createBluePrintsStruct = SRC_STRUCT_BLUEPRINTS.equals(sourceStructure);
217
        final boolean createBluePrintsStruct = SRC_STRUCT_BLUEPRINTS.equals(sourceStructure);
213
        final boolean createJakartaStructure = SRC_STRUCT_JAKARTA.equals(sourceStructure);
218
        final boolean createJakartaStructure = SRC_STRUCT_JAKARTA.equals(sourceStructure);
214
219

Return to bug 212540