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

improve file view "link with selection" #49

Open
nittka opened this issue May 11, 2018 · 0 comments
Open

improve file view "link with selection" #49

nittka opened this issue May 11, 2018 · 0 comments

Comments

@nittka
Copy link
Collaborator

nittka commented May 11, 2018

IFileViewType#getFile is currently required to map a given selected file to one to be shown in the file view. The API is not well prepared to handle the case that there is no such file (e.g. dummy.txt cannot be mapped to a pdf file compiled from a score, as dummy.txt has nothing to do with LilyPond compilation).

In PR thSoft/elysium#182, I tried to work around this problem by returning a file with a dummy extension which is not supported.

There are several other options.

  • allow IFileViewType#getFile to return null indicating that the given file is not supported
  • change the return type of IFileViewType#getFile to Optional with the same meaning
  • add a method boolean IFileViewType#isSupported(IFile sourceFile) (possibly with default implementation true for backward compatibility)
  • something else

I believe the actual logic cannot be placed in commons because only the file view type itself knows which source files can have a corresponding file to be shown in the view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant