IntelliJ and JavaFX support - intellij-idea

I just tried to set up my first IntelliJ Java FX project. I was doing a tutorial where some fxml files are created. A screenshot from a eclipse window is shown:
I tried to do something similiar, but if I go to "new file", I cant even choose a fxml format. Is there no support in IntelliJ for that? I googled around but I couldnt find anything. Always it mentions I should try to enable the JavaFX support for my project, but it is enabled.
Any ideas?
Intellij 13.1, Ultimate Edition

Right Click on the folder you want to create the new file in (e.g. the ch.makery.address.view package), then select from the context menu:
New | File
Type the name of the fxml file you want to create (e.g. RootLayout.fxml).
You now have a blank fxml file which you can hand edit.
Hand editing fxml isn't really advised except for minor tweaks.
So install SceneBuilder and you can edit the new fxml in SceneBuilder by right-clicking on the fxml filename in the Idea project window and choosing "Open in SceneBuilder".
See also, this related question on what constitutes a JavaFX project in Intellij Idea.

Related

How do you load a custom JAR into the SceneBuilder that's built into IntelliJ?

I'm trying to load a custom Control into the SceneBuilder that's running inside of IntelliJ. I downloaded the plugin from Gluon. In the stand-alone version I have installed, the option to import a custom JAR is available by clicking the gear icon under 'Library'. I see nothing like that when SceneBuilder is run from inside of IntelliJ in a tabbed editor view.
I would think that importing the JAR would allow me to see it show up in IntelliJ, but no such luck. It only shows up when SceneBuilder is ran stand-alone.
IntelliJ built-in Scene Builder is not the same as uses Gluon's Scene Builder. The former is a version embeddded in the IDE, introduced with IntelliJ IDEA 14, two years ago, but without several features or even menus or recent improvements, while the latter is the complete and updated version 8.1.1, that allows you using the latest features available and or adding custom controls, as you have already done.
If you check IntelliJ help, they also recommend using the stand-alone version (though they still point to the old 2.0 Oracle's version), they don't refer to the one they embed.
If you want to use custom controls, the only option here is the Gluon's version.
Note: I've edited the answer to clarify that IntelliJ built-in Scene Builder does use Gluon's Scene Builder, by scanning the content folder with the dist.jar. It is recommended having the latest version installed.

Why Xtext doesn't recognize JavaFX properties?

I started using JavaFX recently. Unfortunately I've been unable to use auto-complete in my css editor with XText.
My project was created using maven so I added JavaFX SDK to the class path.
I'm working on eclipse Luna 4.4 editing the css files with e(fx)clipse Css Editor.
How can I have Xtext working correctly while editing Css files in eclipse?
I had the same issue of being unable to get auto-complete with my JavaFX CSS. My fix was add the JavaFX SDK to the library list. To do that:
Go to Project | Properties
Select Java Build Path in the tree
Click on the Libraries tab
Click the Add Library... button
Choose JavaFX SDK
Click Next then Finish
Click Apply
Click OK
CSS editing worked after those steps.

How to create a JavaFX module in IntelliJ IDEA

I would like to integrate a JavaFX GUI in an existing IntelliJ IDEA Java project (java version 1.8.0_20).
Although I can create a JavaFX project from scratch (JavaFX plugin is enabled) in my IDE, I can't figure out how to create a module.
Do I need to define a new module SDK for a new Java module? Or does the type of the JavaFX module has to be IntelliJ Platform Plugin? I tried both without any success. Please help.
Many thanks,
Cristina
Update for Idea 2021.3
The previous information on this answer for Idea 13.1 is now outdated.
For Idea 2021.3, create a new JavaFX project using an Idea wizard:
New JavaFX project wizard.
From the main menu, select File | New | Project.
In the New Project wizard, select JavaFX from the list on the left.
I advise you follow the detailed instructions for creation and execution of JavaFX project at the new JavaFX project wizard link supplied.
A new JavaFX project created this way will be different from creating a new Java project using the same wizard. The new JavaFX project will be configured to use a build tool (e.g. maven or gradle). It will have the JavaFX module dependencies defined and will include sample code for a modular HelloWorld JavaFX FXML application. It is the perfect thing to use to get started with a new JavaFX application IMO.
If you want a new Idea module rather than a new project, then you just follow the same steps as above, but instead of selecting File | New | Project, you select File | New | Module, then select JavaFX from the list on the left as before.
Alternatively, you can create new modules in Idea by defining the modules in a Maven or Gradle project and importing the build tool project file for the project into Idea.
Prior answer for Idea 13.1
I don't think you can define a new JavaFX module in Idea 13.1. Note that there is not much difference between a JavaFX project and a non-JavaFX project in Idea, so you can just create a normal Java module and make a couple of manual tweaks to the module configuration and it should behave the same as if you created a JavaFX project. See the following answer for more details:
How to convert a normal java project in intellij into a JavaFx project
Okay this question is old and has been answered but let me add more to it. I came across the same problem and did a little workaround:
You first open the main project in IDEA (in which you want to add a JavaFX project module), then goto File -> New -> Project.
From there, you get the standard New Project dialog of IDEA, so select javaFX and proceed. Make sure the project location is where you want the JavaFX module to be created (which is why i prompted you to open the parent project in IDEA first). Open it in a new window and close it, doesn't matter.
Now, (Assuming that you only have the main project opened in IDEA) goto its File -> Project Structure and in the dialog, goto Modules and click add (+) -> Import module and then select the project you just created. Proceed through the wizard, overwrite the .iml and the JavaFX module should be added to your main project structure.

How to import and run existing plugins from intellij community edition repo

I'm trying to import and run the IntelliJ git4idea (Git Integration) plugin in order to play around and contribute some of my own code.
I've pulled the Intellij community edition from the github repo, and imported the git4idea plugin as a project. I'm running the Intellij community edition
My main issue is this:
After importing all the modules, the git4idea module comes up as a general module type, and not a plugin module type.
This means that when trying to create a new run\debug configuration, I get [none] under "Use classpath of module", instead of of the ability to select the git4idea plugin. This obviously results in a "Run configuration error: no plugin module specified for configuration".
So the question is -
How can I change the general type of imported "git4idea" to plugin type?
Or better yet, what are the steps required in order to import and build/debug/run a plugin from the Intellij community edition repo?
I was able to solve this by manually reordering file directories, sorting out dependencies and editing the .iml file. The type of plugin is defined by changing type="JAVA_MODULE" to type="PLUGIN_MODULE".
...
This is the answer given by Dmitry Jemerov on the official Jetbrains plugin development forum:
The easiest answer to this is "don't". The IntelliJ IDEA Community
Edition project is set up to be developed as a whole, and the
dependencies are set up accordingly. If you want to hack on the Git
plugin, you simply run IDEA using the provided run configuration, it
runs with all plugins enabled, and you simply make whatever changes
you need and test them using the main run configuration.
If you really want, you can set up a new plugin module and point it to
the source code of the git4idea plugin inside the IntelliJ IDEA
Community Edition Git checkout. This is not too hard, but it's
something you'll need to do from scratch, and you can't use the
existing .iml file.
I had the same no plugin module specified for configuration issue. To work around it, instead of importing, I created a new plugin project and used the existing code directory.
when you import the intelij plugin projects
You should run the 'runIde' task in gradle.
Step-by-step instruction
Build your IDEA plugin (usually done with gradle build).
Start Intellij IDEA.
If you have any project opened, go to menu "File->Close all projects" to return to Intellij IDEA startup screen.
Install the plugin you've just built: on the left side of the "Welcome to Intellij IDEA" startup screen go to "Plugins", then click "gear" icon on the right side, it's located to the right of "Marketplace" and "Installed". From the pop-up menu select "Install Plugin from Disk...", navigate to plugin file (usually in build folder) and click "Ignore and continue" when you see the warning message saying something about signature.
Restart Intellij IDEA.
Open the folder with your IDEA plugin.
Wait until IDEA imported your Gradle project.
Put breakpoints inside your plugin code so you can debug it.
Go to menu "Run->Edit configurations".
In the "Run/Debug Configurations" window on the left side click "+".
Select "Gradle" from the pop-up menu.
On the right side change "Name" to "gradle-run-ide" (without quotes).
On the right side under "Run", inside "Tasks and arguments" field enter runIde ("i" must be capital, other letters small).
Click "OK" to save changes.
Go to menu "Run->Debug 'gradle-run-ide'".
A new, black-colored IDEA window should appear.
In this black-colored IDEA window do whatever you need to do in order to invoke methods of your plugin. When you invoke them, the first IDEA window should stop you on breakpoints you set previously.
Happy debugging.
After changing type="JAVA_MODULE" to type="PLUGIN_MODULE" in *.iml file I was getting following error -
Error running 'IdeaPlugin': Wrong SDK type for plugin module
To fix this go to -
Module Settings -> Platform settings -> SDKs.
Click on Add new SDK
Select Intellij Platform plugin SDK
For home directory select your Inetllij installation dir
Select JAVA SDK you want to use with it.
Once this is added got to Module Settings again
Module Settings -> Project settings -> project.
In Project SDK change the JAVA sdk to the SDK we just added in the above steps.
Run/Debug you plugin now.

How to navigate to path of the opened file in project tool window in IDEA?

How to navigate to path of the opened file, in project tool window in IDEA? ctrl+mouse1 shows path in nautilus. I need to see path in project tool. I cant find answer ANYWHERE!
Navigate | Select In, Project View, or enable Autoscroll from Source option, the same applies for all IntelliJ IDEA based products, so this question actually duplicates:
How to automatically navigate to the current class in Intellij Idea Project Tool Window?
PHPstorm project navigation
How to find out which class I'm currently in