I'm working on a personal project that has a fairly complex UI. As much as possible I would like to remove mouse interaction. To help with that I am working on a kind of in app command line, where you can find all the actions by opening a popup and type in the names to run them. (think intellij ctrl-shift-a, or eclipse ctrl-f12). I would also like a way to add a way to pass an arg to the command (e.g. skipback 50s
)
I am having a hard time figuring out how to design this. Currently my idea is to have a common Commands
object that contains all the commands, and a Command
interface that contains logic, a user friendly name, and an arg description (if any). Part of the problem is that some actions can only be performed in certain contexts, and the other problem is where to put the individual Command
s (this is an issue because scala objects are lazy, and they won't be added to the Commands
object until after being referenced). I'm also unsure how to keep type safety, since thees Command
s will also be linked to from UI hooks inside the app.
Any ideas on how to fix this and/or improve the current model?