-
-
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 for issue koppor 254 (Auto cleanup url) #4255
Conversation
Thanks for your contribution. The gradlew check often fails locally due to some platform specific encoding issues in the terminal. You don't reed to run it as it just takes time to run all the test. We use Travis CI (Continous Integration) for testing. As long as the Travis CI test does not show any errors, it's good!) |
/** | ||
* Empty interface implementation to do nothing external on paste method | ||
*/ | ||
private static class EmptyPasteHandler implements PasteActionHandler { |
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 could add this simply as default method in the interface, so you won't need that emptyPastHandller I think
https://dzone.com/articles/interface-default-methods-java
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.
Thanks for your feedback. I will try to fix this.
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.
Since PasteActionHandler
is a functional interface,
private PasteActionHandler pasteActionHandler = () -> {};
should work.
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.
Just a minor code style improvement, but otherwise looks good!
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.
In general the code looks good to me. I've only a few minor remarks.
/** | ||
* Empty interface implementation to do nothing external on paste method | ||
*/ | ||
private static class EmptyPasteHandler implements PasteActionHandler { |
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.
Since PasteActionHandler
is a functional interface,
private PasteActionHandler pasteActionHandler = () -> {};
should work.
public static Supplier<List<MenuItem>> getCleanupURLMenu(TextArea textArea) { | ||
return () -> { | ||
CustomMenuItem cleanupURL = new CustomMenuItem(new Label(Localization.lang("Cleanup URL Link"))); | ||
//cleanupURL.setDisable(true); |
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 comment or better bind the disable property to textArea.textProperty().isEmpty()
List<MenuItem> menuItems = new ArrayList<>(); | ||
menuItems.add(cleanupURL); | ||
menuItems.add(new SeparatorMenuItem()); | ||
menuItems.addAll(getDefaultMenu(textArea).get()); |
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 should be the second option in your screenshots since "Protect terms" and the other options do not make sense for the URL field.
@@ -2227,6 +2227,8 @@ Abbreviate\ journal\ names\ (ISO)=Abbreviate journal names (ISO) | |||
Abbreviate\ journal\ names\ (MEDLINE)=Abbreviate journal names (MEDLINE) | |||
Blog=Blog | |||
Check\ integrity=Check integrity | |||
Cleanup\ URL\ Link=Cleanup URL Link |
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 should be lower case link
in both cases
@@ -2227,6 +2227,8 @@ Abbreviate\ journal\ names\ (ISO)=Abbreviate journal names (ISO) | |||
Abbreviate\ journal\ names\ (MEDLINE)=Abbreviate journal names (MEDLINE) | |||
Blog=Blog | |||
Check\ integrity=Check integrity | |||
Cleanup\ URL\ Link=Cleanup URL Link |
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 should be lower case link
in both 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.
Thanks for the quick follow-up!
* upstream/master: (33 commits) Fix display of checkboxes Fix Remove Spin comments Fix#3861_build_addneeded/deleteobsoleteproperties2 Fix#3861_build_addneeded/deleteobsoleteproperties Fix#3861_build Fix attach file does not relativize file path (#4252) Fix for issue koppor 254 (Auto cleanup url) (#4255) Fix#ReplaceString_ChangeConflict Fix#3861ReplaceString_solveConflict Fix#3861RS_conflicttest Fix#3861RS_conflicttest Remove changelog entries Fix#3861ReplaceString_checkStyle Fix#3861ReplaceString_Improvements Fix#3861ReplaceString_ContributeLog fix log4j slf4j dependency Update dependencies (#4251) Fix author list parser (#4169) (#4248) ReplaceStringMVVMPattern ... # Conflicts: # src/main/java/org/jabref/gui/BasePanel.java
This issue is koppor#254.
Set auto cleanup url links on paste action and add cleanup url menu item to the url field
Most codes are modified from a previous contributor in #3394.
Currently the menu item list changed as follows(with defalut editor menu, change case, convert, etc):
But I am not sure whether it's necessary to add defalut editor menu. If not the menu item list would be:
I have run
./gradlew check
but failed. But even if I switch to the master branch which is the same as JabRef/master, the build still failed with the same error message like:But it seems that I did not modify related classes. I don't know what went wrong. It confuses me a lot.
I am looking forward to your feedback.