Skip to content

Commit

Permalink
Always select entry in main table when showing entry editor
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Oct 30, 2024
1 parent 7232836 commit da9f515
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
25 changes: 14 additions & 11 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ public void editEntryAndFocusField(BibEntry entry, Field field) {
Platform.runLater(() -> {
// Focus field and entry in main table (async to give entry editor time to load)
entryEditor.setFocusToField(field);
clearAndSelect(entry);
});
}

Expand Down Expand Up @@ -567,11 +566,15 @@ public EntryEditor getEntryEditor() {
}

/**
* Sets the entry editor as the bottom component in the split pane. If an entry editor already was shown, makes sure that the divider doesn't move. Updates the mode to SHOWING_EDITOR. Then shows the given entry.
* Sets the entry editor as the bottom component in the split pane. If an entry editor already was shown, makes sure that the divider doesn't move. Updates the mode to {@link PanelMode#MAIN_TABLE_AND_ENTRY_EDITOR}.
* Then shows the given entry.
*
* Additionally, selects the entry in the main table - so that the selected entry in the main table always corresponds to the edited entry.
*
* @param entry The entry to edit.
*/
public void showAndEdit(BibEntry entry) {
this.clearAndSelect(entry);
if (!splitPane.getItems().contains(entryEditor)) {
splitPane.getItems().addLast(entryEditor);
mode = PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR;
Expand Down Expand Up @@ -889,16 +892,16 @@ public void insertEntry(final BibEntry bibEntry) {
}

public void insertEntries(final List<BibEntry> entries) {
if (!entries.isEmpty()) {
importHandler.importCleanedEntries(entries);

// Create an UndoableInsertEntries object.
getUndoManager().addEdit(new UndoableInsertEntries(bibDatabaseContext.getDatabase(), entries));
if (entries.isEmpty()) {
return;
}

markBaseChanged();
if (preferences.getEntryEditorPreferences().shouldOpenOnNewEntry()) {
showAndEdit(entries.getFirst());
}
importHandler.importCleanedEntries(entries);
getUndoManager().addEdit(new UndoableInsertEntries(bibDatabaseContext.getDatabase(), entries));
markBaseChanged();
if (preferences.getEntryEditorPreferences().shouldOpenOnNewEntry()) {
showAndEdit(entries.getFirst());
} else {
clearAndSelect(entries.getFirst());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ private void jumpToEntry(CitationRelationItem entry) {
citingTask.cancel();
citedByTask.cancel();
libraryTab.showAndEdit(entry.localEntry());
libraryTab.clearAndSelect(entry.localEntry());
}

/**
Expand Down

0 comments on commit da9f515

Please sign in to comment.