-
-
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
Copy to option #12374
base: main
Are you sure you want to change the base?
Copy to option #12374
Conversation
…lusion and save user preference
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.
Your code currently does not meet JabRef's code guidelines.
We use Checkstyle to identify issues.
Please carefully follow the setup guide for the codestyle.
Afterwards, please run checkstyle locally and fix the issues.
In case of issues with the import order, double check that you activated Auto Import.
You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports.
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.
Your code currently does not meet JabRef's code guidelines.
We use Checkstyle to identify issues.
Please carefully follow the setup guide for the codestyle.
Afterwards, please run checkstyle locally and fix the issues.
In case of issues with the import order, double check that you activated Auto Import.
You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports.
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.
Your code currently does not meet JabRef's code guidelines.
We use Checkstyle to identify issues.
Please carefully follow the setup guide for the codestyle.
Afterwards, please run checkstyle locally and fix the issues.
In case of issues with the import order, double check that you activated Auto Import.
You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports.
Please review it and provide any suggestions. |
We will do, please keep in mind that all maintainers work at jabref in
their leisure time despite having a full time job. I will try to look into
it tomorrow.
Priyanshu Gupta ***@***.***> schrieb am Sa., 11. Jan. 2025,
20:38:
… Please review it and provide any suggestions.
—
Reply to this email directly, view it on GitHub
<#12374 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFZA3TI5CFOYLSVHGPHL2KFXKDAVCNFSM6AAAAABU5GXCISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBVGM4DMMJUGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Apologies, and thanks for the update! I understand, and I really appreciate your time. |
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.
Comments on first look.
public void execute() { | ||
Logger logger = LoggerFactory.getLogger(CopyTo.class); | ||
|
||
BibDatabaseContext databaseContext = new BibDatabaseContext(); |
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.
Not needed here.
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.
Sure, I will remove them, considering it is a draft PR. I left them for explanatory purposes.
for (String title: titles) { | ||
logger.info("Selected Entreis: " + title); | ||
} | ||
for (String checkedPath: checkedPaths) { | ||
logger.info("Selected Libraries to copy: " + checkedPath); | ||
} |
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.
Remove (loops with no utility apart from logging)
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.
Logic for copying the cross ref stuff is missing But I think @HoussemNasri splitted that task?
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.
No, the copying of cross-ref stuff is the ticket assigned to @priyanshu16095.
#12339 is the ticket for creating the "copy to" menu; it is assigned to someone else, but since @priyanshu16095 already started working on it we agreed to have a draft pull request that might eventually be considered for merge in case of inactivity from the current assignee of that issue.
The issues/tasks are tightly coupled and meant to be done in a certain order. This pull request might or might not be merged depending on whether we receive any activities from the assignee of #12339, but IMO the work done here could be reused later to tackle #12341.
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.
Logic for copying the cross ref stuff is missing But I think @HoussemNasri splitted that task?
Actually, #12340 was meant to be tackled before the one mentioned in PR description #12341, so yes logic for copy cross references is for another task or could be handled in this PR since both issues are assigned to @priyanshu16095.
if (preferences.getCopyToPreferences().getShouldIncludeCrossReferences()) { | ||
logger.info("Include Cross References"); | ||
} else { | ||
logger.info("Exclude Cross References"); | ||
} |
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.
Either decrease log noise or remove.
optOut -> preferences.getCopyToPreferences().setShouldAskForIncludingCrossReferences(!optOut) | ||
); | ||
} else { | ||
return preferences.getCopyToPreferences().getShouldIncludeCrossReferences(); |
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.
See if you can improve abstraction - pass preferences.getCopyToPreferences()
via constructor instead of entire GuiPreferences
if (!openDatabases.isEmpty()) { | ||
openDatabases.forEach(library -> { | ||
String path = library.getDatabasePath().get().toString(); | ||
String name = path.substring(path.lastIndexOf('\\') + 1); |
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.
@calixtus i think we can use FromAuxDialogViewModel#getDatabaseName()
here?
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.
Yeah we also use that code part in
jabref/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java
Lines 122 to 130 in 7c958e7
Optional<String> dbOpt = Optional.empty(); | |
if (database.getDatabasePath().isPresent()) { | |
dbOpt = FileUtil.getUniquePathFragment(stateManager.collectAllDatabasePaths(), database.getDatabasePath().get()); | |
} | |
if (database.getLocation() == DatabaseLocation.SHARED) { | |
return database.getDBMSSynchronizer().getDBName() + " [" + Localization.lang("shared") + "]"; | |
} | |
return dbOpt.orElseGet(() -> Localization.lang("untitled")); |
We should add this somewhere more central
Please also fix the Checkstyle, Openrewrite and Unit tests. The FAQ page will help you. |
this.shouldAskForIncludingCrossReferences.set(shouldAskForIncludingCrossReferences); | ||
} | ||
|
||
public boolean getShouldIncludeCrossReferences() { |
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.
How about shouldIncludeCrossReferences
? It reads better.
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.
Is it in line 17 or 14?
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.
The method name. It is a nitpick so feel free to ignore.
|
||
@Override | ||
public void execute() { | ||
Logger logger = LoggerFactory.getLogger(CopyTo.class); |
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.
Each class should declare the logger only once. Refer to the logging usage in other classes for guidance.
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.
Oh, I used it for temporary purposes, but forgot to remove it.
I have fixed the Checkstyle, OpenRewrite, and Unit tests errors and made changes based on the reviews. |
Fixes #12341
This PR introduces a 'Copy to' context menu option with features for cross-reference inclusion/exclusion, as well as the ability to save user preferences.
THE CHANGES MADE
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)