Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

java - Highlight exception throwers in IntelliJ IDEA

I recently moved from Eclipse to IntelliJ IDEA, and there is a feature that I'm missing. In Eclipse, when you placed the caret on a checked exception, in throws declaration or catch block, it would highlight which method/constructor calls throw that exception.

Is there any way to do this in IntelliJ IDEA (Community edition)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Place the caret on the catch keyword and press Ctrl+Shift+F7.

(Find | Highlight Usages in File). If you are using different keymap and the above shortcut doesn't work, use Help | Find Action to search for this action and see its keyboard shortcut:

Find Action

If you want it to work automatically, enable Settings | Editor | Highlight usages of element at caret.

The same works on try and throws keywords with a choice of exceptions to highlight.

Here is a screenshot from IntelliJ IDEA Tip of the Day:

exceptions highlighted

Note that there is no way to highlight it by particular exception class until you select this class from the list of suggestions:

exceptions to highlight


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...