Skip to content

Commit

Permalink
Reconnect recent file preferences
Browse files Browse the repository at this point in the history
Fix: #75
  • Loading branch information
io7m committed Sep 29, 2024
1 parent 51f0e09 commit 7e810b7
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public final class LFileChoosers implements LFileChoosersType
new JWOxygenIconSet();

private final JWFileChoosersType choosers;
private final LPreferencesType preferences;
private Path mostRecentDirectory;

/**
Expand All @@ -58,6 +59,8 @@ public LFileChoosers(
Executors.newVirtualThreadPerTaskExecutor(),
Locale.getDefault()
);
this.preferences =
services.requireService(LPreferencesType.class);
}

@Override
Expand All @@ -67,6 +70,11 @@ public JWFileChooserType create(
final var builder =
JWFileChooserConfiguration.builder()
.from(configuration)
.addAllRecentFiles(
this.preferences.recentFiles()
.stream()
.sorted()
.toList())
.setFileImageSet(OXYGEN_ICON_SET);

if (this.mostRecentDirectory != null) {
Expand Down

0 comments on commit 7e810b7

Please sign in to comment.