-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add tabs to Clean Up Entries dialog #13852
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
Changes from 7 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
400c6b0
Add cleanup dialog tabs with individual tab preferences
alexsukhin dd2f74c
Fixed indentation and added commenting
alexsukhin 033201c
Fix Trag-bot review issues
alexsukhin 14fde53
Fix Trag-bot review issues
alexsukhin 9c44aad
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 0c5939e
Fix Trag-bot review issues
alexsukhin 757514e
Avoid nested Optionals, returning Optional<CleanupPreferences> directly
alexsukhin a60f696
Refactor CleanupPreferences by keeping one assertion per test
alexsukhin 43c981b
Converted tests to assertEquals
alexsukhin 56b6164
Maintain consistent naming conventions
alexsukhin 4f2ed12
Returns CleanupPreferences directly since value is always present
alexsukhin 1d2f991
Initial review refactor draft
alexsukhin c8c3d42
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 7276eb0
fix import error!
alexsukhin 9ed570f
Reformat codebase (more carefully) (#13885)
subhramit 55c02c2
fix import error & merge
alexsukhin b0c4f6a
Apply OpenRewrite Cleanup
alexsukhin 651f5ef
Refactor Cleanup Tabs
alexsukhin d280c21
Merge remote-tracking branch 'upstream/main' into 13819-add-dialog-tabs
alexsukhin 161e36f
Fix getDisplayName method
alexsukhin 2dfb7a7
Fix formatting
alexsukhin 84d7716
Trag-bot review and fix en properties
alexsukhin 442a623
fix indentation plssss
alexsukhin 6606e59
format properly and change to observablelist
alexsukhin f90923a
fix formatting entriestoprocess (please)
alexsukhin 9073361
Updated names and changed optional dependencies back to nullable
alexsukhin a8d371e
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 074242e
Merge branch 'main' into 13819-add-dialog-tabs
Siedlerchr 8714141
Refactored panels to use separate ViewModels
alexsukhin f35319f
Moved ALL_JOBS to respective ViewModels, small naming changes
alexsukhin 0ee7d35
Merge upstream/main, fix submodules
alexsukhin b24af6b
Replaced requireNotNull to @NotNull following https://github.com/JabR…
alexsukhin b7f4594
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 9c9f202
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 40f6dbf
Merge branch 'main' into 13819-add-dialog-tabs
koppor 25a1151
Merge branch 'main' into 13819-add-dialog-tabs
koppor cb94ec5
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 5adc301
Address review feedback in CleanupDialogViewModel
alexsukhin 576071d
Merge branch 'main' into 13819-add-dialog-tabs
koppor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 25 additions & 13 deletions
38
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupFileRelatedPanel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| package org.jabref.gui.cleanup; | ||
|
|
||
| import java.nio.file.Path; | ||
| import java.util.EnumSet; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
|
|
||
| import javafx.fxml.FXML; | ||
| import javafx.scene.control.CheckBox; | ||
| import javafx.scene.control.Label; | ||
| import javafx.scene.layout.VBox; | ||
|
|
||
| import org.jabref.logic.FilePreferences; | ||
| import org.jabref.logic.cleanup.CleanupPreferences; | ||
| import org.jabref.logic.l10n.Localization; | ||
| import org.jabref.model.database.BibDatabaseContext; | ||
| import org.jabref.model.entry.field.StandardField; | ||
|
|
||
| import com.airhacks.afterburner.views.ViewLoader; | ||
|
|
||
| public class CleanupFileRelatedPanel extends VBox implements CleanupPanel { | ||
|
|
||
| @FXML private Label cleanupRenamePdfLabel; | ||
|
|
||
| @FXML private CheckBox cleanUpMovePdf; | ||
| @FXML private CheckBox cleanUpMakePathsRelative; | ||
| @FXML private CheckBox cleanUpRenamePdf; | ||
| @FXML private CheckBox cleanUpRenamePdfonlyRelativePaths; | ||
| @FXML private CheckBox cleanUpDeletedFiles; | ||
| @FXML private CheckBox cleanUpUpgradeExternalLinks; | ||
|
|
||
| public CleanupFileRelatedPanel(BibDatabaseContext databaseContext, CleanupPreferences cleanupPreferences, FilePreferences filePreferences) { | ||
| Objects.requireNonNull(databaseContext, "databaseContext must not be null"); | ||
| Objects.requireNonNull(cleanupPreferences, "cleanupPreferences must not be null"); | ||
| Objects.requireNonNull(filePreferences, "filePreferences must not be null"); | ||
|
|
||
| ViewLoader.view(this) | ||
| .root(this) | ||
| .load(); | ||
|
|
||
| init(databaseContext, cleanupPreferences, filePreferences); | ||
| } | ||
|
|
||
| private void init(BibDatabaseContext databaseContext, CleanupPreferences cleanupPreferences, FilePreferences filePreferences) { | ||
| Optional<Path> firstExistingDir = databaseContext.getFirstExistingFileDir(filePreferences); | ||
| if (firstExistingDir.isPresent()) { | ||
| cleanUpMovePdf.setText(Localization.lang("Move linked files to default file directory %0", firstExistingDir.get().toString())); | ||
| } else { | ||
| cleanUpMovePdf.setText(Localization.lang("Move linked files to default file directory %0", "...")); | ||
|
|
||
| cleanUpMovePdf.setDisable(true); | ||
| cleanUpMovePdf.setSelected(false); | ||
| } | ||
|
|
||
| cleanUpRenamePdfonlyRelativePaths.disableProperty().bind(cleanUpRenamePdf.selectedProperty().not()); | ||
|
|
||
| cleanUpUpgradeExternalLinks.setText(Localization.lang("Upgrade external PDF/PS links to use the '%0' field.", StandardField.FILE.getDisplayName())); | ||
|
|
||
| String currentPattern = Localization.lang("Filename format pattern (from preferences)") | ||
| .concat(filePreferences.getFileNamePattern()); | ||
alexsukhin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cleanupRenamePdfLabel.setText(currentPattern); | ||
alexsukhin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| updateDisplay(cleanupPreferences); | ||
| } | ||
|
|
||
| private void updateDisplay(CleanupPreferences preset) { | ||
| if (!cleanUpMovePdf.isDisabled()) { | ||
| cleanUpMovePdf.setSelected(preset.isActive(CleanupPreferences.CleanupStep.MOVE_PDF)); | ||
| } | ||
| cleanUpMakePathsRelative.setSelected(preset.isActive(CleanupPreferences.CleanupStep.MAKE_PATHS_RELATIVE)); | ||
| cleanUpRenamePdf.setSelected(preset.isActive(CleanupPreferences.CleanupStep.RENAME_PDF)); | ||
| cleanUpRenamePdfonlyRelativePaths.setSelected(preset.isActive(CleanupPreferences.CleanupStep.RENAME_PDF_ONLY_RELATIVE_PATHS)); | ||
| cleanUpUpgradeExternalLinks.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEAN_UP_UPGRADE_EXTERNAL_LINKS)); | ||
| cleanUpDeletedFiles.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEAN_UP_DELETED_LINKED_FILES)); | ||
| } | ||
|
|
||
| public Optional<CleanupPreferences> getCleanupPreferences() { | ||
| EnumSet<CleanupPreferences.CleanupStep> activeJobs = EnumSet.noneOf(CleanupPreferences.CleanupStep.class); | ||
|
|
||
| if (cleanUpMakePathsRelative.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.MAKE_PATHS_RELATIVE); | ||
| } | ||
| if (cleanUpRenamePdf.isSelected()) { | ||
| if (cleanUpRenamePdfonlyRelativePaths.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.RENAME_PDF_ONLY_RELATIVE_PATHS); | ||
| } else { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.RENAME_PDF); | ||
| } | ||
| } | ||
| if (cleanUpUpgradeExternalLinks.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_UPGRADE_EXTERNAL_LINKS); | ||
| } | ||
| if (cleanUpDeletedFiles.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_DELETED_LINKED_FILES); | ||
| } | ||
|
|
||
| return Optional.of(new CleanupPreferences(activeJobs)); | ||
alexsukhin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
102 changes: 102 additions & 0 deletions
102
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupMultiFieldPanel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| package org.jabref.gui.cleanup; | ||
|
|
||
| import java.util.EnumSet; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
|
|
||
| import javafx.fxml.FXML; | ||
| import javafx.scene.control.CheckBox; | ||
| import javafx.scene.layout.VBox; | ||
|
|
||
| import org.jabref.logic.cleanup.CleanupPreferences; | ||
|
|
||
| import com.airhacks.afterburner.views.ViewLoader; | ||
|
|
||
| public class CleanupMultiFieldPanel extends VBox implements CleanupPanel { | ||
| @FXML private CheckBox cleanUpDOI; | ||
| @FXML private CheckBox cleanUpEprint; | ||
| @FXML private CheckBox cleanUpURL; | ||
| @FXML private CheckBox cleanUpBiblatex; | ||
| @FXML private CheckBox cleanUpBibtex; | ||
| @FXML private CheckBox cleanUpTimestampToCreationDate; | ||
| @FXML private CheckBox cleanUpTimestampToModificationDate; | ||
|
|
||
| public CleanupMultiFieldPanel(CleanupPreferences cleanupPreferences) { | ||
| Objects.requireNonNull(cleanupPreferences, "cleanupPreferences must not be null"); | ||
|
|
||
| ViewLoader.view(this) | ||
| .root(this) | ||
| .load(); | ||
|
|
||
| init(cleanupPreferences); | ||
| } | ||
|
|
||
| private void init(CleanupPreferences cleanupPreferences) { | ||
| cleanUpBibtex.selectedProperty().addListener( | ||
| (observable, oldValue, newValue) -> { | ||
| if (newValue) { | ||
| cleanUpBiblatex.selectedProperty().setValue(false); | ||
| } | ||
| }); | ||
| cleanUpBiblatex.selectedProperty().addListener( | ||
| (observable, oldValue, newValue) -> { | ||
| if (newValue) { | ||
| cleanUpBibtex.selectedProperty().setValue(false); | ||
| } | ||
| }); | ||
|
|
||
| cleanUpTimestampToCreationDate.selectedProperty().addListener( | ||
| (observable, oldValue, newValue) -> { | ||
| if (newValue) { | ||
| cleanUpTimestampToModificationDate.selectedProperty().setValue(false); | ||
| } | ||
| }); | ||
| cleanUpTimestampToModificationDate.selectedProperty().addListener( | ||
| (observable, oldValue, newValue) -> { | ||
| if (newValue) { | ||
| cleanUpTimestampToCreationDate.selectedProperty().setValue(false); | ||
| } | ||
| }); | ||
| updateDisplay(cleanupPreferences); | ||
| } | ||
|
|
||
| private void updateDisplay(CleanupPreferences preset) { | ||
| cleanUpDOI.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEAN_UP_DOI)); | ||
| cleanUpEprint.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEANUP_EPRINT)); | ||
| cleanUpURL.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEAN_UP_URL)); | ||
| cleanUpBiblatex.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TO_BIBLATEX)); | ||
| cleanUpBibtex.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TO_BIBTEX)); | ||
| cleanUpTimestampToCreationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_CREATIONDATE)); | ||
| cleanUpTimestampToModificationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_MODIFICATIONDATE)); | ||
| cleanUpTimestampToModificationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.DO_NOT_CONVERT_TIMESTAMP)); | ||
| } | ||
|
|
||
| @Override | ||
| public Optional<CleanupPreferences> getCleanupPreferences() { | ||
| EnumSet<CleanupPreferences.CleanupStep> activeJobs = EnumSet.noneOf(CleanupPreferences.CleanupStep.class); | ||
|
|
||
| if (cleanUpDOI.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_DOI); | ||
| } | ||
| if (cleanUpEprint.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CLEANUP_EPRINT); | ||
| } | ||
| if (cleanUpURL.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_URL); | ||
| } | ||
| if (cleanUpBiblatex.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CONVERT_TO_BIBLATEX); | ||
| } | ||
| if (cleanUpBibtex.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CONVERT_TO_BIBTEX); | ||
| } | ||
| if (cleanUpTimestampToCreationDate.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_CREATIONDATE); | ||
| } | ||
| if (cleanUpTimestampToModificationDate.isSelected()) { | ||
| activeJobs.add(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_MODIFICATIONDATE); | ||
| } | ||
|
|
||
| return Optional.of(new CleanupPreferences(activeJobs)); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPanel.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package org.jabref.gui.cleanup; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.jabref.logic.cleanup.CleanupPreferences; | ||
|
|
||
| public interface CleanupPanel { | ||
| Optional<CleanupPreferences> getCleanupPreferences(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.