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

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

问题描述

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

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

在 Eclipse 控制台中:myPackage.MyClass.myMethod

In Eclipse Console: myPackage.MyClass.myMethod

我想在Console中点击输出(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 中的第 102 行.在当前类路径中搜索该文件,因此如果您有多个具有相同名称的类,则始终会找到第一个...

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天全站免登陆