-
-
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
Fix paste of BibTeX data #9985
Fix paste of BibTeX data #9985
Conversation
- JabRefFrame: Use unusaed variable - EditAction: Keep order of actions consistent - MainTable: Prevent unnecessary object construction
Your code currently does not meet JabRef's code guidelines. The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues. More information on code quality in JabRef is available at https://devdocs.jabref.org/getting-into-the-code/development-strategy.html. |
@@ -150,7 +146,9 @@ public void setContent(List<BibEntry> entries) throws IOException { | |||
final ClipboardContent content = new ClipboardContent(); | |||
BibEntryWriter writer = new BibEntryWriter(new FieldWriter(preferencesService.getFieldPreferences()), Globals.entryTypesManager); | |||
String serializedEntries = writer.serializeAll(entries, BibDatabaseMode.BIBTEX); | |||
content.put(DragAndDropDataFormats.ENTRIES, serializedEntries); |
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.
Why do you remove setting them for the DragAndDropDataFormat here? I think this was also neceessary for drag and drop with groups
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.
Drag drop is handled differently.
I checked all usages of the variable carefully.
Example code:
if (!dragboard.hasContent(DragAndDropDataFormats.GROUP)) {
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.
but that is for drag and drop between groups. Not entries
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.
I still assume that dragstrop is handled by dragophandler and not by the copy functionality. Dragging is iMho natively supported by JavaFX and we do not need to emulate it via copy and paste. This is how I understood the existing code. I checked drag and drop, too
@@ -349,8 +353,8 @@ private List<BibEntry> handleNonBibTeXStringData() { | |||
} else { | |||
dialogService.showErrorDialogAndWait(exception); | |||
} | |||
return List.of(); |
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.
List.of is unmodiefable. Be careful
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.
I checked the calling code and also tried out locally.
In general, the list of entries in the clipboard should not be modified. -- If someone pastes twice and continues working, this should not be modified. I thought, this behavior is also "expected" for immediate code handling pasted data.
Soemtimes, I lean to follow https://github.com/HugoMatilla/Effective-JAVA-Summary#15-minimize-mutability, but I think, its very hard to implement (and causes much more resources).
* upstream/main: (68 commits) Fix issue 9863 - Change Tab selection order (#9907) New Crowdin updates (#9994) Enable editing typo with double clicking on field name in custom entry type (#9977) Remove "Field name:" from localization - we already have "Field name" (#9991) Changed database to catalog in org.jabref.gui.slr and org.jabref.logic.crawler (#9989) Use environment variables for hostname detection (#9910) Add cleanup activity for URL field (#9970) Fix freezing when fetching IBSN and no results are found (#9987) Make Group(Node)TreeViewModel more OO (#9978) Fix container for group item count still visible if display count is off (#9980) Fix paste of BibTeX data (#9985) Bring back SimplifyBoolean* and UnnecessaryParantheses (and refine guide) (#9981) Add new menu entry to remove braces from selection, aka unprotect it. (#9968) User specific comment (#9727) Bump org.openrewrite.recipe:rewrite-recipe-bom from 1.19.3 to 2.0.0 (#9975) Fix typos Remove non-needed link Fix typos Enable RemoveJavaDocAuthorTag (#9973) Bump com.fasterxml.jackson.datatype:jackson-datatype-jsr310 (#9974) ...
Fixes https://github.com/JabRef/jabref-issue-melting-pot/issues/187.
No CHANGELOG.md entry, because it worked in 5.9
In the first commit, I did some code improvements:
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)