I’ve always been an avid IntelliJ user, even when I was forced to use JBuilder and JDeveloper quite some time ago. I’ve been trying to give Eclipse a fair go, and despite having to change the way that I think, the transition hasn’t been too bad. I’m perhaps suffering a little bit more RSI (a consequence of having to press CTRL-SHIFT a lot more combined with my bad habit of always using the left hand side for CTRL and SHIFT), but other than that, most things are about learning different keystrokes.
I’m not a big believer in saying that IntelliJ is better than Eclipse because I haven’t used Eclipse in anger as much, so I’m still open to giving it a fair go. There are a few things that I do miss that I haven’t been able to find, so if someone can knows about them, or can suggest (yet another) plugin to fix, then I’ll be happy to try it out.
My current list includes:
- ALT-F8 also known as Expression Evaluation (both code fragment mode and expression mode) – Since I’m a lot faster when I use the keyboard over the mouse, I like to use this feature of IntelliJ rather than setting watches and inspecting values. It’s easier for me to add a break point, debug, fire this up and then evaluate at runtime to my heart’s content. I can easily focus on working out the values of the things I care, the state of things to come, and blocks of code to see if I change code, what the effects would be. Better yet, a lot of the normal IDE features are available in this mode, including code completion, normal import options (ALT-ENTER) and the rest of niceities IntelliJ offers. The closest thing I have found is the “Evaluate Expression” in Eclipse but it seems to be constrainted to static values in code. (The closest thing for Rubyists is the IRB)
- CTRL-SHIFT-ALT-N also known as Symbol Search – I find this feature is most useful, for when you are new to a code base (you can easily find which class it belongs to) and in finding a specific test case that is failing. I don’t really use this that much if I’m familiar with the code base as there are faster ways of navigating, but it is really useful in the right circumstances. I haven’t been able to find any alternative
- CTRL-SHIFT-10 (inside a test method) also known as the execution of a single test method – When I have a test method fail inside a test class, my first instinct is to go and run that test in the IDE to see if I can replicate it. IntelliJ makes that easy by understanding the context where you are – if your cursor is inside a test method it will run that single test instead of the entire suite. The best that I have seen so far is for someone to run a test suite, stop it and then right click and run the single test (no shortcut key!)
- CTRL-ALT-L (autoformat) – Although there are pretty code formatters for Eclipse, I love the fact that I can use the same shortcut in IntelliJ and get the same result, be it Java, XML, HTML or even Javascript! Better yet it can be run over an entire directory without having to touch the mouse.
I am not going to be very helpful but I will try. Our current team use both IDEs for development, since some of us prefer Eclipse and the others IntelliJ. We spend almost a year like that and this allows as to constantly evaluate both IDEs. I am mostly an Eclipse guy so I will try to answer:
ALT-F8 – I believe this is equal to either CTRL+SHIFT+D (display) or CTRL+SHIFT+I (Inspect- you can see almost everything with that). Also you have CTRL+U for execute. The most impressive part about Eclipse debugging is that if you do a left click with the mouse on the current stack, you can see “Drop to Frame”. This will return the debugger to earlier position. I think that IntelliJ has similar thing but at least the current developers working with IntelliJ can’t find it. Anyway, I hope these are the keys that you are looking for.
CTRL-SHIFT-ALT-N – I couldn’t understand what this is doing, but looking at the key combination, it is looks like hard one :-). I will check it tomorrow though.
CTRL-SHIFT-10 (inside a test method) – I have turn my preference, so that when you are inside of method and do left click menu, you can see “run”. This will run only this particular test. If you outside, then you run the whole test class. The preferences are with left click on the top menu.
CTRL-ALT-L is CTRL-SHIFT-F. I am not sure if this work for every file, but it works for java, xml, html and you have plug-in for javascript, as well.
Hope, this is some help.
Hi Igor,
Thanks for the tips. I’m currently using Eclipse 3.2.0 and tried out a few of your tips. Unfortunately I still haven’t been able to find an ALT-F8 alternative. To help you out, I’m not sure if the feature you are describing is the ability to move up and down the current thread stack (at a break point – a CTRL-ALT-UP (or DOWN)) is right there. It’s a drop down box at the top of the debug window.
I was unfortunately unable to get the other two working – the preferences I have for running a test is still a single test class, and although format works fine for Java code, failed to work for me on an XML file. Maybe I haven’t got the right plugins?
I believe that CTRL+SHIFT+D (display) or CTRL+SHIFT+I (Inspect) are the same as ALT+F8. I will check today at work to make sure though. Anyway, this should be standard for eclipse. It is not a plug-in. I am using eclipse 3.1 but I don’t think that the versions differ in that.
CTRL-SHIFT-10 (inside a test method) – I believe the same feature in Eclipse is not a plug-in but I will ask the biggest fan of Eclipse in our team. He uses eclipse 3.2 and has a specific jUnit test plug-in to do many things with short keys.
CTRL-SHIFT-F works for xml or html in a plug-in called XML Buddy. This is comparably nice xml plug-in. CTRL-SHIFT-F doesn’t work for text files or anything open with a simple text editor.
I will try to play with both IDEs today and I hope to give you better tips.
P.S. Alistair form the London office worked with us for about 7-8 months. He works with IntelliJ but he learned quite a bit about Eclipse while paring with others. If you know him, he could be able to give you some tips as well.
First off: Its not Ctrl+Sift+F10; its just Shift+F10 –> to bring up the context menu when you right click – based on where the position of the mouse is, it will bring up the “context” menu.
Another similar shortcut (i find it very useful): Alt+-: This brings up the context menu at the view title bar. I use this a lot to close other editors, etc
To run a single test method from within a TestCase: use the junitRunner plugin hosted at sourceforge (the site appears to be currently down) – and if you need it – please email me (tw notes) for the latest version. I am one of the devs on that project and would appreciate feedback.
As far a formatting – that depends on whether the plugin that you use supports formatting outside of the editor ie based on selection in any of the other views.
sf.net site is back up now. here is the url for the plugin that i mentioned: http://sourceforge.net/projects/junitrunner
forgot one more thing:
there is a plugin which will automatically format code and organize imports each time you save a dirty java editor.
http://www.eclipse-plugins.info/eclipse/plugin_details.jsp?id=1162
Vijay told you about the plug-in for running a single test. I have “run” in the context menu without this plug-in but I couldn’t remember how I set it up (“sorry, it is right, not left click). I try to disabled it in order to see where is the setting for that, but apparently I am looking at a wrong place. Anyway, the plug-in could be faster solution.
ALT-F8 – is definitely CTRL+SHIFT+I. I just check on both IDE’s.
CTRL-SHIFT-ALT-N – I have never used this functionality but apparently the other users of IntelliJ are very familiar with it. No, there is no short key combination for that in Eclipse. Similar thing could be done with: “CTRL+H” to bring the search menu, then switch to Java search, then you can define what exactly you are looking. It is not going to bring the results dynamically as in IntelliJ but you have much more flexibility to define what you are looking for.
I hope this helps.
Symbol search –> Ctrl+Shift+G
Thanks guys, I’ll have to definitely try these out. Do you know of anything for CTRL-W (it’s for selecting successively increasing code blocks)?
Ctrl+W –> Alt+Shift+
that didnt come out properly 🙂
it should have read: Alt plus Shift plus Left_Arrow_Key
Thanks. Worked like a treat!