Skip to content

Commit

Permalink
Open entry editor by default on start-up
Browse files Browse the repository at this point in the history
Fixes JabRef#5460

Select the first entry in the main table, and open entry editor
for the same. This action is performed on the application thread.
  • Loading branch information
CaptainDaVinci committed Oct 20, 2019
1 parent dfad2fd commit 96491c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas
this.getDatabase().registerListener(new UpdateTimestampListener(Globals.prefs));

this.entryEditor = new EntryEditor(this, externalFileTypes);
// Open entry editor for first entry on start up.
Platform.runLater(() -> clearAndSelectFirst());
}

@Subscribe
Expand Down Expand Up @@ -867,6 +869,14 @@ public void clearAndSelect(final BibEntry bibEntry) {
mainTable.clearAndSelect(bibEntry);
}

/**
* Select and open entry editor for first entry in main table.
*/
private void clearAndSelectFirst() {
mainTable.clearAndSelectFirst();
showAndEdit();
}

public void selectPreviousEntry() {
mainTable.getSelectionModel().clearAndSelect(mainTable.getSelectionModel().getSelectedIndex() - 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void setupKeyBindings(KeyBindingRepository keyBindings) {
});
}

private void clearAndSelectFirst() {
public void clearAndSelectFirst() {
getSelectionModel().clearSelection();
getSelectionModel().selectFirst();
scrollTo(0);
Expand Down

0 comments on commit 96491c4

Please sign in to comment.