-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 disable some actions when no libraries are open #19129 #11928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides minor comments, LGTM 👍. The changes need a second review and thus this PR awaits a second review.
Please also add a CHANGELOG.md entry
@@ -105,6 +106,10 @@ private void createToolBar() { | |||
final Button pushToApplicationButton = factory.createIconButton(pushToApplicationCommand.getAction(), pushToApplicationCommand); | |||
pushToApplicationCommand.registerReconfigurable(pushToApplicationButton); | |||
|
|||
Button newEntryFromPlainTextButton = factory.createIconButton(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService)); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line - these two statements belong together.
@@ -118,12 +123,12 @@ private void createToolBar() { | |||
globalSearchBar, | |||
|
|||
rightSpacer, | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add spaces. --> Place the cursor on a line with text in IntelliJ and then save.
new HBox( | ||
factory.createIconButton(StandardActions.NEW_ARTICLE, new NewEntryAction(frame::getCurrentLibraryTab, StandardEntryType.Article, dialogService, preferences, stateManager)), | ||
factory.createIconButton(StandardActions.NEW_ENTRY, new NewEntryAction(frame::getCurrentLibraryTab, dialogService, preferences, stateManager)), | ||
createNewEntryFromIdButton(), | ||
factory.createIconButton(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService)), | ||
newEntryFromPlainTextButton, // Use the modified button here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the comment - it is self explainiing
newEntryFromPlainTextButton, // Use the modified button here | |
newEntryFromPlainTextButton, |
(Did you use ChatGPT? This comment is AI generated, isn't it?)
MenuItem saveAllMenuItem = factory.createMenuItem(StandardActions.SAVE_ALL, new SaveAllAction(frame::getLibraryTabs, preferences, dialogService)); | ||
MenuItem newEntryFromPlainTextMenuItem = factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService)); | ||
|
||
saveAllMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases())); | ||
newEntryFromPlainTextMenuItem.disableProperty().bind(Bindings.isEmpty(stateManager.getOpenDatabases())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reorder:
Variable declaration and binding should be grouped.
Now you have
- A-init
- B-init
- empty line
- A-binding
- B-binding
It shoudl be
- A-init
- A-binding
- empty line
- B-init
- B-binding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will change it.
please do not delete and re-create your PR! justpush your changes! PR will be auto updted |
Follow up PR is #11936 |
This PR improves the user interface by disabling certain menu items and toolbar buttons when no library is open.
Specifically:
"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:
Here's the demo video:
2024-10-12.19-15-50.mp4
Closes #19129
#11923
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)