Share project using Git without touching your mouse: Eclipse Command Framework and Quick Access
I’ve just imported M2Eclipse with its almost 60 plugins into my workspace. And later I want to share one of currently open projects in the midst of my current workflow using Git provider. What should I do?
Well, in most cases it is about reaching out for my mouse, moving it, pointing it to something and clicking. I’ve to switch to Package Explorer or Projects view to achieve my task. When using Package Explorer I found myself buried under several levels of folders to where my currently edited file is located because Package Explorer is a ‘good citizen’ who obeys Eclipse User Interface Guidelines and supports the ‘Link with Editor’ feature. But what if the target project is not in the active working set? Or not active in Mylyn’s context? Yes, there are even more extra clicks ahead. I have to admit that Projects view behaves much better in this case.
Ok, I’ve finally selected the project I want to share and am able to use its context menu. Task completed but I feel myself a bit tired 😉 The main problem with this obvious way of doing things is that I’m forced to interrupt my current task and to lose focus finding my mouse and switching between different views etc.
Are there any other ways? Are you one of those developers who try to get as much done as possible without lifting your fingers from the keyboard like me? Keep reading.
Back in 2007 Eclipse 3.3 introduced a new feature called Quick Access. With Quick Access, UI elements such as commands, views, wizards, preference pages etc. can be quickly listed, filtered through, selected and executed without even knowing the keyboard shortcuts to be pressed. It’s the first part of the solution. The second one is Platform Command Framework.
The combination of Quick Access and Command Framework allows us to implement solutions for tasks like the ones I described quite easily. My implementation was inspired by Eclipse Tips: Keyboard accessibility thru Command Framework, one of awesome articles about using Command Framework by Prakash G.R.
With this enhancement it is possible to share a single project using Git provider from almost any place in the workspace with only a keyboard: