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

Show a welcome screen if no database is open #12461

Merged
merged 70 commits into from
Mar 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
08ec5d8
Fix #12272 - Show a welcome screen if no database is open
oops-shlok Feb 4, 2025
684f7df
Fix #12272 - Fix missing localisation keys for WelcomePage
oops-shlok Feb 4, 2025
3759e24
Fix #12272 - Fix missing localisation keys for WelcomePage
oops-shlok Feb 4, 2025
9fc595d
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 5, 2025
4e576e9
Fix #12272 - Addressed 1st Review Changes
oops-shlok Feb 5, 2025
52409bd
Fix #12272 - Checkstyle issue fix in ExportCommand file
oops-shlok Feb 5, 2025
f130244
Reverted csl-styles submodule changes
oops-shlok Feb 5, 2025
2559f22
Reverted abbrv.jabref.org submodule changes
oops-shlok Feb 5, 2025
0d240c9
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 6, 2025
cb05ec7
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 11, 2025
0489da1
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 13, 2025
669083d
Integrated WelcomePage in WelcomeTab and code changes
oops-shlok Feb 13, 2025
cf3188e
Implemented Review Changes 5
oops-shlok Feb 14, 2025
e5a4840
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 14, 2025
d4332c6
Fix #12272 - Localization key fix in JabRef_en.properties
oops-shlok Feb 14, 2025
c11ca80
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 17, 2025
5c0b6ee
Implemented Open Welcome tab in help menu option and open welcome tab…
oops-shlok Feb 17, 2025
f97be18
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 18, 2025
cdc1977
Implemented Review Changes 6
oops-shlok Feb 18, 2025
7db3b81
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 23, 2025
4de4651
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Feb 25, 2025
815ba53
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 26, 2025
c401e67
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 4, 2025
dea3f05
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 4, 2025
40c4ca3
Reverted Interface changes and fixed save as and save for welcome tab
oops-shlok Mar 4, 2025
a8ee2c8
Fixed checkstyle import issue
oops-shlok Mar 4, 2025
f048c4b
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 4, 2025
0e5ed41
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 6, 2025
76b1aba
Simplify and fix casting
calixtus Mar 6, 2025
970d7e8
Fix casting
calixtus Mar 6, 2025
fbf3405
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 7, 2025
5e199c4
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 7, 2025
e373b34
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 8, 2025
fc78dc5
Fixed Responsiveness
oops-shlok Mar 8, 2025
66ccb58
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 10, 2025
1e24223
Undo newlines in MainToolBar.java
calixtus Mar 10, 2025
8efa826
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 11, 2025
5196593
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 11, 2025
afa8b54
Added Footer for Welcome Tab
oops-shlok Mar 11, 2025
d920d6c
Fixed Localization issues
oops-shlok Mar 11, 2025
5aa63d2
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 17, 2025
fcc5be3
Fixed Recents Library issue
oops-shlok Mar 17, 2025
a6d50e2
Fixed Tragbot review for Footer
oops-shlok Mar 17, 2025
2f9811f
Refactored the code as suggested in review comments
oops-shlok Mar 17, 2025
8885b4d
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
721a77f
Introduced URLs Util
oops-shlok Mar 17, 2025
6744ec2
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
22347f8
Fixed Localization issues
oops-shlok Mar 17, 2025
a8ac3e5
Fixed Localization issues
oops-shlok Mar 17, 2025
cc78bbe
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
cd11463
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
efc4767
Fixed Localization issues
oops-shlok Mar 17, 2025
c0a4696
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 17, 2025
8aed6f7
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
7ba378d
Fixed missing Localization in WelcomeTab
oops-shlok Mar 17, 2025
95a93eb
Fixed missing Localization in WelcomeTab
oops-shlok Mar 17, 2025
0e786cc
Fixed Review changes
oops-shlok Mar 17, 2025
f6a5587
Added Changelog entry
oops-shlok Mar 17, 2025
ba1ad6f
Update src/main/java/org/jabref/gui/frame/JabRefFrame.java
koppor Mar 19, 2025
23891b6
Update src/main/java/org/jabref/gui/WelcomeTab.java
koppor Mar 19, 2025
4bc74b6
Update src/main/java/org/jabref/gui/frame/JabRefFrame.java
koppor Mar 19, 2025
0076919
Fixed Localization issue
oops-shlok Mar 19, 2025
a71d9fb
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 19, 2025
3c14ba8
Fix position of showing welcome tab
koppor Mar 19, 2025
c94fb15
Streamline wording
koppor Mar 19, 2025
c695f5b
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
koppor Mar 19, 2025
5115579
Remove obsolete strings
koppor Mar 19, 2025
f7c0c3b
Fix obsolete code
koppor Mar 19, 2025
5d84d89
Fix comment
koppor Mar 19, 2025
37e24d2
Fix localization
koppor Mar 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reverted Interface changes and fixed save as and save for welcome tab
oops-shlok committed Mar 4, 2025
commit 40c4ca30faa208e32f9683de9624dd65929d3a73
5 changes: 0 additions & 5 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
@@ -810,11 +810,6 @@ private void onClosed(Event event) {
tableModel.unbind();
}

// This check is needed, because the WelcomeTab is a tab, but not a database.
if (stateManager.getOpenDatabases().isEmpty() && stateManager.activeDatabaseProperty().isPresent().get()) {
stateManager.activeDatabaseProperty().setValue(Optional.empty());
}

// clean up the groups map
stateManager.clearSelectedGroups(bibDatabaseContext);
}
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/LibraryTabContainer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.jabref.gui;

import java.util.List;
import java.util.Optional;

import org.jabref.model.database.BibDatabaseContext;

@@ -14,7 +13,7 @@ public interface LibraryTabContainer {
List<LibraryTab> getLibraryTabs();

@Nullable
Optional<LibraryTab> getCurrentLibraryTab();
LibraryTab getCurrentLibraryTab();

void showLibraryTab(LibraryTab libraryTab);

Original file line number Diff line number Diff line change
@@ -60,9 +60,7 @@ public FromAuxDialogViewModel(LibraryTabContainer tabContainer,
this.stateManager = stateManager;

librariesProperty.setAll(stateManager.getOpenDatabases());
selectedLibraryProperty.set(
Objects.requireNonNull(tabContainer.getCurrentLibraryTab()).map(LibraryTab::getBibDatabaseContext).orElse(null)
);
selectedLibraryProperty.set(tabContainer.getCurrentLibraryTab().getBibDatabaseContext());
EasyBind.listen(selectedLibraryProperty, (obs, oldValue, newValue) -> {
if (auxParserResult != null) {
parse();
59 changes: 22 additions & 37 deletions src/main/java/org/jabref/gui/frame/JabRefFrame.java
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import javafx.collections.transformation.FilteredList;
import javafx.event.Event;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.SplitPane;
import javafx.scene.control.Tab;
@@ -137,10 +136,7 @@ public JabRefFrame(Stage mainStage,
}
});

this.fileHistory.getItems().addListener((ListChangeListener<MenuItem>) change -> {
boolean hasRecentFiles = !fileHistory.getItems().isEmpty();
fileHistory.setDisable(!hasRecentFiles);
});
fileHistory.disableProperty().bind(Bindings.isEmpty(fileHistory.getItems()));

setId("frame");

@@ -252,21 +248,11 @@ private void initLayout() {
}

splitPane.getItems().add(tabbedPane);
setCenter(splitPane);
SplitPane.setResizableWithParent(sidePane, false);
sidePane.widthProperty().addListener(_ -> updateSidePane());
sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane());
updateSidePane();
updateContent();
}

private void updateContent() {
boolean hasRecentFiles = !fileHistory.getItems().isEmpty();
fileHistory.setDisable(!hasRecentFiles);
}

private void bindDatabaseChanges() {
stateManager.getOpenDatabases().addListener((InvalidationListener) obs -> Platform.runLater(this::updateContent));
setCenter(splitPane);
}

private void updateSidePane() {
@@ -296,7 +282,7 @@ private void initKeyBindings() {
if (keyBinding.isPresent()) {
switch (keyBinding.get()) {
case FOCUS_ENTRY_TABLE:
Objects.requireNonNull(getCurrentLibraryTab()).ifPresent(tab -> tab.getMainTable().requestFocus());
getCurrentLibraryTab().getMainTable().requestFocus();
event.consume();
break;
case FOCUS_GROUP_LIST:
@@ -318,31 +304,31 @@ private void initKeyBindings() {
globalSearchBar.openGlobalSearchDialog();
break;
case NEW_ARTICLE:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.Article, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Article, dialogService, preferences, stateManager).execute();
break;
case NEW_BOOK:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.Book, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Book, dialogService, preferences, stateManager).execute();
break;
case NEW_INBOOK:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.InBook, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.InBook, dialogService, preferences, stateManager).execute();
break;
case NEW_MASTERSTHESIS:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.MastersThesis, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.MastersThesis, dialogService, preferences, stateManager).execute();
break;
case NEW_PHDTHESIS:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.PhdThesis, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.PhdThesis, dialogService, preferences, stateManager).execute();
break;
case NEW_PROCEEDINGS:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.Proceedings, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Proceedings, dialogService, preferences, stateManager).execute();
break;
case NEW_TECHREPORT:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.TechReport, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.TechReport, dialogService, preferences, stateManager).execute();
break;
case NEW_UNPUBLISHED:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.Unpublished, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.Unpublished, dialogService, preferences, stateManager).execute();
break;
case NEW_INPROCEEDINGS:
new NewEntryAction(() -> Objects.requireNonNull(getCurrentLibraryTab()).orElse(null), StandardEntryType.InProceedings, dialogService, preferences, stateManager).execute();
new NewEntryAction(this::getCurrentLibraryTab, StandardEntryType.InProceedings, dialogService, preferences, stateManager).execute();
break;
case PASTE:
if (OS.OS_X) { // Workaround for a jdk issue that executes paste twice when using cmd+v in a TextField
@@ -366,15 +352,15 @@ private void initBindings() {
filteredTabs.setPredicate(LibraryTab.class::isInstance);

// This variable cannot be inlined, since otherwise the list created by EasyBind is being garbage collected
openDatabaseList = EasyBind.map(filteredTabs, tab -> Optional.of((LibraryTab) tab).map(LibraryTab::getBibDatabaseContext).orElse(null));
openDatabaseList = EasyBind.map(filteredTabs, tab -> ((LibraryTab) tab).getBibDatabaseContext());
EasyBind.bindContent(stateManager.getOpenDatabases(), openDatabaseList);

// the binding for stateManager.activeDatabaseProperty() is at org.jabref.gui.LibraryTab.onDatabaseLoadingSucceed

// Subscribe to the search
EasyBind.subscribe(stateManager.activeSearchQuery(SearchType.NORMAL_SEARCH), query -> {
if (getCurrentLibraryTab().isPresent()) {
getCurrentLibraryTab().ifPresent(tab -> tab.searchQueryProperty().set(query));
if (getCurrentLibraryTab() != null) {
getCurrentLibraryTab().searchQueryProperty().set(query);
}
});

@@ -386,8 +372,8 @@ private void initBindings() {
if (selectedTab instanceof LibraryTab libraryTab) {
stateManager.setActiveDatabase(libraryTab.getBibDatabaseContext());
stateManager.activeTabProperty().set(Optional.of(libraryTab));
} else if (selectedTab == null) {
// All databases are closed
} else if (selectedTab == null || selectedTab instanceof WelcomeTab) {
// All databases are closed or Welcome Tab is open
Copy link
Member

Choose a reason for hiding this comment

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

Use {@link ...} here in the comment :)

Copy link
Member

Choose a reason for hiding this comment

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

I implemented.

stateManager.setActiveDatabase(null);
stateManager.activeTabProperty().set(Optional.empty());
}
@@ -463,10 +449,9 @@ private void updateTabBarVisible() {
/**
* Returns the currently viewed LibraryTab.
*/
public Optional<LibraryTab> getCurrentLibraryTab() {
return Optional.ofNullable(tabbedPane.getSelectionModel().getSelectedItem())
.filter(LibraryTab.class::isInstance)
.map(LibraryTab.class::cast);
public LibraryTab getCurrentLibraryTab() {
return (LibraryTab) Optional.ofNullable(tabbedPane.getSelectionModel().getSelectedItem())
.filter(tab -> tab instanceof LibraryTab).orElse(null);
}

public void showLibraryTab(@NonNull LibraryTab libraryTab) {
@@ -666,11 +651,11 @@ public CloseDatabaseAction(LibraryTabContainer tabContainer, StateManager stateM
public void execute() {
Platform.runLater(() -> {
if (libraryTab == null) {
if (Objects.requireNonNull(tabContainer.getCurrentLibraryTab()).isEmpty()) {
if (tabContainer.getCurrentLibraryTab() == null) {
LOGGER.error("No library tab to close");
return;
}
tabContainer.getCurrentLibraryTab().ifPresent(tabContainer::closeTab);
tabContainer.closeTab(tabContainer.getCurrentLibraryTab());
} else {
tabContainer.closeTab(libraryTab);
}
12 changes: 6 additions & 6 deletions src/main/java/org/jabref/gui/frame/JabRefFrameViewModel.java
Original file line number Diff line number Diff line change
@@ -125,10 +125,10 @@ public boolean close() {
.map(BibDatabaseContext::getDatabasePath)
.flatMap(Optional::stream)
.toList();
Path focusedLibraries = Objects.requireNonNull(tabContainer.getCurrentLibraryTab())
.map(LibraryTab::getBibDatabaseContext)
.flatMap(BibDatabaseContext::getDatabasePath)
.orElse(null);
Path focusedLibraries = Optional.ofNullable(tabContainer.getCurrentLibraryTab())
.map(LibraryTab::getBibDatabaseContext)
.flatMap(BibDatabaseContext::getDatabasePath)
.orElse(null);

// Then ask if the user really wants to close, if the library has not been saved since last save.
if (!tabContainer.closeTabs(tabContainer.getLibraryTabs())) {
@@ -380,7 +380,7 @@ private Optional<LibraryTab> getLibraryTab(ParserResult parserResult) {
private void addParserResult(ParserResult parserResult, boolean raisePanel) {
if (parserResult.toOpenTab()) {
LOGGER.trace("Adding the entries to the open tab.");
LibraryTab libraryTab = Objects.requireNonNull(tabContainer.getCurrentLibraryTab()).orElse(null);
LibraryTab libraryTab = tabContainer.getCurrentLibraryTab();
if (libraryTab == null) {
LOGGER.debug("No open tab found to add entries to. Creating a new tab.");
tabContainer.addTab(parserResult.getDatabaseContext(), raisePanel);
@@ -455,7 +455,7 @@ private void waitForLoadingFinished(Runnable runnable) {

private void jumpToEntry(String entryKey) {
// check current library tab first
LibraryTab currentLibraryTab = Objects.requireNonNull(tabContainer.getCurrentLibraryTab()).orElse(null);
LibraryTab currentLibraryTab = tabContainer.getCurrentLibraryTab();
List<LibraryTab> sortedTabs = tabContainer.getLibraryTabs().stream()
.sorted(Comparator.comparing(tab -> tab != currentLibraryTab))
.toList();
Loading