Skip to content

Fix disable some actions when no libraries are open#11936

Merged
Siedlerchr merged 12 commits into
JabRef:mainfrom
lzmmxh:fix#19129
Oct 12, 2024
Merged

Fix disable some actions when no libraries are open#11936
Siedlerchr merged 12 commits into
JabRef:mainfrom
lzmmxh:fix#19129

Conversation

@lzmmxh

@lzmmxh lzmmxh commented Oct 12, 2024

Copy link
Copy Markdown
Contributor

This PR improves the user interface by disabling certain menu items and toolbar buttons when no library is open.

"Save All" menu item in MainMenu.java is now disabled (greyed out) when there are no open libraries.
"New entry from plain text" menu item in MainMenu.java is now disabled when there are no open libraries.
"Global Search" bar in the main toolbar (MainToolBar.java) is now disabled when there are no open libraries.
"New entry from plain text" button in the main toolbar (MainToolBar.java) is now disabled when there are no open libraries.

Here's the screenshot:

1 2 3

Here's the demo video:

2024-10-12.19-15-50.mp4

Closes #11923

#11923

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (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 developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@lzmmxh

lzmmxh commented Oct 12, 2024

Copy link
Copy Markdown
Contributor Author

Hi Kopp , I believe t this is the final version. Can I merge it? (✖﹏✖)

@Siedlerchr

Copy link
Copy Markdown
Member

PLEASE KEEP THIS PR OPEN; YOU CAN PUSH CHANGES TO THIS BRANCH AND THE PR WILL BE UPDATED AUTOMATICALLLY

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good. Needs to be trled out.

Maybe automated tests could be done wlth TestFX.

@koppor

koppor commented Oct 12, 2024

Copy link
Copy Markdown
Member

Hi Kopp , I believe t this is the final version. Can I merge it? (✖﹏✖)

We will review it. If it is OK, we will add to the merge queue. If not OK, you will receive comments and should adress it. Just push to your branch then; the PR will be updated. No need to open a new PR.

@Siedlerchr Siedlerchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tested ,works fine

@Siedlerchr Siedlerchr added this pull request to the merge queue Oct 12, 2024
Merged via the queue into JabRef:main with commit 70a8ff3 Oct 12, 2024
LoayGhreeb added a commit that referenced this pull request Oct 13, 2024
Comment on lines +150 to +155
MenuItem saveAllMenuItem = factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame::getLibraryTabs, preferences, dialogService));
saveAllMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases()));

MenuItem newEntryFromPlainTextMenuItem = factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService));
newEntryFromPlainTextMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases()));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello @lzmmxh, thank you for your contribution!

Next time, when you're working on any issue, I recommend taking some time to explore the codebase and look for similar patterns related to what you're working on; especially for "good first issues". These issues are designed to help new contributors get familiar with the code.

If you check the codebase, you'll find similar functionality relevant to this issue. We're asking to disable the "Save All" menu item, and you'll see that the "Save" menu item is already disabled as expected. By looking at how the "Save" option is disabled, you can apply the same approach to this task.

I'm not happy with the changes in this pull request, and they will be reverted in PR #11941.

github-merge-queue Bot pushed a commit that referenced this pull request Oct 13, 2024
* Revert "Fix disable some actions when no libraries are open (#11936)"

This reverts commit 70a8ff3.

* Disable actions when no libraries are open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable some actions when no libraries are open

4 participants