如何让Eclipse控制台将文本超链接到源代码文件? [英] How to get Eclipse Console to hyperlink text to source code files?

查看:1118
本文介绍了如何让Eclipse控制台将文本超链接到源代码文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码中:
System.out.println(myPackage.MyClass);

In Code: System.out.println("myPackage.MyClass");

在Eclipse控制台:
myPackage.MyClass。 myMethod

In Eclipse Console: myPackage.MyClass.myMethod

我想在控制台中单击输出(myPackage.MyClass.myMethod),它直接显示相应的方法,类似于异常堆栈跟踪。任何想法?

I want to click on the output (myPackage.MyClass.myMethod) in Console and it directly shows the corresponding method, similar to what happens for exception stack traces. Any Idea?

推荐答案

异常堆栈跟踪的超链接基于文件名和行末尾给出的行号。例如

The hyperlinking for exception stack traces is based on the file name and line number given at the end of the line. E.g.

Stack trace:

org.eclipse.jface.internal.databinding.provisional.BindingException: string property does not have a read method.
at org.eclipse.jface.internal.databinding.internal.beans.JavaBeanObservableValue.doGetValue(JavaBeanObservableValue.java:102)
at org.eclipse.jface.internal.databinding.internal.beans.JavaBeanObservableValue.setValue(JavaBeanObservableValue.java:83)

对于第一个堆栈跟踪,文件 JavaBeanObservableValue.java 。在当前类路径中搜索文件,所以如果你有多个同名的类,第一个总是找到...

For the first stack trace, it is at line 102 in the file JavaBeanObservableValue.java. The file is searched after in the current class path so if you have multiple classes with the same name, the first is always found...

换句话说,如果你想要根据您的示例添加扩展超链接,您需要扩展控制台视图...

With other words, if you want to add extended hyperlinking based on your example, you need to extend the console view a bit...

...可以使用 org.eclipse.ui.console.consolePatternMatchListeners 扩展点。这是很容易使用这个扩展点,通过查看JDT的示例,你应该能够让你的例子工作没有太多的工作...

...which can be done with the org.eclipse.ui.console.consolePatternMatchListeners extension point. It is pretty easy to use this extension point and by looking at the example from JDT, you should be able to get your example to work without too much work...

这篇关于如何让Eclipse控制台将文本超链接到源代码文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆