Package org.netbeans.api.java.platform

Examples of org.netbeans.api.java.platform.JavaPlatform


        librariesBrowse.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerLibraries.class, "ACSD_librariesBrowse")); // NOI18N
    }// </editor-fold>//GEN-END:initComponents

    private void createNewPlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createNewPlatform
        Object selectedItem = this.jComboBoxTarget.getSelectedItem();
        JavaPlatform jp = (selectedItem == null ? null : PlatformUiSupport.getPlatform(selectedItem));
        PlatformsCustomizer.showCustomizer(jp);       
    }//GEN-LAST:event_createNewPlatform
View Full Code Here


                return this.resourcesCache;
            }
            currentId = eventId;
        }
       
        JavaPlatform jp = findActivePlatform ();
        final List<PathResourceImplementation> result = new ArrayList<PathResourceImplementation>();
        if (jp != null) {
            //TODO: May also listen on CP, but from Platform it should be fixed.           
            final ClassPath cp = jp.getBootstrapLibraries();
            assert cp != null : jp;
            for (ClassPath.Entry entry : cp.entries()) {
                result.add(ClassPathSupport.createResource(entry.getURL()));
            }
        }
View Full Code Here

        if (this.platformManager == null) {
            this.platformManager = JavaPlatformManager.getDefault();
            this.platformManager.addPropertyChangeListener(WeakListeners.propertyChange(this, this.platformManager));
        }               
        this.activePlatformName = evaluator.getProperty(PLATFORM_ACTIVE);
        final JavaPlatform activePlatform = platformManager.getDefaultPlatform();
        //final JavaPlatform activePlatform = J2SEProjectUtil.getActivePlatform (this.activePlatformName);
        this.isActivePlatformValid = activePlatform != null;
        return activePlatform;
    }
View Full Code Here

            cp = Util.createClassPath(pathSpec);

            /**
             * @todo how to deal with project's custom java platform ?
             */
            JavaPlatform javaPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
            if (javaPlatform != null) {
                ClassPath javaBootstrap = javaPlatform.getBootstrapLibraries();
                List<ClassPath.Entry> entries = javaBootstrap.entries();
                URL[] urls = new URL[entries.size() + 1];
                for (int i = 0; i < entries.size(); i++) {
                    urls[i] = entries.get(i).getURL();
                }
View Full Code Here

    private static SpecificationVersion getDefaultSourceLevel () {
        if (defaultSourceLevel != null) {
            return defaultSourceLevel;
        }
        else {
            JavaPlatform defaultPlatform = JavaPlatformManager.getDefault().getDefaultPlatform();
            SpecificationVersion v = defaultPlatform.getSpecification().getVersion();
            if (v.equals(new SpecificationVersion("1.6")) || v.equals(new SpecificationVersion("1.7"))) {
                // #89131: these levels are not actually distinct from 1.5. - xxx not true, but may be acceptable to have 1.5 as default
                return new SpecificationVersion("1.5");
            } else {
                return v;
View Full Code Here

            //No need to check anything
            return false;
        }
       
        final String platformId = this.evaluator.getProperty("platform.active")//NOI18N
        final JavaPlatform activePlatform = J2SEProjectUtil.getJavaActivePlatform (platformId);
        if (activePlatform == null) {
            return true;
        }       
        SpecificationVersion platformVersion = activePlatform.getSpecification().getVersion();
        try {
            return (javaSource != null && new SpecificationVersion (javaSource).compareTo(platformVersion)>0)
                   || (javaTarget != null && new SpecificationVersion (javaTarget).compareTo(platformVersion)>0);
        } catch (NumberFormatException nfe) {
            ErrorManager.getDefault().log("Invalid javac.source: "+javaSource+" or javac.target: "+javaTarget+" of project:"
View Full Code Here

        return installFolders.iterator().next();
    }

    public static FileObject getCurrentGradleJdkHome() {
        JavaPlatform platform = getDefault().gradleJdk.getValue();
        if (platform == null) {
            return null;
        }

        return getHomeFolder(platform);
View Full Code Here

        //    which is above the requested version).
        //
        // 2. In case every platform is below the requested, choose the one
        //    with the highest version number.

        JavaPlatform bestMatch = null;
        for (JavaPlatform platform: platforms) {
            Specification platformSpecification = platform.getSpecification();
            if (platformSpecification == null) {
                continue;
            }

            if (!specName.equalsIgnoreCase(platformSpecification.getName())) {
                continue;
            }

            SpecificationVersion thisVersion = platformSpecification.getVersion();
            if (thisVersion == null) {
                continue;
            }

            if (bestMatch == null) {
                bestMatch = platform;
            }
            else {
                SpecificationVersion bestVersion = bestMatch.getSpecification().getVersion();

                // required version is greater than the one we currently have
                if (version.compareTo(bestVersion) > 0) {
                    // Replace if this platform has a greater version number
                    if (bestVersion.compareTo(thisVersion) < 0) {
                        bestMatch = platform;
                    }
                }
                else {
                    // Replace if this platform is still above the requirement
                    // but is below the one we currently have.
                    if (version.compareTo(thisVersion) < 0
                            && thisVersion.compareTo(bestVersion) < 0) {
                        bestMatch = platform;
                    }
                }
            }
        }

        if (bestMatch == null) {
            return JavaPlatform.getDefault();
        }

        SpecificationVersion bestMatchVersion = bestMatch.getSpecification().getVersion();

        String higherOrLower = version.compareTo(bestMatchVersion) < 0
                ? "higher"
                : "lower";
View Full Code Here

                return defaultValue;
            }

            @Override
            protected JavaPlatform chooseFromPlatforms(JavaPlatform[] platforms) {
                JavaPlatform bestMatch = tryChooseFromPlatforms(specName, versionStr, platforms);

                if (bestMatch == null) {
                    LOGGER.severe("Could not find any Java platform.");
                    return JavaPlatform.getDefault();
                }
View Full Code Here

    private void initFromProperties(ProjectProperties properties) {
        String gradleHome = AbstractProjectProperties.gradleLocationToString(properties.getGradleLocation().getValue());
        jGradleHomeEdit.setText(gradleHome);
        jGradleHomeInherit.setSelected(properties.getGradleLocation().isDefault());

        JavaPlatform currentScriptPlatform = properties.getScriptPlatform().getValue();
        jScriptPlatformCombo.setSelectedItem(new JavaPlatformComboItem(currentScriptPlatform));
        jScriptPlatformInherit.setSelected(properties.getScriptPlatform().isDefault());

        ProjectPlatform currentPlatform = properties.getPlatform().getValue();
        jPlatformCombo.setSelectedItem(new ProjectPlatformComboItem(currentPlatform));
View Full Code Here

TOP

Related Classes of org.netbeans.api.java.platform.JavaPlatform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.