-
Notifications
You must be signed in to change notification settings - Fork 233
fix: enable Scene Builder to load FXML with unresolved imports (#120, #281, #733) #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
unresolved imports. There is also a new option (preserve unresolved imports) which also allows to keep the imports in saved FXML files.
8f48abb to
85723a2
Compare
…of FXML with unresolved imports' as it exactly does the 2nd.
|
This one no longer works as it used to. I'll review and rework accordingly. Loading FXML files with unresolvable imports works. Saving does not work anymore. I'll also add example FXMLs and tests for the FXOM. |
…nresolvable types declared as import.
…eleting elements. Element browsing is not working.
…e reviewed and identified.
…repeated exceptions.
|
@abhinayagarwal or @AlmasB Could you please review this one? The idea is:
Interesting would be your opinion to see if this approach is helpful and maintainable. Thanks! |
Corrected javadoc string
Maran23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a nice feature! Left some comments
kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocument.java
Outdated
Show resolved
Hide resolved
app/src/main/resources/com/oracle/javafx/scenebuilder/app/preferences/Preferences.fxml
Outdated
Show resolved
Hide resolved
app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java
Outdated
Show resolved
Hide resolved
kit/src/test/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMSaverTest.java
Outdated
Show resolved
Hide resolved
kit/src/test/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocumentTest.java
Outdated
Show resolved
Hide resolved
…ugin version, added missing whitespace, removed comments, used proper JUnit API.
e89b62e to
3c7b499
Compare
app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java
Outdated
Show resolved
Hide resolved
|
Tested with many FXMLs, removed some Imports and worked pretty good. The error dialog does not appear when I drag and drop a FXML file, but that might be expected? Also one interesting note: When I drag in a FXML with a custom component that is not know by the Scenebuilder, it will not load (as before). |
…indowController.java Co-authored-by: Marius Hanl <66004280+Maran23@users.noreply.github.com>
Could be a good followup, I agree.
That makes sense. I wonder, since this lays the groundwork: We could handle unknown components the same way as if there import is missing. Since then, we can still load the FXML, which is better than failing. In any case, this should be a follow up! |
Maran23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me! Tested various scenarios and they all work for me.
|
@jperedadnr could you please review again? Lots of additional work was done to shape this. |

This fix allows Scene Builder to load FXML files with unresolved imports.
There is also a new option (keep unresolved imports) which also allows to keep the imports in saved FXML files. This can be toggled in Scene Builder preferences dialog.
If disabled, Scene Builder will effectively omit those unresolved imports and remove them from the updated FXML to be written.
If enabled, Scene Builder will keep track of unresolved imports and write them (unmodified) into the updated FXML. The import remains as it was declared in the original FXML file. Optimization is not applied to unresolved imports.
Of course, one cannot make use of unresolved imports and edit these controls. But, one can at least open an FXML file, edit and rework it in parts. Also, Scene Builder will inform the user that there is something wrong with the imports - it will not silently ignore the issue. This is quite helpful with foreign projects where users only want to look into the files and get a feeling of how the UI would look like.
This PR also increments Maven-Surefire version from 3.0.0-M5 to 3.5.0 in order to mitigate module system related errors during test.
Issue
Fixes #120
Fixes #281
Fixes #733 (added on 2024-09-29)
Progress