Skip to content

improve file view "link with selection" #49

@nittka

Description

@nittka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions