-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Extract native functions to OS package #965
Conversation
stefan-kolb
commented
Mar 14, 2016
- Change in CHANGELOG.md described?
- Changes in pull request outlined? (What, why, ...)
- Tests created for changes?
- Tests green?
|
||
public static void openFile(String link) throws IOException { | ||
ExternalFileType type = ExternalFileTypes.getInstance().getExternalFileTypeByExt("ps"); | ||
String viewer = type == null ? Globals.prefs.get(JabRefPreferences.PSVIEWER) : type.getOpenWith(); |
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.
At the moment, this cannot be moved to the logic package, as it uses preferences @tobiasdiez . Maybe we should pass this setting as well as to this method/class?
A next step would be to integrate the code for the OpenOffice Path detection, too: |
@Siedlerchr Good point, but this requires more work as the logic is mixed with file chooser dialogs etc. |
👍 |
Nice improvement! Does it make sense to use the state pattern here? That is, the JabrefDesktop class has an internal OS object which is initialized to the correct OS in the constructor and most of the methods just pass through to the OS class. Has the advantage, that the |
@tobiasdiez Definitely worth a shot! 👍 |
The problem is that we need to have an implementation for each of the OS then + a OS-independent implementation. This is not the case which makes it hard to implement that correctly now, as far as I can see. |
Mhh, but isn't the JabRefDesktop the OS-independent version (at least from the outside it doesn't matter what OS is used) and the newly created classes are the OS-dependent version? My idea was to write
in the constructor of JabRefDesktop (where |
Yeah, I got your idea, but there need to be a lot of things touched to make this work consistently. Let me give it a try... |
I'll for example get problems with this method:
As openFolderAndSelect is not implemented for OSX yet.
|
Ah ok. If it is two much work, then just leave it as it is right now. I think it is already a big improvement over the older code. |
Ok, I tried to unify this stuff as much as possible. Might introduce some new behavior that need to be fixed later on. Still got problems with the preferences that are used via ExternalFileType that force me to keep the code inside the gui package and JabRefDesktop for now. |
Extract native functions to OS package