JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.6k stars 2.57k forks source link

Double paste using `Cmd` + `V` on mac os inside the 'new entry from plain text' dialog #9367

Closed Bushuo closed 1 year ago

Bushuo commented 1 year ago

JabRef version

5.7 (latest release)

Operating system

macOS

Details on version and operating system

mac os Monterey 12.6 on M1 Air

Checked with the latest development build

Steps to reproduce the behaviour

  1. Load a bibtex reference into the clipboard like this one:

    
    @phdthesis{,
    author = {Braun, Felix},
    title = {Application of algorithm-based validation tools for the validation of complex, multi-variant products},
    editor = {},
    booktitle = {},
    series = {},
    journal = {},
    address = {},
    publisher = {},
    edition = {},
    year = {2021},
    isbn = {},
    volume = {},
    number =  {},
    pages = {},
    url = {},
    doi = {},
    keywords = {variant-oriented product portfolios; portfolio validation; portfolio verification; multi-variant products; boolean rules; algorithm-based validation tools},
    abstract = {Based on trends like mass-customization and the individualisation of mass products also in the vehicle manufacturing industry, multi-variant product portfolios are usually required to account for all the necessary variance. As this work is based on a research cooperation between university and a large commercial vehicle manufacturer, such types of a product portfolio are closely observed. In these types of product portfolios, large sets of Boolean portfolio rules are used to describe the product portfolio with all its variants. In the same time, numerous departments within engineering, sales and production work on these portfolio rules with different information flows and perspectives. Therefore, it is difficult to maintain a fully valid and consistent state of the portfolio over time. This is especially challenging, as advanced tools and algorithms are necessary to ensure validity, as the amount of rules and interdependencies is too large to be handled manually in complex product portfolios. This research examines the different types of multi-variant product portfolio descriptions and its requirements regarding validity and consistency described in recent literature. Based on the definition of how validity is reached within a portfolio, existing approaches on how to ensure this validity over time are explained. Taking these findings into account, the current gap in research is identified: neither exists a concise definition of portfolio validity, nor is an integral approach or process presented to ensure validity in the practical application. Therefore, this research proposes a concise definition of the requirements leading to validity within complex, multi-variant product portfolios. Based on these requirements, an integral approach, a procedural model, is proposed to achieve and maintain validity within complex, multi-variant product portfolios. This approach is explained in detail in the main section of this work. This procedural model is implemented in a real-world industry example in the form of a case study jointly executed with the industry partner. In this case study, a fully valid state of the product portfolio, according to the predefined requirements, can be achieved. Hereby, both the applicability and the validity of the proposed procedural model are shown. Finally, the main findings are outlined: a generic data model and documentation logic for complex, multi-variant product portfolios exist. On this basis, general requirements on the validity of a product portfolio definition can be stated. With the help of existing validation tools and algorithms, a procedural model can be used to guide and structure the validation process of the portfolio rules. When this process is being followed, a fully valid state of the product portfolio and its rules can be reached.  This work also helps the industry partner in the commercial vehicle industry to structure and perform its portfolio validation process as part of its daily business.},
    note = {},
    
    school = {Universität der Bundeswehr München},

}



2. Open the 'New entry from plaintext' dialog
3. Paste the clipboard using <kbd>Cmd</kbd> + <kbd>V</kbd>
4. See that an additional entry is created behind the dialog in the main table

### Appendix

<img width="1254" alt="image" src="https://user-images.githubusercontent.com/9990578/201201077-ed4c7f1d-f013-49c2-b464-57e6fad89ee9.png">

Right after pressing <kbd>Cmd</kbd> + <kbd>V</kbd> the entry in the top row is created.
<img width="1254" alt="image" src="https://user-images.githubusercontent.com/9990578/201201251-8bc1aeae-ae5b-402d-80c4-316453ce87b6.png">

Expected behavior:
The entry is only created after pressing 'Add to current library‘
Bushuo commented 1 year ago

If I can be of any help, I have programming experience and Java knowledge. I would just need someone to point me in the right direction 🎉

Siedlerchr commented 1 year ago

Thanks for your interest! Any help is appreciated! The key issue is that JavaFX still has a bug that a key combination like copy or pasting also triggers the menu items and so generates events twice.

https://bugs.openjdk.org/browse/JDK-8205915.

Codwise you would need to check at some place where the focus is https://github.com/JabRef/jabref/blob/25b6858741fea4c8b84c7889d23061109aca5108/src/main/java/org/jabref/gui/JabRefFrame.java#L335-L342

There are also a couple of other related issues Might be related #9096

github-actions[bot] commented 1 year ago

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

Bushuo commented 1 year ago

Thanks for the info :) I will give it a try over the weekend.

vigneshdurairaj commented 1 year ago

Is the issue still open? Can i work on this?

vigneshdurairaj commented 1 year ago

The menuitem for paste declared in edit menu(screenshot of the code is attaced) is root cause of the replication. Its action get triggered, when cmd+v is pressed inside the 'New entry from plaintext' dialog. Unable to find out which listener is doing this. Note: the stagemanager says focusowner is MainTable, unable to capture the keybinding inside the event listener in MainTable. Screenshot of the debugger is also attached. Screenshot 2023-03-30 at 3 31 15 AM Screenshot 2023-03-30 at 3 39 14 AM

Can I get some help in finding the part of code that causes this issue?