...
This section assumes that you have already succeeded in Building OpenJFX. A gradle build must complete before IDE support will fully work (otherwise your IDE will just be a glorified text editor with lots of red squiggles!). Specific instructions for using each IDE is provided below, followed by a discussion on Developer Workflow, Using Mercurial, and Communication with other members of the team. Further information on how we work can be found under Code Style Rules.
Table of Contents |
---|
IDE Pre-Requirements
Despite the fact that most of the major IDE's support gradle directly, we have decided to provide pre-generated IDE configuration files in order to make using an IDE smooth and painless. As the IDE's support for gradle improves, we may be able to update these instructions to rely on that support instead of the checked-in project files that we have today.
...
- Edit netbeans.conf
- Invoke NetBeans
- Add the JDK8 Platform
- Import NetBeans projects
- Rebuild
- Run sample code
- Run sample code with grade built shared libraries
Invoke NetBeans
Note that before you invoke NetBeans, you may need to clear your old defaults and start with a fresh NetBeans install or you might get errors.
Add the JDK8 Platform
Invoke Tools->Java Platforms
NOTE: You must add a new platform named "JDK 1.8" even if you already have your default platform pointing to a JDK 8 platform.
Import the NetBeans Projects
Open Project... (you may need to resolve missing junit jars, don't open web or builders for now)
Rebuild
Select one of the projects to build (controls or web is a good choice depending on what you want to debug). This might take a long time depending on how fast your machine it. There should be no red marks on any of the projects.
Run Sample Code
Here is some sample code that was hooked up to use the base, graphics and controls projects. When saved, these projects were built by the IDE and the same code executed using the source in the IDE.
Run Sample Code with gradle built shared libraries
//TODO - explain how to hook up the shared libraries in the run dialog
Using IntelliJ IDEA
IntelliJ is a popular IDE that is used by many committers to develop JavaFX code. An IntelliJ project has been created for you that you need to open. The steps to use IntelliJ are:
Open the IntelliJ Project
Make
Run sample code
Run sample code with grade built shared libraries
Open the IntelliJ Project
IMPORTANT: Open IntelliJ on the 'rt' directory exactly as indicated in the image above.
...
NOTE: Dialog.java
in the controls module currently gives a compiler error because of a bug in Eclipse. It can be worked around be moving the erroneous line out of the lambda expression. Remember to ignore this change when working against a revision.
JUnit tests
Eclipse can run JUnit tests as an alternative to the gradle tasks.
Right click on the resource you want to test (project/package/class) and select Run as -> JUnit Test
.
Running a dependent project
Having an external project that uses the development OpenJFX modules is useful for debugging and testing.
Create a new Java project and add a module-info.java
that requires the needed modules. For example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
module zTest {
requires javafx.base;
requires javafx.graphics;
requires javafx.controls;
exports zTest;
} |
In the project properties, Go to Java Build Path -> Modulepath
and add the required projects.
Write your classes.
If when running you receive warnning about missing packages or modules, edit the run configuration by going to its Dependencies -> Override Dependencies
, then delete the launch dependencies and Override
.
Run Sample Code (NOTE: old)
Using Gradle
Eclipse has gradle support via Eclipse Buildship. Use the latest Buildship version as the gradle version used in OpenJFX updates from time to time. OpenJFX uses the gradle wrapper.
The project structure for gradle is such that the root directory (/rt
) contains the parent project with all other projects being its children. The Gradle Tasks view will allow you to execute the tasks that you would use Cygwin for otherwise.
NOTE: this process will override the projects' configuration and will cause them to not work anymore. However, since we are inside a mercurial repository, we can revert the breaking changes and keep the gradle settings. This will allow us to work with both Eclipse and gradle.
...
What this process does is add the gralde nature and build command to the .project files. This means that these files are now different than the ones in the repo. Additionally, the .settings folder for each project will contain a Buildship pref file. You can hg forget
these to not interfere with development workwill need to resolve the conflicts with the upstream repo, e.g., via hg ignore
.
Run Sample Code with Gradle Built Shared Libraries (Note: old)
//TODO - explain how to hook up the shared libraries in the run dialog
...