Analyzing stack traces within a plugin

Hi,

I would like to be able to do the following:

Our plugin will soon be able to display description and comments from issues in the JIRA bugtracker. Sometimes, the description and/or comments happen to contain stack traces. I would like to be able to somehow be able to click on hyperlinked classes in the stack trace and open editors for them - maybe even automatically navigating to the line mentioned in the trace. I know IDEA itself is able to analyze stack traces - is it possible to tap into this feature from the plugin? Preferrably without having to invoke the "analyze stack trace" dialog?

Janusz

3 comments
Comment actions Permalink

Hello Janusz,

Our plugin will soon be able to display description and comments from
issues in the JIRA bugtracker. Sometimes, the description and/or
comments happen to contain stack traces. I would like to be able to
somehow be able to click on hyperlinked classes in the stack trace and
open editors for them - maybe even automatically navigating to the
line mentioned in the trace. I know IDEA itself is able to analyze
stack traces - is it possible to tap into this feature from the
plugin? Preferrably without having to invoke the "analyze stack trace"
dialog?


You can just show a console view using TextConsoleBuilderFactory and related
APIs (you can find many examples of its use in different plugins) and print
the stacktrace to the console. Then you'll get hyperlinking and source navigation
for free.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Well, almost there but not quite :). I managed to display stack trace with the following code:

TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
TextConsoleBuilder builder = factory.createBuilder(IdeaHelper.getCurrentProject());
ConsoleView view = builder.getConsole();
view.print(description, ConsoleViewContentType.NORMAL_OUTPUT);
console = view.getComponent();

The problem is - "description" is an HTML String. What ends up happening is that the string is displayed verbatim as text and not as HTML. Can I have both HTML display and hyperlinked stack traces?

0
Comment actions Permalink

Hello Janusz,

Well, almost there but not quite :). I managed to display stack trace
with the following code:

+TextConsoleBuilderFactory factory =
TextConsoleBuilderFactory.getInstance();+
+TextConsoleBuilder builder =
factory.createBuilder(IdeaHelper.getCurrentProject());+
ConsoleView view = builder.getConsole();
view.print(description, ConsoleViewContentType.NORMAL_OUTPUT);
console = view.getComponent();
The problem is - "description" is an HTML String. What ends up
happening is that the string is displayed verbatim as text and not as
HTML. Can I have both HTML display and hyperlinked stack traces?


You probably can, but you'll have to roll your own. Our editor, which is
used by the console, doesn't have any HTML support.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.