-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UserLibrary: feature for adding folders to library #228
Conversation
Just a couple of implementation notes:
Tell me if you want me to make some change. (anyway, I noticed that LibraryUtil is missing the license header...) |
This looks like a nice feature to be added to Scene Builder. Thanks for your PR! I've tried it but I had some issues to make it work.
If you check this method:
so when you add your folder (bin, out, build, ...) to the class path, it will include a jar that doesn't exist.
That loads any jar and also any folder with the usual file protocol. The same applies to Next issue: You need to provide the exact folder that has the classes based on their package name. For instance, for a control under
While this is okay, somehow it should be advised. Or ideally, some kind of recursion algorithm could be used. Another possible issue: what happens with dependencies? When we import a control from a jar, all traverse dependencies are resolved, but how does it apply in this case? |
Hello Josè, thanks for the reply. Just a quick reply (I'm in a hurry within a meeting..): Exploring jars inside the specified folder wasn't supposed to work: just .classes. Probably you are right it could be interesting, but I would add this functionality with another PR; My aim is just to add capability to work with the binaries compiled by IDEs. Let me check in more detail the dependencies issue. I will reply ASAP. And yes, you have to specify the root folder of the classes you want to add. Do you think it could be worth trying to make class name with parents directories too? bye |
Well, I've tested current dependency discovery feature for directory-based library and jar-based, and have found that it almost works as expected. I have a test case that fails to load a custom component (using SB 8.5.0 both gluon-official and my branch), but I'll post an issue for that; this affects both jar-based library components both directory-based, and is quite simple to reproduce: just add some code in custom component that uses an external library that is not available to SB (e.g. org.springframework.context) and you will get something like this: Can you elaborate better, please? In the meanwhile, i'm going to push the fixes you suggested (and thanks for that). |
@eduarddrenth maybe you could be interested in this? |
Once I start developing FX applications again, this sounds like a feature I would use yes. Only thing is I do mostly EE/web based these days. |
Great @mimmoz81. It's a good and useful work! |
@jperedadnr any news? |
Maybe we should try to shorten the text, something like:
And maybe you can add a tooltip for a more verbose explanation? |
ADD tooltip for folder hyperlink
...ain/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/ImportWindowController.java
Outdated
Show resolved
Hide resolved
Thanks, before we can merge this PR, would you mind signing this CLA? |
Signed |
@mimmoz81 Hey, as we have already merged this PR, I've started with a new one, that will provide logging to report the result of importing custom controls from jar or folders: #234 I've started also some refactoring, so feel free to review and test. |
Hello, thanks for merging this! I'm preparing other useful stuffs about custom controls: I'll do another PR ASAP; if you are planning a release soon, please tell me when so that this new PR will get merged too. In the meanwhile, I'll check your modifications. |
Why is this PR not available for Linux Scene Builder too? |
Do you mean it does not work on Linux machine or it is simply missing from binary release? |
This PR adds a long waited (by me) feature, that enables the user to add a folder (in particular, root folders with classes) to the custom components library.
Users can add as many folders as they want.
After adding one folder to the library, that one is used as the root for loading classes in all its subfolders, and components that were able to be loaded are added to the "Custom" library panel, as if they loaded from a jar.
Bonus: the library label updates its text during scanning, so it is evident to users that a maybe long process is running..

The main advatange of this PR, is that a developer can add a "bin" folder from their running Eclipse/IDEA to the library manager and have the custom components loaded into SB without the need to create and publish a jar to the library directory everytime.
Feel free to ask for clarifications...