Skip to content

feat: select correct tab for creation of new entry (#13087)#13091

Merged
koppor merged 6 commits into
JabRef:mainfrom
lydia-yan:fix-for-issue-13087
May 11, 2025
Merged

feat: select correct tab for creation of new entry (#13087)#13091
koppor merged 6 commits into
JabRef:mainfrom
lydia-yan:fix-for-issue-13087

Conversation

@lydia-yan

Copy link
Copy Markdown
Contributor

Select correct tab for creation of new entry (#13087)
Closes #13087

Summary of changes

This PR improves the user experience when creating new entries. If the clipboard contains a valid identifier (like a DOI), the 'Enter Identifier' tab will now be automatically selected, and the identifier will be pre-filled.

Changes made:

  • Automatically select "Enter identifier" tab when clipboard contains valid identifier
  • Automatically populate the input field with clipboard content
  • If no valid identifier is found, the dialog falls back to the previously used approach from preferences.

Screenshots

Before:
Before

After:
After
Screen Recording 2025-05-09 at 6 18 38 PM

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 (not 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: No update needed
  • Checked documentation: No update needed

Collaborators

@lydia-yan @yoasaaa @brandon-lau0 @FlyJoanne

Comment thread jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java Outdated
BibEntry tempEntry = new BibEntry().withField(StandardField.DOI, clipboardText);
IdentifierParser parser = new IdentifierParser(tempEntry);

if (parser.parse(StandardField.DOI).isPresent()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please add a clarifying comment here that we put every kind of identifier from the clipboard in the temp DOI field because it also works for isbn or arxiv

@Siedlerchr

Copy link
Copy Markdown
Member

thanks for your contribution! LGTM from my side!

@Siedlerchr

Copy link
Copy Markdown
Member

Oh and while you are on it: If I enter a invalid identifier and I get the dialog " A Network error occured" and I close this dialog, both ok and cancel buttons are disabeld:
grafik

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue description only superficially checked

public Optional<? extends Identifier> parse(Field field) {

The "better" code is org.jabref.logic.importer.CompositeIdFetcher#containsValidId

Add a new static method to CompositeIdFetcher

public static Optional<Identifier> getIdentifeir(String identifier) {
...

Use the fail-fast principle (not as in the current implementation)

Then rewrite containsValidId to use that method an return ...isPresent()

Sorry for the extra effort, but sometimes one sees the "better" way when reading a possible solutin.

@lydia-yan lydia-yan requested a review from koppor May 10, 2025 22:53
@trag-bot

trag-bot Bot commented May 11, 2025

Copy link
Copy Markdown

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

@koppor koppor enabled auto-merge May 11, 2025 18:47
@koppor

koppor commented May 11, 2025

Copy link
Copy Markdown
Member

@lydia-yan Thank you for the quick and good follow up! I activated auto-merge; your contribution should be in JabRef's main branch in approx. 30 minutes.

@koppor koppor added this pull request to the merge queue May 11, 2025
@lydia-yan

Copy link
Copy Markdown
Contributor Author

Ok! Thank you all for your quick and constructive feedback!

Merged via the queue into JabRef:main with commit 7cf4848 May 11, 2025
1 check passed
@koppor

koppor commented May 11, 2025

Copy link
Copy Markdown
Member

@lydia-yan I got one more thing: Instead of "Automatically determine identifier type", the determined type could be selected

I tried with 10.1109/MCOM.2010.5673082:

As is:

image

to be

image

Do you have time for a follow-up or should I create an issue for other contributors?

@lydia-yan

Copy link
Copy Markdown
Contributor Author

@koppor I’m happy to handle that! Should I create a new PR after I finish it?

@koppor

koppor commented May 11, 2025

Copy link
Copy Markdown
Member

@koppor I’m happy to handle that! Should I create a new PR after I finish it?

Happy to hear! Yes, start from the main branch again (upstream/main to be exact), create a new branch and work from there.

Siedlerchr added a commit that referenced this pull request May 12, 2025
…ddLobidIsbnFetcher

* 'addLobidIsbnFetcher' of github.com:JabRef/jabref: (26 commits)
  Bump com.konghq:unirest-java-core from 4.4.6 to 4.4.7 (#13104)
  Bump ai.djl:bom from 0.32.0 to 0.33.0 (#13106)
  Bump org.openrewrite.rewrite from 7.5.0 to 7.6.1 (#13105)
  Bump com.tngtech.archunit:archunit-junit5-engine from 1.4.0 to 1.4.1 (#13103)
  Bump com.konghq:unirest-modules-gson from 4.4.6 to 4.4.7 (#13102)
  Bump jablib/src/main/resources/csl-styles from `b8070a7` to `9b777f6` (#13101)
  Refine http sever doc (#13100)
  Add type "Bug" (#13099)
  Fix dash
  feat: select correct tab for creation of new entry (#13087) (#13091)
  Add missing empty line
  Fix notarization flag (#13095)
  Add more options to ADR-044 (#13098)
  Update year (#13097)
  Add ADR for migration from Apache Commons to Picocli (#13096)
  fix-localization (#13092)
  Fix condition for "comment-on-pr"
  fix-git-version (#13093)
  hotfix: enable ea build also on label added
  Check label "dev: binary" for upload to builds.jabref.org (#13086)
  ...
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.

Select correct tab for creation of new entry

3 participants