Skip to content

Commit

Permalink
Reworked the user notification for the case that basically NO valid (…
Browse files Browse the repository at this point in the history
…supported) contents at all as been dropped to welcome page.
  • Loading branch information
Oliver-Loeffler committed Aug 31, 2024
1 parent d1320b0 commit 6b6308a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,27 @@ private void notifyUserWhenDroppedUnsupportedFiles(List<String> unsupported) {
ErrorDialog dialog = new ErrorDialog(getStage());
dialog.setTitle(I18N.getString("welcome.loading.when.dropped.error.title"));
dialog.setMessage(I18N.getString("welcome.loading.when.dropped.error.message"));
dialog.setDetailsTitle(I18N.getString("welcome.loading.when.dropped.error.title"));
String explanation = I18N.getString("welcome.loading.when.dropped.error.detail.explanation");
String suffix = "\n\n";

int maxItems = 5;
if (unsupported.size() > maxItems) {
suffix = I18N.getString("welcome.loading.when.dropped.error.detail.suffix");
}

String detail = unsupported.stream()
.collect(Collectors.joining(System.lineSeparator()));
.limit(maxItems)
.collect(Collectors.joining(System.lineSeparator(),
explanation,
suffix));

String debugInfo = unsupported.stream()
.collect(Collectors.joining(System.lineSeparator()));

dialog.setDetails(detail);
dialog.setDebugInfo(debugInfo);

Platform.runLater(()->dialog.showAndWait());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,10 @@ welcome.recent.items.loading = Loading recent projects...
welcome.recent.items.no.recent.items = no recent projects
welcome.open.project.label = Open Project
welcome.loading.label = Loading Components...
welcome.loading.when.dropped.error.title=Unsupported file format or empty directory
welcome.loading.when.dropped.error.message=The dropped object is either not a JavaFX FXML file or does not contain any FXML files to be loaded.
welcome.loading.when.dropped.error.title=Unsupported files dropped
welcome.loading.when.dropped.error.message=Cannot open dropped files or directories.
welcome.loading.when.dropped.error.detail.explanation=Scene Builder only supports *.fxml files or directories which contain *.fxml files.\n\n
welcome.loading.when.dropped.error.detail.suffix=\n...\n\n

# -- Template (this keys are replicated from SceneBuilderKit.properties)
template.new.project.label = New Project from Template
Expand Down

0 comments on commit 6b6308a

Please sign in to comment.