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

On clicking on the symbol in the consistency check results table select the respective field #12658

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.stream.Collectors;

import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.collections.ListChangeListener;
import javafx.collections.transformation.FilteredList;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
Expand All @@ -26,6 +25,7 @@
import org.jabref.logic.quality.consistency.ConsistencyMessage;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.field.SpecialField;
import org.jabref.model.entry.field.StandardField;

import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;
Expand Down Expand Up @@ -62,13 +62,6 @@ public ConsistencyCheckDialog(LibraryTab libraryTab,
.setAsDialogPane(this);
}

private void onSelectionChanged(ListChangeListener.Change<? extends ConsistencyMessage> change) {
if (change.next()) {
change.getAddedSubList().stream().findFirst().ifPresent(message ->
libraryTab.showAndEdit(message.bibEntry()));
}
}

public ConsistencyCheckDialogViewModel getViewModel() {
return viewModel;
}
Expand All @@ -77,8 +70,6 @@ public ConsistencyCheckDialogViewModel getViewModel() {
public void initialize() {
viewModel = new ConsistencyCheckDialogViewModel(dialogService, preferences, entryTypesManager, result);

tableView.getSelectionModel().getSelectedItems().addListener(this::onSelectionChanged);

entryTypeCombo.getItems().addAll(viewModel.getEntryTypes());
entryTypeCombo.valueProperty().bindBidirectional(viewModel.selectedEntryTypeProperty());
EasyBind.listen(entryTypeCombo.getEditor().textProperty(), observable -> entryTypeCombo.commitValue());
Expand Down Expand Up @@ -124,6 +115,22 @@ protected void updateItem(String item, boolean empty) {
setText(item);
}
);

this.setOnMouseClicked(event -> {
if (!isEmpty()) {
TableColumn<?, ?> clickedColumn = getTableColumn();

ConsistencyMessage selectedMessage = getTableRow().getItem();
Optional<StandardField> field = StandardField.fromName(clickedColumn.getText());

if (field.isPresent()) {
libraryTab.editEntryAndFocusField(selectedMessage.bibEntry(), field.get());
} else {
libraryTab.showAndEdit(selectedMessage.bibEntry());
dialogService.notify(Localization.lang("Field does not exist in the editor!"));
}
}
});
}
});

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ required\ field\ is\ present=required field is present
optional\ field\ is\ present=optional field is present
unknown\ field\ is\ present=unknown field is present
field\ is\ absent=field is absent
Field\ does\ not\ exist\ in\ the\ editor!=Field does not exist in the editor!
Copy link
Member

Choose a reason for hiding this comment

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

Avoid exclamation marks at the end of a sentence. They are more for screaming. Use a dot to end the sentence.


Consistency\ check\ completed=Consistency check completed
No\ file\ specified\ for\ consistency\ check.=No file specified for consistency check.
Expand Down
Loading