-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Click on entry at "Check integrity" focus bug fixed #12022
Changes from 4 commits
173666b
e195313
10f5f10
f7727dc
d8c4aec
9e4390c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,17 @@ | ||
package org.jabref.gui.entryeditor; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.SortedSet; | ||
import java.util.stream.Collectors; | ||
|
||
import com.airhacks.afterburner.views.ViewLoader; | ||
import com.tobiasdiez.easybind.EasyBind; | ||
import com.tobiasdiez.easybind.Subscription; | ||
import jakarta.inject.Inject; | ||
import javafx.application.Platform; | ||
import javafx.fxml.FXML; | ||
import javafx.geometry.Side; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.ContextMenu; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.MenuItem; | ||
import javafx.scene.control.Tab; | ||
import javafx.scene.control.TabPane; | ||
import javafx.scene.control.*; | ||
import javafx.scene.input.DataFormat; | ||
import javafx.scene.input.KeyEvent; | ||
import javafx.scene.input.TransferMode; | ||
import javafx.scene.layout.BorderPane; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.LibraryTab; | ||
import org.jabref.gui.StateManager; | ||
|
@@ -61,18 +47,19 @@ | |
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.entry.BibEntryTypesManager; | ||
import org.jabref.model.entry.EntryConverter; | ||
import org.jabref.model.entry.field.Field; | ||
import org.jabref.model.util.DirectoryMonitorManager; | ||
import org.jabref.model.util.FileUpdateMonitor; | ||
|
||
import com.airhacks.afterburner.views.ViewLoader; | ||
import com.tobiasdiez.easybind.EasyBind; | ||
import com.tobiasdiez.easybind.Subscription; | ||
import jakarta.inject.Inject; | ||
import org.jspecify.annotations.NonNull; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.*; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* GUI component that allows editing of the fields of a BibEntry (i.e. the one that shows up, when you double click on | ||
* an entry in the table) | ||
|
@@ -463,13 +450,30 @@ private void fetchAndMerge(EntryBasedFetcher fetcher) { | |
|
||
public void setFocusToField(Field field) { | ||
UiTaskExecutor.runInJavaFXThread(() -> { | ||
Field actualField = field; | ||
boolean fieldFound = false; | ||
|
||
for (Tab tab : tabbed.getTabs()) { | ||
if ((tab instanceof FieldsEditorTab fieldsEditorTab) | ||
&& fieldsEditorTab.getShownFields().contains(field)) { | ||
&& fieldsEditorTab.getShownFields().contains(actualField)) { | ||
tabbed.getSelectionModel().select(tab); | ||
fieldsEditorTab.requestFocus(field); | ||
Platform.runLater(() -> { | ||
fieldsEditorTab.requestFocus(actualField); | ||
}); | ||
// This line explicitly brings focus back to the main window containing the Entry Editor. | ||
getScene().getWindow().requestFocus(); | ||
Comment on lines
+478
to
+479
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have wrapped that into |
||
fieldFound = true; | ||
break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be a |
||
} | ||
} | ||
|
||
if (!fieldFound) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If guard can be removed if you use return in 481. |
||
Field aliasField = EntryConverter.FIELD_ALIASES.get(field); | ||
if (aliasField != null) { | ||
setFocusToField(aliasField); | ||
} | ||
} | ||
|
||
}); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary as you use recursion in line 484.