diff -r 4771df8de272 core.startup/nbproject/project.xml --- a/core.startup/nbproject/project.xml Sun Dec 15 12:33:08 2013 +0000 +++ b/core.startup/nbproject/project.xml Mon Dec 16 13:50:57 2013 +0100 @@ -71,7 +71,7 @@ - 7.25 + 7.41 diff -r 4771df8de272 core.startup/src/org/netbeans/core/startup/CoreBridge.java --- a/core.startup/src/org/netbeans/core/startup/CoreBridge.java Sun Dec 15 12:33:08 2013 +0000 +++ b/core.startup/src/org/netbeans/core/startup/CoreBridge.java Mon Dec 16 13:50:57 2013 +0100 @@ -185,6 +185,15 @@ if ((Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0) { provides.add("org.openide.modules.os.Solaris"); // NOI18N } + + if (isJavaFX(new File(System.getProperty("java.home")))) { + provides.add("org.openide.modules.jre.JavaFX"); // NOI18N + } } - + + static boolean isJavaFX(File javaHome) { + return + new File(new File(javaHome, "lib"), "jfxrt.jar").exists() || + new File(new File(new File(javaHome, "lib"), "ext"), "jfxrt.jar").exists(); + } } diff -r 4771df8de272 core.startup/test/unit/src/org/netbeans/core/startup/CoreBridgeTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.startup/test/unit/src/org/netbeans/core/startup/CoreBridgeTest.java Mon Dec 16 13:50:57 2013 +0100 @@ -0,0 +1,88 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ + +package org.netbeans.core.startup; + +import java.io.File; +import java.io.IOException; +import static org.junit.Assert.*; +import org.netbeans.junit.NbTestCase; + +/** + * + * @author Jaroslav Tulach + */ +public class CoreBridgeTest extends NbTestCase { + private File jre; + private File lib; + private File ext; + + public CoreBridgeTest(String n) { + super(n); + } + + @Override + protected void setUp() throws Exception { + clearWorkDir(); + jre = new File(getWorkDir(), "jre"); + lib = new File(jre, "lib"); + ext = new File(lib, "ext"); + ext.mkdirs(); + + assertTrue("Dirs created", ext.isDirectory()); + } + + public void testNoJavaFX() { + assertFalse("No fx rt.jar", CoreBridge.isJavaFX(jre)); + } + + public void testJDK7FX() throws IOException { + new File(lib, "jfxrt.jar").createNewFile(); + assertTrue("fx rt.jar found", CoreBridge.isJavaFX(jre)); + } + + public void testJDK8FX() throws IOException { + new File(ext, "jfxrt.jar").createNewFile(); + assertTrue("fx rt.jar found", CoreBridge.isJavaFX(jre)); + } + +} diff -r 4771df8de272 libs.javafx/manifest.mf --- a/libs.javafx/manifest.mf Sun Dec 15 12:33:08 2013 +0000 +++ b/libs.javafx/manifest.mf Mon Dec 16 13:50:57 2013 +0100 @@ -3,5 +3,6 @@ OpenIDE-Module-Package-Dependencies: javafx.application[Application] OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/javafx/Bundle.properties OpenIDE-Module-Specification-Version: 2.2 +OpenIDE-Module-Needs: org.openide.modules.jre.JavaFX Class-Path: ${java.home}/lib/ext/jfxrt.jar diff -r 4771df8de272 openide.modules/apichanges.xml --- a/openide.modules/apichanges.xml Sun Dec 15 12:33:08 2013 +0000 +++ b/openide.modules/apichanges.xml Mon Dec 16 13:50:57 2013 +0100 @@ -50,6 +50,44 @@ Modules API + + + JavaFX Library Wrapper + + + + + + +

+ Most of JDK installations come with additional JavaFX + JAR. Alas the location of the JAR is different on JDK7 and JDK8, + moreover on some operating systems (think of Solaris) the + JAR is not present at all. To hide the differences and allow + smooth consumption of JavaFX APIs NetBeans provide + following conventions. +

+

+ If you want to code against JavaFX APIs, add dependency + on org.netbeans.libs.javafx library. Then you'll + be able to compile and run while using the API. +

+

+ If you want to depend on presence of JavaFX JAR + inside of JDK installation structure, use: +

+
OpenIDE-Module-Needs: org.openide.modules.jre.JavaFX
+

+ This token is made available by the module system, if the + JavaFX module is present in the JDK. Btw. the + org.netbeans.libs.javafx library has such + dependency and as a result, all modules that depend on it + will be disabled on Solaris or on OpenJDK (if installed without + JavaFX). +

+
+ +
Find ModuleInfo by code name base easily diff -r 4771df8de272 openide.modules/manifest.mf --- a/openide.modules/manifest.mf Sun Dec 15 12:33:08 2013 +0000 +++ b/openide.modules/manifest.mf Mon Dec 16 13:50:57 2013 +0100 @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.modules OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties -OpenIDE-Module-Specification-Version: 7.40 +OpenIDE-Module-Specification-Version: 7.41