Skip to content

Commit

Permalink
fix: not every selected entry will have a file
Browse files Browse the repository at this point in the history
Related #6085
  • Loading branch information
stefan-kolb committed Mar 14, 2020
1 parent 8dd7444 commit 383391d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/main/java/org/jabref/gui/maintable/OpenFolderAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@ public OpenFolderAction(DialogService dialogService, StateManager stateManager,
@Override
public void execute() {
stateManager.getActiveDatabase().ifPresent(databaseContext ->
stateManager.getSelectedEntries().forEach(entry -> {
LinkedFileViewModel linkedFileViewModel = new LinkedFileViewModel(
entry.getFiles().get(0),
entry,
databaseContext,
Globals.TASK_EXECUTOR,
dialogService,
preferencesService.getXMPPreferences(),
preferencesService.getFilePreferences(),
ExternalFileTypes.getInstance());
linkedFileViewModel.openFolder();
}));
stateManager.getSelectedEntries().forEach(entry -> {
if (entry.getFiles().isEmpty()) {
return;
}

LinkedFileViewModel linkedFileViewModel = new LinkedFileViewModel(
entry.getFiles().get(0),
entry,
databaseContext,
Globals.TASK_EXECUTOR,
dialogService,
preferencesService.getXMPPreferences(),
preferencesService.getFilePreferences(),
ExternalFileTypes.getInstance()
);
linkedFileViewModel.openFolder();
}));
}
}

0 comments on commit 383391d

Please sign in to comment.