Skip to content

feat: add "Close library" to File menu#14383

Merged
koppor merged 13 commits into
JabRef:mainfrom
SatyamKumarCS:feat/closeLib
Nov 23, 2025
Merged

feat: add "Close library" to File menu#14383
koppor merged 13 commits into
JabRef:mainfrom
SatyamKumarCS:feat/closeLib

Conversation

@SatyamKumarCS

@SatyamKumarCS SatyamKumarCS commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Closes #14381

This PR adds three new library-management actions to the File menu:

  • Close library – closes the currently active library.
  • Close others – closes all libraries except the currently active one.
  • Close all – closes all open libraries.

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

  1. Start JabRef.
  2. Open multiple libraries (e.g., Library A, Library B, Library C).
  3. Go to File → Close library:
    • Only the active library should close.
  4. Go to File → Close others:
    • The active library remains open.
    • All other libraries close.
  5. Go to File → Close all:
    • All open libraries close.
    • JabRef returns to the empty state with no libraries open.
Screenshot 2025-11-22 at 3 11 46 AM

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • I checked the user 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 updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@calixtus calixtus 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.

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) {

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.

Please keep linebreaks

undoManager,
clipBoardManager,
taskExecutor);
this.viewModel = new JabRefFrameViewModel(preferences, aiService, stateManager, dialogService, this, this::getOpenDatabaseAction, entryTypesManager, fileUpdateMonitor, undoManager, clipBoardManager, taskExecutor);

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.

Please keep linebreaks

mainStage::getScene,
this::getOpenDatabaseAction,
stateManager);
FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager);

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.

Please keep linebreaks

undoManager,
dialogService,
SearchType.NORMAL_SEARCH);
this.globalSearchBar = new GlobalSearchBar(this, stateManager, this.preferences, undoManager, dialogService, SearchType.NORMAL_SEARCH);

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.

Please keep linebreaks

// 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));

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.

Please keep linebreaks

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();

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.

Please introduce linebreaks

Comment on lines +618 to +620
List<LibraryTab> libraryTabs = tabbedPane.getTabs().stream().filter(LibraryTab.class::isInstance).map(LibraryTab.class::cast).toList();
for (LibraryTab tab : libraryTabs) {
Platform.runLater(() -> closeTab(tab));

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.

Does this change make reading easier? Because it does not seem to change logic.

}

private class CloseOthersDatabaseAction extends SimpleCommand {
public class CloseOthersDatabaseAction extends SimpleCommand {

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.

static protected?

Comment on lines +181 to +194
{
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();
}
}
}),

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.

Please extract

Comment on lines +196 to +203
{
this.executable.bind(ActionHelper.needsDatabase(stateManager));
}

@Override
public void execute() {
frame.new CloseAllDatabaseAction().execute();
}

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.

Please extract

@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Nov 21, 2025
ClipBoardManager clipBoardManager,
TaskExecutor taskExecutor,
GitHandlerRegistry gitHandlerRegistry) {
@SuppressWarnings("checkstyle:EmptyLineSeparator")

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.

Nope.

@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.

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.

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Nov 23, 2025
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Nov 23, 2025
@SatyamKumarCS

Copy link
Copy Markdown
Contributor Author

Oh. I've now made the changes.

image image

@SatyamKumarCS SatyamKumarCS requested a review from koppor November 23, 2025 11:44
@calixtus

Copy link
Copy Markdown
Member

Please take a look at https://github.com/JabRef/jabref/pull/14383/files to see where unneccessary linebreaks were added.

@SatyamKumarCS

Copy link
Copy Markdown
Contributor Author

Hi, @calixtus! Thanks for the review.
Previously, I had added the line breaks as requested, but I’m having trouble identifying which extra or unnecessary line breaks I introduced. Could you please point me to the exact part of the file or the specific lines where the issue occurs? This will help me take corrective measures.

Thanks again for your guidance!

@calixtus

Copy link
Copy Markdown
Member

@SatyamKumarCS

Copy link
Copy Markdown
Contributor Author

@calixtus @koppor Please check now, I have made all the changes requested.

@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.

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

Comment on lines +147 to +148
this.viewModel = new JabRefFrameViewModel(
preferences,
this.viewModel = new JabRefFrameViewModel(preferences,

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.

Why the reformat?

Comment on lines +131 to +132
GitHandlerRegistry gitHandlerRegistry) {
GitHandlerRegistry gitHandlerRegistry
) {

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.

Why the reformat?

Comment on lines 157 to 160
clipBoardManager,
taskExecutor);
taskExecutor
);
Injector.setModelOrService(UiMessageHandler.class, viewModel);

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.

Why the reformat?

Comment on lines +161 to +162
FrameDndHandler frameDndHandler = new FrameDndHandler(
tabbedPane,
FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane,

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.

Why the reformat?

Comment on lines +165 to +166
stateManager);
stateManager
);

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.

Why the reformat?

Comment on lines +167 to +168
this.globalSearchBar = new GlobalSearchBar(
this,
this.globalSearchBar = new GlobalSearchBar(this,

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.

Why the reformat?

Comment on lines +173 to +174
SearchType.NORMAL_SEARCH);
SearchType.NORMAL_SEARCH
);

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.

Why the reformat?

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Nov 23, 2025
@koppor

koppor commented Nov 23, 2025

Copy link
Copy Markdown
Member

@calixtus @koppor Please check now, I have made all the changes requested.

No. Please respect our wishes that we want to have semantic changes only; not just syntactic changes.

@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Nov 23, 2025
@calixtus

Copy link
Copy Markdown
Member

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.

koppor
koppor previously approved these changes Nov 23, 2025
@jabref-machine

Copy link
Copy Markdown
Collaborator

You ticked that you modified CHANGELOG.md, but no new entry was found there.

If you made changes that are visible to the user, please add a brief description along with the issue number to the CHANGELOG.md file. If you did not, please replace the cross ([x]) by a slash ([/]) to indicate that no CHANGELOG.md entry is necessary. More details can be found in our Developer Documentation about the changelog.

@koppor koppor dismissed calixtus’s stale review November 23, 2025 20:41

Implemented changes.

@koppor koppor added this pull request to the merge queue Nov 23, 2025
Merged via the queue into JabRef:main with commit 92cc09d Nov 23, 2025
49 of 50 checks passed
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.

Add "Close library" to menu

4 participants