How to always run the currently open class instead of the selected run configuration?

The subject says it all: how to make IntelliJ always run the currently open class (if it has a main method, is a unit test etc.) instead of the selected run configuration?

Let's say I'm working on a piece of code for which I have three unit test classes (the core test + two to test dependencies to make double-sure everything stays fine) and a couple of runnable classes to print some debugging output. Five runnable targets in total. Switching between them from the dropdown and hitting Run each time is just slow, plus I have to spot the right one on the list. The Run|Run... shortcut and the popup window is slightly faster but the spot-the-target-on-the-list issue is still there (and it's a problem if you work with VeryLongAndDescriptiveClassNames :) ).

In Eclipse there's a config option which says something like 'launch the target from currently open editor or, if it's not runnable, the last target you run' which is exactly what I'm after. Is there anything like that in IntelliJ?

Thanks,
Max

---
Original message URL: http://devnet.jetbrains.net/message/5498479#5498479

Please sign in to leave a comment.