Skip to content
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 action helper when no library is open #6402

Merged
merged 3 commits into from
May 9, 2020
Merged

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented May 3, 2020

This fixes #6430 an exception when opening the View menu with an empty library

  • Change in CHANGELOG.md described (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

@Siedlerchr Siedlerchr requested a review from tobiasdiez May 3, 2020 14:13
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label May 3, 2020
@tobiasdiez
Copy link
Member

A fix using EasyBind.monadic similar to the other fix doesn't work? This is I guess the cleanest solution since you don't need to worry about null values anymore. (It's the bindings version of Optional)

…ptyLib

* upstream/master: (23 commits)
  Make wrap fields also visible in entry editor (#6315)
  Add launcher to fix extension import in snap (#6439)
  add concise message when SaveException happen (#6444)
  Squashed 'src/main/resources/csl-locales/' changes from 79845b087b..cbb45961b8
  Squashed 'src/main/resources/csl-styles/' changes from 906cd6d..270cd32
  Addition to the early pull #6438 (#6441)
  Fix the bug #6421 (#6438)
  Cleanup dead code (#6436)
  Fixed entry duplication on file download (#6437)
  Add workaround for buildSrc issue (#6433)
  Remove dash from illegal characters. (#6300)
  Docs: For developers: New architectural decision added to list (#6397)
  Added a download checkbox to the import dialog (#6381)
  Bump jaxb-xjc from 2.3.2 to 2.3.3 (#6410)
  Bump flexmark-ext-gfm-strikethrough from 0.61.20 to 0.61.24 (#6413)
  Bump byte-buddy-parent from 1.10.9 to 1.10.10 (#6408)
  Bump flexmark-ext-gfm-tasklist from 0.61.20 to 0.61.24 (#6412)
  Bump org.beryx.jlink from 2.17.8 to 2.18.0 (#6411)
  Bump tika-core from 1.24 to 1.24.1 (#6409)
  Bump flexmark from 0.61.20 to 0.61.24 (#6416)
  ...
@Siedlerchr
Copy link
Member Author

@tobiasdiez Thanks for the hint, I refactored it now. Seems to still work. I am not that into those Binding stuff, I am wondering about the FieldBinding, that seems uncessary now?


ObservableList<BibEntry> selectedEntries = stateManager.getSelectedEntries();
MonadicObservableValue<Boolean> fileIsPresent = EasyBind.monadic(Bindings.valueAt(selectedEntries, 0)).map(entry -> {
List<LinkedFile> files = entry.getFiles();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this does not update the status if a file is added to the currently selected entry. For this, the isAnyFieldSetForSelectedEntry method uses flatMap instead of map.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it, it works as well when I add or remove a file to an entry both the context menu and the View menu get updated with the correct status

@tobiasdiez tobiasdiez added status: changes required Pull requests that are not yet complete and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels May 9, 2020
@Siedlerchr Siedlerchr merged commit 9251931 into master May 9, 2020
@Siedlerchr Siedlerchr deleted the fixactionHelperEmptyLib branch May 9, 2020 18:33
koppor pushed a commit that referenced this pull request Feb 15, 2023
9926b48cf3 Create biomolecular-concepts.csl (#6355)
4b4ebeeeba Create life-science-alliance.csl (#6353)
153790afc9 Update ucl-university-college-apa.csl (#6390)
a30604c0b4 Update geophysical-journal-international.csl (#6385)
3fda5f30ca Create nursing-open.csl (#6402)
103b607948 Update natur-und-landschaft.csl (#6404)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 9926b48cf3e20e60142e35b3cd160015aebed9d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes required Pull requests that are not yet complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Menu View on empty file => Uncaught exception
2 participants