print hyperlink to tool window
Is there a way to print hyperlinked text to IntelliJ's Run and Debug
windows from my java source files, such that I can click on the link in
the tool window and it will then take me back to my source file where my
link was printed from?
This would be similar to what IntelliJ does when an exception is thrown,
i.e. it prints out the file and line number and allows me to click on it
to get back to the place where the exception was thrown.
I would like to do something similar not involving exceptions.
Thanks,
Ted
Please sign in to leave a comment.
The only way to do this is to print text like
System.out.println
("\tat java.lang.reflect.Method.invoke(Method.java:585)");
Idea is smart enough so that lines that don't conform exactly to the
format don't get the underling, so you can't just underline arbitrary text.
Playing around, it seems that your string has to be
"\tat " + valid classname + "." + anything + "(" + anything + ":" + line
number + ")"
E.g.
\tat java.lang.Object.nonexistantMethod(Bingo:123)
will underline "Bingo:123" but clicking on it will take you to line 123
in Object.java
R
Thanks Robert.
What is
\tat
Thanks again,
Ted
\t is the tab character (see
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#101089
).
System.out.println
("\tat java.lang.reflect.Method.invoke(Method.java:585)");
gives
at java.lang.reflect.Method.invoke(Method.java:585)
HTH,
R
"Ted Hill" <thill_NOSPAM@tomotherapy.com> wrote in message
news:eantgf$ch7$1@is.intellij.net...
>
>
if you use log4j you can use something like this:
<param name="ConversionPattern" value="%-5p - - at
%c.%M(%F:%L)%n"/>
</layout>
</appender>
--
kind regards,
-m.j.milicevic
Great Question & answer.
This page info is so useful and I use this secret rule.
Thanks.