thSoft / elysium

LilyPond IDE for Eclipse
http://elysium.thsoft.hu
14 stars 3 forks source link

recompile only outdated when container is selected #184

Closed nittka closed 6 years ago

nittka commented 6 years ago

As recompilation is not possible on an ily file anymore, it may be less easy to invoke recompilation on all including files (which may be spread over different folders), especially if compile on save is deactivated. This pull request introduces a preference value controlling whether all files or only those marked as outdated will be processed, when recompilation is invoked on a folder or a project.

(My hope was that this makes #127 obsolete, as the Elysium's compiler preference page is completely different from the standard Xtext preference page and hence allowing project specific settings may not be easy. However, the use case there - compile on save in one project but not another - remains)

thSoft commented 6 years ago

Yes, this behavior needs to be disambiguated. I think the user should make it explicit whether (s)he wants to recompile every file or just the outdated ones, so I suggest that a container should have two separate commands.

nittka commented 6 years ago

So, rather than the preference, a "Recompile outdated" command should be added (and the other be renamed to "Recompile all")? Recompile viewed and recompile edited are not affected. Note, that the selection may involve both multiple single files and multiple containers.

thSoft commented 6 years ago

Yes, this would be great.

nittka commented 6 years ago

I changed the commit. There are now 2 recompile selected actions - all and outdated only.

nittka commented 6 years ago

It seems, a command parameter would make sense only if there was only one recompile command and the user is asked every time whether all or only outdated files are to be compiled. Is that what you intended?

Otherwise two command IDs are necessary anyway and distinguishing the two cases by evaluating the ID seems a valid approach.

thSoft commented 6 years ago

There can be one command definition (i.e. a command element under the org.eclipse.ui.commands extension point) which has a commandParameter, and two menu commands (i.e. command elements under the org.eclipse.ui.menus extension point) which can specify arguments (i.e. parameter elements) for the called commands.

nittka commented 6 years ago

Thanks for the hint. I missed the possibility of providing the command parameter in the menu entry. I added the command parameter, set the value in the compile-outdated menu entry, rebased on master and modified the original logic slightly. Rather than restricting the "outdated" logic to containers, now from all selected elements only outdated files are compiled. I.e. the menu entry Recompile All compiles all ly files (derived from selected files and containers), and Recompile Outdated compiles only those which are marked as outdated.

If we wanted enablement of the entry to work perfectly (Recompile outdated is enabled only if there are outdated files) we would have to use a more elaborate logic, e.g. separate commands and handlers, because the isEnabled-method lacks the information which of the two menu entries is asking.

thSoft commented 6 years ago

Thank you, this is sufficiently sophisticated for now.