Open gluon-bot opened 7 years ago
@abhinayagarwal @AlmasB What do you think here? We also have many cases related to broken FXML reading/writing. I've found a way to keep track about imports which cannot be resolved by Scene Builder. So basically this can be introduced as an isolated feature.
As this is a significant change to existing behavior, I'd propose following setup:
Unresolved imports are preserved during FXML load/save
.If one then updates the library, the document requires to be re-loaded.
Technically this would a huge step as the current way how Scene Builder reads/writes FXML sometimes breaks production flows. What do you think?
The technical approach is, that the com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument
keeps track of unresolved imports and the com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader
repeats its attempts to load a file until there are no more ClassNotFoundException
errors raised by FXMLLoader. The FXOMLoader
will remove each failing import from FXML text and attempt a new load.
I've a working example ready, whats missing is the preferences. May be its also beneficial the to offer a menu item which provides a list of the unresolved imports (e.g. inside View menu, above controller skeleton preview or in the inspector, below the Code area).
Preferences dialog is now working. There are no notifications yet. I'd prefer adding user notifications with separate PRs (if even wanted).
Originally reported by: A. Walter (Bitbucket: awalterwork, GitHub: Unknown)
In SceneBuilder 8.3.0, the FXML imports are "optimized" whenever the file is saved: Only imports for the exact classes used in the node tree remain.
However, when you used fx:define to define some objects, SB does not keep the imports for their classes when it saves the file - it just deletes them! (It does not make a difference if you were using wildcards or not in your imports.)
This means that after editing the file with SB, you cannot load the FXML file in your application anymore - SB effectively breaks it.
Steps to reproduce:
Expected Behaviour: