Eclipse Console - what are the rules that make stack traces clickable?

前端 未结 4 1528
失恋的感觉
失恋的感觉 2020-12-29 10:58

I log quite a bit of stuff, and have noticed that Eclipse Console makes Java stacktraces clickable. The exception is highlighted (goes to the \"Create Breakpoint\" dialog b

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-29 11:46

    This snippet may help. It can be placed anywhere in your code and will print a "clickable" line on the eclipse console:

    StackTraceElement s = Thread.currentThread().getStackTrace()[1];
    System.out.printf("%s.%s(%s:%s)%n", s.getClassName(), s.getMethodName(),
                s.getFileName(), s.getLineNumber());
    

    Update:

    This question has an answer, that may include a solution for your problem:

    Eclipse console: detect warning and error patterns and make them clickable


    Here we go: we have to contribute an implementation of org.eclipse.ui.console.IPatternMatchListenerDelegate through extension point org.eclipse.ui.console.consolePatternMatchListeners.

    The contributions that provide hyperlinks for exceptions and line numbers in stack traces are defined in the org.eclipse.jdt.debug.ui plugin, the implementing classes are in the same bundle.

    The rules are regular expressions and can be found in the plugin.xml of the contributing plugin.

提交回复
热议问题