Skip to content
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

Merged
merged 18 commits into from
Aug 9, 2018

Conversation

zeabin
Copy link
Contributor

@zeabin zeabin commented Aug 9, 2018

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.


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)

@Siedlerchr
Copy link
Member

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!)
In case Travis fails just click on it and you can see where it exactly failed.

/**
* Empty interface implementation to do nothing external on paste method
*/
private static class EmptyPasteHandler implements PasteActionHandler {
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

@Siedlerchr Siedlerchr left a 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!

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 9, 2018
Copy link
Member

@tobiasdiez tobiasdiez left a 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 {
Copy link
Member

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);
Copy link
Member

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());
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

Copy link
Member

@tobiasdiez tobiasdiez left a 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!

@tobiasdiez tobiasdiez merged commit 89ee885 into JabRef:master Aug 9, 2018
@zeabin zeabin deleted the fix-for-issue-koppor-254 branch August 12, 2018 10:29
Siedlerchr added a commit that referenced this pull request Aug 13, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants