-
-
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
[GSOC22] - B - Implement merging fields in the three way merge UI #9022
Conversation
- Thus commands can be moved to the view model
- Removed FieldNameCellFactory.java and MergeableFieldCell.java - Made it easier to add more side buttons in the future
- Initialized the change name column - Commented out 'getDialogPane().setContent(pane)' because it will be removed later
- Changes are applied only when all changes are resolved (changes table is empty). Like a transaction
… 'EntryChangeViewModel'
} | ||
} | ||
|
||
class ActionImpl implements Action { |
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 don't you use the JabRefAction together with the ActionFactory ? It should already cover the cases
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'm not sure how that would work. The idea behind the builder and ActionImpl
is to create instances of org.jabref.gui.actions.Action
without implementing it; which can be very verbose.
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.
Well, you could either use them as anonymous classes or as separate classes. The latter is probably useful if you are reusing them in multiple placess.
} | ||
|
||
public FieldMerger create(Field field) { | ||
if (field.equals(StandardField.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.
Use a switch 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.
And also some parts use == other use equal
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 couldn't use a switch expression because Field
is an interface. When I changed the type of the parameter to StandardField
, it compiled fine but other parts of the codebase broke.
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.
Ah okay, yeah I see. Then field is the correct approach
} else if (StringUtil.isBlank(keywordsB)) { | ||
return keywordsA; | ||
} else { | ||
return Arrays.stream((keywordsA + keywordSeparator + keywordsB).split(keywordSeparator)) |
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 sure, but maybe you should use KeywordList ? This is relevant for keyword groups
|
||
public class UnmergeCommand extends SimpleCommand { | ||
|
||
public UnmergeCommand() { |
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.
empty default constructor can be removed
public ThreeWayMergeView(BibEntry leftEntry, BibEntry rightEntry, String leftHeader, String rightHeader) { | ||
getStylesheets().add(ThreeWayMergeView.class.getResource("ThreeWayMergeView.css").toExternalForm()); | ||
viewModel = new ThreeWayMergeViewModel((BibEntry) leftEntry.clone(), (BibEntry) rightEntry.clone(), leftHeader, rightHeader); | ||
// TODO: Inject 'preferenceService' into the constructor |
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.
You can test if you can inject it as field here or in the caller component and pass it to this component in the constructor
@Inject private PreferencesService preferencesService
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.
It throws a null pointer exception. I think this is happening because the injection is handled by mvvmfx but ThreeWayMergeView
doesn't use a view loader. I thought that because @Inject
is used in other classes and all of them also use view loader.
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.
You need to inject it into DuplicateResolverDialog
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.
And also pass it from the ChangeScanner -> EntryChangeViewModel -> ThreeWayMergeView via constructor
@@ -39,7 +39,7 @@ public enum DuplicateResolverResult { | |||
BREAK | |||
} | |||
|
|||
private MergeEntries mergeEntries; | |||
private ThreeWayMergeView threeWayMerge; | |||
private final DialogService dialogService; | |||
|
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.
Here you can use things with @Inject e.g @Inject PreferencesService preferencesService;
and pass that to other
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.
Injection doesn't work here either
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.
overall looks good to me just a few minor improvements
…into GSOC-merge-fields
We are thinking of merging this so the early bird users can the new feature, Can PR A and B be merged? |
PR A is complete. This one still needs some nitpicks, but it should be ready today or tomorrow. |
# Conflicts: # src/main/java/org/jabref/gui/duplicationFinder/DuplicateResolverDialog.java # src/main/java/org/jabref/gui/icon/IconTheme.java # src/main/java/org/jabref/gui/mergeentries/MergeEntriesDialog.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/ThreeWayMergeView.css # src/main/java/org/jabref/gui/mergeentries/newmergedialog/ThreeWayMergeView.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/cell/FieldNameCell.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/cell/FieldValueCell.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/cell/HeaderCell.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/cell/MergedFieldCell.java # src/main/java/org/jabref/gui/mergeentries/newmergedialog/cell/OpenExternalLinkAction.java # src/main/resources/l10n/JabRef_en.properties
* upstream/main: (31 commits) Citavi Importer - Import all knowledge items (JabRef#9043) Fixed table update in eft preferences (JabRef#9051) Keep EOL setting at backups (JabRef#9048) ExternalFileTypes singleton refactor (JabRef#9044) Fix dead link (JabRef#9047) Fix performance regresssion (JabRef#9045) Update javafx to 18.02 import citavi knowledge items (JabRef#9033) Fix .gitattributes for CHANGELOG.md [GSOC22] - B - Implement merging fields in the three way merge UI (JabRef#9022) [GSOC22] - A - Implement a fully functional three way merge UI (JabRef#8945) Change button label from "Return to JabRef" to "Return to library" (JabRef#9039) Bump postgresql from 42.4.0 to 42.4.1 (JabRef#9036) Bump org.javamodularity.moduleplugin from 1.8.11 to 1.8.12 (JabRef#9037) Bump slf4j-api from 2.0.0-alpha7 to 2.0.0-beta1 (JabRef#9035) Bump slf4j-api from 2.0.0-alpha7 to 2.0.0-beta1 in /buildSrc (JabRef#9038) Update Gradle Wrapper from 7.5 to 7.5.1. (JabRef#9034) Refactor of DOI import failure dialog, import format reader and clipboard manager (JabRef#8839) Snapcraft and issue template Show development information\n\n+semver: minor ...
Closes #8024
Depends on #8945
Contributes to #6190
It appears that every time a field changes, an event bus marks the library as edited. The library will remain marked as edited even after I undo groups merging and cancel the merge dialog. Right now, I can't think of a way to fix this.
Edit
Keywords and Comments can be merged too.
bandicam.2022-07-09.04-40-39-815.mp4
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)