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 open folder action in Windows not working correctly... #1093

Merged
merged 1 commit into from
Apr 7, 2016

Conversation

Siedlerchr
Copy link
Member

when direcory path contained whitespaces
Use Path-class and methods
"& Symbol" does not cause problems on Windows
Use Path.getParent instead of ugly substring-hack

  • Change in CHANGELOG.md described

@@ -52,6 +52,7 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- [#1023](https://github.com/JabRef/jabref/issues/492) ArXiv fetcher now also fetches based on eprint id

### Fixed
- Fixed "Open-folder" action in Windows not opening tge correct folder when folder path contained whitespaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling mistake

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Changelog entry is NOT needed. JabRef worked fine in 3.2. Please remove the line.

@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 4, 2016
@tobiasdiez
Copy link
Member

LGTM 👍
Just some small remarks.

@Siedlerchr
Copy link
Member Author

I further refactored the OS classes to remove redundant code.
Edit// It would be nice if someone could test this on OSX and Linux, too. Only to make sure that all actions still work correctly.

@@ -156,6 +158,7 @@ public static boolean openExternalFileAnyFormat(final MetaData metaData, String
private static void openExternalFilePlatformIndependent(Optional<ExternalFileType> fileType, String filePath)
throws IOException {
if (fileType.isPresent()) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the empty line?

@stefan-kolb
Copy link
Member

I liked the fix before. I don't like the refactoring so far. For me it would have been a better solution to first merge the fix and later discuss the changes in the logic and the general architecture in a separate PR.

@Siedlerchr
Copy link
Member Author

@stefan-kolb Well. That would be no problem. as I have split it up in 2 commits.
What do the others think?

import net.sf.jabref.external.ExternalFileType;
import net.sf.jabref.external.ExternalFileTypes;

public abstract class NativeDesktop {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use an interface with default methods instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like having an interface with default methods. I chose the abstract class because from my point of view a class hierarchy better represents the is-a hierarchy in this case. e.g. a OSX(Desktop) is a Native Desktop. An Interface is more a kind of Role-based thing and in this case not the best way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, the concrete method hasRegisteredApplication is never overridden by their sub classes, and could be made static. From my point of view, It should be a method of the class ExternalFileType (without the Optional parameter of course).

The other concrete method is also never overridden and has only two very simple lines of code. It is only required in two places in the JabRefDesktop class which are only a few lines apart in the same method. Hence, I would move this method to the calling side, as it does not really help.

With this said, I would convert the abstract class back to an interface without default methods which can be handled more easily (favor composition over inheritance).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, convinced ;)

@Siedlerchr
Copy link
Member Author

I looked a bit further around and saw some more relating things to ExternalFileType which could be improved. However, that would take some more time to fix and be beyond this scope. Will do that in a different PR.
For this PR and the 3.3 I would use the first commit as base with minor modifications (cmd to explorer)

@Siedlerchr
Copy link
Member Author

Rebased the changes.

@simonharrer
Copy link
Contributor

👍 LGTM

@stefan-kolb
Copy link
Member

LGTM 👍

@stefan-kolb stefan-kolb merged commit f5471a0 into JabRef:master Apr 7, 2016
@Siedlerchr Siedlerchr deleted the winOpenDir branch April 7, 2016 15:55
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.

5 participants