One example (from C++, so maybe not relevant for IntelliJ) I use them for is converting enums to a case statement.
e.g. if I have:
typedef enum
{
VALUE_1,
VALUE_2,
VALUE_3,
...
VALUE_10
} MyEnum;
I can copy/paste lines from VALUE_1 through to VALUE_10, and then start recording a macro as I change VALUE_1,
to case VALUE_1:
break;
Adding a final 'j' to move down a line before finishing the macro.Then I just run the macro several times and each line gets converted.
That's a pretty simple case (hah), there are plenty of other (and more complicated) uses for them too.
switch (enumVar)
hit alt-enter and it gives you the option of filling in the missing branches. This even applies to partial switch statements missing some of the cases.