Skip to content

Keyword Tooltip/Cleanup for MSC codes added to Keyword Editor #12914

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

Merged
merged 50 commits into from
Jun 2, 2025

Conversation

JustinHennis1
Copy link
Contributor

@JustinHennis1 JustinHennis1 commented Apr 9, 2025

Closes #12944

Created a JSON file to hold key-value pairs of MSC codes to their respective descriptions/classifications by parsing msc_2020.pdf (which was provided in link to zbmath).

Created MscCodeUtils.java class that implements a method to load a JSON file and converts said file into a Map object.

Created ConvertMSCCodesCleanupTest.java, added to panel, and when user selects preference to convert and saves, the codes are converted to descriptions. Alternatively, when unselected, descriptions are reverted back to code.

In KeywordsEditor.java I added a private variable, mscmap, that calls the above method. Using this map object, I added a condition in the create tag method to check if the label text matches any of the keys. If it does, then we initialize a Tooltip and call install onMouseEnter and uninstall onMouseExited.

ToolTip

Screenshot (18)
Screenshot (19)

Cleanup

Before:

jabref_cleanup

After:

jabrefcleanup2

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@@ -50,6 +55,8 @@ public class KeywordsEditor extends HBox implements FieldEditorFX {
private static final Logger LOGGER = LoggerFactory.getLogger(KeywordsEditor.class);
private static final PseudoClass FOCUSED = PseudoClass.getPseudoClass("focused");

private Map<String, String> mscmap = MscCodeUtils.loadMscCodesFromJson("../../resources/main/org/jabref/gui/fieldeditors/msccodes/msc_codes.json");
Copy link
Member

Choose a reason for hiding this comment

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

This won't work inside a jar, you need to use class.getResource

@JustinHennis1 JustinHennis1 reopened this Apr 10, 2025
@Siedlerchr
Copy link
Member

Please fix the failing tests before. This reduces the burden of us maintainers to review incomplete PRs

…iptions, bug: error when trying to cleanup when editor is open
@JustinHennis1 JustinHennis1 reopened this Apr 14, 2025
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

The logic seems to require a JavaFX thread. This must not happen.

Logic should be able to run in a jar file without any gui.

See https://foojay.social/@jabref/114520065589122649

@koppor
Copy link
Member

koppor commented May 19, 2025

jablib/src/main/resources/msc2020.pdf needs to be places in jablib/src/misc/, because it is NOT used at users's side - and thus should not be placed inside the distribution of JabRef. I could not came up with a better name than misc 😅

Co-authored-by: Oliver Kopp <[email protected]>
@JustinHennis1
Copy link
Contributor Author

jablib/src/main/resources/msc2020.pdf needs to be places in jablib/src/misc/, because it is NOT used at users's side - and thus should not be placed inside the distribution of JabRef. I could not came up with a better name than misc 😅

Does this directory exist? jablib/src/misc/ does not exist even after updating my branch with the latest.

@koppor
Copy link
Member

koppor commented May 19, 2025

jablib/src/main/resources/msc2020.pdf needs to be places in jablib/src/misc/, because it is NOT used at users's side - and thus should not be placed inside the distribution of JabRef. I could not came up with a better name than misc 😅

Does this directory exist? jablib/src/misc/ does not exist even after updating my branch with the latest.

You will need to create it.

@JustinHennis1
Copy link
Contributor Author

@koppor I believe I fixed everything from what we've discussed.

@JustinHennis1 JustinHennis1 requested a review from koppor May 27, 2025 00:24
Copy link

trag-bot bot commented May 27, 2025

@trag-bot didn't find any issues in the code! ✅✨

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Looks good - I think, more things can be added follow-up

I am not sure if we should move the conversion to a real formatter -- the idea of the formatters is exactly that what the the current code does.

I know the UX is bad for the formatters, but with the current implementation, the UI gets even more cluttered.

In other words: The contents in "Miscellaneous" are working multi-field, whereas "field formatters" work single field

image

@JustinHennis1
Copy link
Contributor Author

JustinHennis1 commented May 27, 2025 via email

@koppor
Copy link
Member

koppor commented May 27, 2025

The original feature/issue requested a cleanup or button.

I found #12944 (comment). This talks about a button at the keyword field. Should be shown only if any of the keywords is an MSC keyword.

It also talked about a cleanup operation, which I commented using the screenshot 😅

Sorry that we did not unzip the text of that comment.

I can look into this over the coming weekend

Nice! Thank you in advance!

Copy link
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

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

I think this is okay right now and we can do the reworking of the abbrev stuff in another follow up pr

Comment on lines +54 to 57
// Add active jobs from preset panel
for (CleanupPreferences.CleanupStep action : preset.getActiveJobs()) {
jobs.add(toJob(action));
jobs.add(toJob(action));
}
Copy link
Member

Choose a reason for hiding this comment

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

Reads like AI-modified content.

--> indent is wrong and comment could be removed

Could also be done in a follow-up PR

@koppor
Copy link
Member

koppor commented Jun 2, 2025

I filed #13227. @JustinHennis1 You can take it or we hope that someone else takes it.

@koppor koppor added this pull request to the merge queue Jun 2, 2025
Merged via the queue into JabRef:main with commit b309292 Jun 2, 2025
1 check passed
@JustinHennis1
Copy link
Contributor Author

I filed #13227. @JustinHennis1 You can take it or we hope that someone else takes it.

I have the FieldFormatter implemented locally, I just need to remove the cleanup and change the tests. Would the easiest way be to create a new fork on Github? I don't want to lose the changes I made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Mathematics Subject Classification as tooltip to keywords
4 participants