-
Notifications
You must be signed in to change notification settings - Fork 221
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
fix: enable Scene Builder to load FXML with unresolved imports (#120, #281, #733) #576
base: master
Are you sure you want to change the base?
Changes from 47 commits
85723a2
6d11253
c5880b4
acf8460
ca92d54
1d60439
d3f473f
d04fef7
cbdfd05
0e05916
09ed1d0
fe33457
efe34c4
c05ceb6
1a56caa
076ea9d
515a84e
908b838
c74849f
1de1e31
a814fc9
2f52ccb
edd76d9
095dc11
346a493
528b765
953de94
e599bb4
93089b9
5847ac1
19028d6
7621fb6
d9dd99a
4a7f937
0c5b3ef
ac79601
8e18795
690765d
55f95ab
cb6e16e
eed9eb8
73dddef
a4723e9
2cdcd66
00566d5
ae88732
8094085
2cbaffc
d2114ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -531,7 +531,8 @@ public void handleOpenFilesAction(List<String> files, Runnable onSuccess) { | |
EditorController.updateNextInitialDirectory(fileObjs.get(0)); | ||
|
||
Consumer<Map<File, Exception>> onError = errors -> showFileOpenErrors(errors, | ||
() -> WelcomeDialogWindowController.getInstance().getStage()); | ||
() -> WelcomeDialogWindowController.getInstance() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. avoid formatting changes if these are not needed for this PR? |
||
.getStage()); | ||
|
||
// Fix for #45 | ||
if (userLibrary.isFirstExplorationCompleted()) { | ||
|
@@ -715,10 +716,14 @@ public DocumentWindowController getFrontDocumentWindow() { | |
} | ||
|
||
private void performOpenFiles(List<File> fxmlFiles) { | ||
performOpenFiles(fxmlFiles, r -> showFileOpenErrors(r, getOwnerWindow()), () -> { /* no action here */ } ); | ||
performOpenFiles(fxmlFiles, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. avoid formatting changes if these are not needed for this PR? |
||
r -> showFileOpenErrors(r, getOwnerWindow()), | ||
() -> { /* no action here */ } ); | ||
} | ||
|
||
private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception>> onError, Runnable onSuccess) { | ||
private void performOpenFiles(List<File> fxmlFiles, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. avoid formatting changes if these are not needed for this PR? |
||
Consumer<Map<File, Exception>> onError, | ||
Runnable onSuccess) { | ||
assert fxmlFiles != null; | ||
assert fxmlFiles.isEmpty() == false; | ||
|
||
|
@@ -740,6 +745,7 @@ private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception | |
hostWindow.openWindow(); | ||
openedFiles.add(fxmlFile); | ||
LOGGER.log(Level.INFO, "Successfully opened file {0}", fxmlFile); | ||
hostWindow.showMissingTypesNotificationIfNeeded(fxmlFile); | ||
} | ||
} catch (Exception xx) { | ||
LOGGER.log(Level.WARNING, "Failed to open file: %s".formatted(fxmlFile), xx); | ||
|
@@ -752,7 +758,7 @@ private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception | |
final PreferencesController pc = PreferencesController.getSingleton(); | ||
pc.getRecordGlobal().addRecentItems(openedFiles); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove added blank characters (tabs or spaces) |
||
if (exceptionsPerFile.isEmpty()) { | ||
LOGGER.log(Level.FINE, "Successfully opened all files."); | ||
onSuccess.run(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,6 +250,7 @@ prefs.cssanalyzer.columns.defaults.last = "Defaults" Column Last | |
prefs.recent.items = Recent items : | ||
prefs.animate.accordion = Animate Accordion : | ||
prefs.wildcard.import = Use Wildcard Imports : | ||
prefs.preserve.unresolved.import = Load FXML with unresolved imports : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
prefs.tic.paste.alternate.behavior = Alternative paste behavior for text input : | ||
prefs.tic.paste.alternate.behavior.tooltip = MacOS only: Enables workaround for pasting into text input controls.\nDisable when pasting text is not working as expected. | ||
prefs.reset.default = Reset to Builtin Default Values | ||
|
@@ -431,12 +432,15 @@ alert.save.noextension.savewith = Save with '.fxml' | |
alert.save.noextension.savewithout = Save without '.fxml' | ||
alert.open.failure.charset.not.found = The given charset could not be set. | ||
alert.open.failure.charset.not.found.details = It may be due to the encoding in your document. | ||
alert.open.failure.unresolved.imports = Failed to resolve {0} FXML import(s): | ||
alert.open.failure.unresolved.imports.details = Use Show Details to obtain a full list of unresolveable imports:\n\n{0}\n\nScene Builder will open the FXML for editing but the custom content will not be rendered correctly.\n\nUnresolved UI elements will be removed from FXML when the file is saved.\n\nPlease add the missing components to your user library within the JAR/FXML Manager. If individual class files are used, make sure, those are organized in a directory structure matching the package structure.\n\n | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
alert.open.failure.unresolved.imports.advice = Please add the missing components to your user library within the JAR/FXML Manager.\nIf individual class files are used, make sure, those are organized in a directory structure matching the package structure.\n\n{0}\n\nA total of {1} unresolvable import(s) was found.\n | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
alert.welcome.file.not.found.question = One or more project files were not found. | ||
alert.welcome.file.not.found.message = If those are located on a removable or network drive, please make sure the drive is connected.\n\n | ||
alert.welcome.file.not.found.title = Project file(s) not found | ||
alert.welcome.file.not.found.okay = Remove From List | ||
alert.welcome.file.not.found.no = OK | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Log Messages | ||
# ----------------------------------------------------------------------------- | ||
|
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.
Suggestion: add a button to the dialog with an
Open FXML/JAR Manager
option, so the user can add the missing dependency.