feat: add "Close library" to File menu#14383
Conversation
calixtus
left a comment
There was a problem hiding this comment.
Many unneccessary linebreak changes, please fix before we make a review.
| ClipBoardManager clipBoardManager, | ||
| TaskExecutor taskExecutor, | ||
| GitHandlerRegistry gitHandlerRegistry) { | ||
| public JabRefFrame(Stage mainStage, DialogService dialogService, FileUpdateMonitor fileUpdateMonitor, GuiPreferences preferences, AiService aiService, StateManager stateManager, CountingUndoManager undoManager, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry) { |
| undoManager, | ||
| clipBoardManager, | ||
| taskExecutor); | ||
| this.viewModel = new JabRefFrameViewModel(preferences, aiService, stateManager, dialogService, this, this::getOpenDatabaseAction, entryTypesManager, fileUpdateMonitor, undoManager, clipBoardManager, taskExecutor); |
| mainStage::getScene, | ||
| this::getOpenDatabaseAction, | ||
| stateManager); | ||
| FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager); |
| undoManager, | ||
| dialogService, | ||
| SearchType.NORMAL_SEARCH); | ||
| this.globalSearchBar = new GlobalSearchBar(this, stateManager, this.preferences, undoManager, dialogService, SearchType.NORMAL_SEARCH); |
| // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. | ||
| new UndoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager), | ||
| new RedoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager)); | ||
| new UndoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager), new RedoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager)); |
| if (libraryTab != toKeepLibraryTab) { | ||
| Platform.runLater(() -> closeTab(libraryTab)); | ||
| } | ||
| List<LibraryTab> libraryTabs = tabbedPane.getTabs().stream().filter(LibraryTab.class::isInstance).map(LibraryTab.class::cast).filter(tab -> tab != toKeepLibraryTab).toList(); |
| List<LibraryTab> libraryTabs = tabbedPane.getTabs().stream().filter(LibraryTab.class::isInstance).map(LibraryTab.class::cast).toList(); | ||
| for (LibraryTab tab : libraryTabs) { | ||
| Platform.runLater(() -> closeTab(tab)); |
There was a problem hiding this comment.
Does this change make reading easier? Because it does not seem to change logic.
| } | ||
|
|
||
| private class CloseOthersDatabaseAction extends SimpleCommand { | ||
| public class CloseOthersDatabaseAction extends SimpleCommand { |
| { | ||
| this.executable.bind(Bindings.createBooleanBinding( | ||
| () -> ActionHelper.needsMultipleDatabases(stateManager).get() && frame.getCurrentLibraryTab() != null, | ||
| stateManager.getOpenDatabases(), stateManager.activeTabProperty())); | ||
| } | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| LibraryTab currentTab = frame.getCurrentLibraryTab(); | ||
| if (currentTab != null) { | ||
| frame.new CloseOthersDatabaseAction(currentTab).execute(); | ||
| } | ||
| } | ||
| }), |
| { | ||
| this.executable.bind(ActionHelper.needsDatabase(stateManager)); | ||
| } | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| frame.new CloseAllDatabaseAction().execute(); | ||
| } |
d20f9c2 to
77c3e22
Compare
| ClipBoardManager clipBoardManager, | ||
| TaskExecutor taskExecutor, | ||
| GitHandlerRegistry gitHandlerRegistry) { | ||
| @SuppressWarnings("checkstyle:EmptyLineSeparator") |
koppor
left a comment
There was a problem hiding this comment.
The issue did not ask for more. Close others can go to the tab context menu; Close all takes too much space (and is used very seldomly). Please remove it
Try to keep the code formatted as is. Use IntellIj IDE to train your (!) development skills.
|
Please take a look at https://github.com/JabRef/jabref/pull/14383/files to see where unneccessary linebreaks were added. |
|
Hi, @calixtus! Thanks for the review. Thanks again for your guidance! |
koppor
left a comment
There was a problem hiding this comment.
Files are still reformatted without reason.
Please check https://github.com/JabRef/jabref/pull/14383/files and ensure that there are only semantic changes; and not only syntactic ones
| this.viewModel = new JabRefFrameViewModel( | ||
| preferences, | ||
| this.viewModel = new JabRefFrameViewModel(preferences, |
| GitHandlerRegistry gitHandlerRegistry) { | ||
| GitHandlerRegistry gitHandlerRegistry | ||
| ) { |
| clipBoardManager, | ||
| taskExecutor); | ||
| taskExecutor | ||
| ); | ||
| Injector.setModelOrService(UiMessageHandler.class, viewModel); |
| FrameDndHandler frameDndHandler = new FrameDndHandler( | ||
| tabbedPane, | ||
| FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane, |
| stateManager); | ||
| stateManager | ||
| ); |
| this.globalSearchBar = new GlobalSearchBar( | ||
| this, | ||
| this.globalSearchBar = new GlobalSearchBar(this, |
| SearchType.NORMAL_SEARCH); | ||
| SearchType.NORMAL_SEARCH | ||
| ); |
|
Did the reformat quickly myself, but kept (and added) some reasonable changes, where the lines exceeded way over average line length. Actual change looks good though. |
|
You ticked that you modified If you made changes that are visible to the user, please add a brief description along with the issue number to the |


Closes #14381
This PR adds three new library-management actions to the File menu:
Previously, these actions were only available in the library tab’s context menu,
making them harder to discover. Adding them to the File menu improves usability,
aligns with common desktop application UX patterns, and provides faster access
to library management operations.
Steps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)