Eclipse 控制台:检测警告和错误模式并使其可点击

时间:2023-01-13
本文介绍了Eclipse 控制台:检测警告和错误模式并使其可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在 Eclipse 中的 ant 中为我们的一些构建运行 flex 编译器 (mxmlc)(它们也打算在我们的持续集成服务器上运行,这就是我不使用 flex builder 本身构建的原因) -- eclipse-console无法识别mxmlc的模式,所以我无法点击它们.

I'm running the flex compiler (mxmlc) from ant inside eclipse for some of our builds (they are meant to run on our continuous integration server as well, that is why I don't build using flex builder itself) -- the patterns of mxmlc are not recognized by the eclipse-console, so I cannot click on them.

图案是这样的:

<文件的绝对路径>(<line no>): col: <column no>警告:<消息>

<absolute path to file>(<line no>): col: <column no> Warning: <message>

想出一个正则表达式来检测这些消息应该不难.

It should not be that hard to come up with a regex for detecting these messages.

如何让 eclipse 识别新类型的错误消息?我是否必须编写自己的扩展程序,或者是否有一些一般支持,我可以在配置中添加正则表达式?

How do I get eclipse to recognize a new type of error message? Do I have to program my own extension or is there some general support where I can just add a regex to the configuration?

我也可以尝试让 ant 将错误翻译成看起来像 java 错误的东西,但我宁愿让 eclipse 识别 mxmlc 错误.

I could also try to make ant translate the errors to something that looks like java errors, but I'd rather make eclipse recognize the mxmlc errors.

推荐答案

我发现了一个插件,它看起来更多:Sunshade Errorlink(向下滚动一点).我不确定这到底有多灵活,但它提到了 ant 支持.

I found a plugin that does this with a bit more looking: Sunshade Errorlink (scroll down a bit). I'm not sure exactly how flexible this is, but it mentions ant support.

我知道您可能想要一个实际的实现,但这里是您想要的插件设计的粗略起点.如果有人想实现它,请在此处放置一个链接以指向它.如果我有空闲时间,我可能会自己做(哈!):)

I know you probably want an actual implementation, but here is a rough starting point for a design for the plugin you want. If anyone feels like implementing it, please put a link here to point to it. I might do it myself if I get some spare time (ha!) :)

假设控制台基于 TextConsole,这似乎是合理的,规范 说:

Assuming that the console is based on TextConsole, which seems reasonable, the spec says:

一个抽象的文本控制台,支持正则表达式匹配和超链接.

An abstract text console that supports regular expression matching and hyperlinks.

模式匹配侦听器可以通过编程方式注册到控制台或通过 org.eclipse.ui.console.consolePatternMatchListeners扩展点.

Pattern match listeners can be registered with a console programmatically or via the org.eclipse.ui.console.consolePatternMatchListeners extension point.

我做了更多的查找,该扩展点的规范具有以下示例:

I did a bit more looking, and the spec for that extension point has the following example:

<extension point="org.eclipse.ui.console.consolePatternMatchListener">
  <consolePatternMatchListener
    class="com.example.ExampleConsolePatternMatcher"
    id="com.example.ExampleConsolePatternMatcher"
    regex=".*foo.*">
    <enablement>
      <test 
        property="org.eclipse.ui.console.consoleTypeTest"
        value="exampleConsole"/>
    </enablement>
  </consolePatternMatchListener>
</extension>

您需要 IPatternMatchListenerDelegate 然后你应该能够使用 TextConsole.addHyperlink 来创建你想要的链接.

You'll want the API of the IPatternMatchListenerDelegate and you should then be able to use TextConsole.addHyperlink to create the link you want.

这篇关于Eclipse 控制台:检测警告和错误模式并使其可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:在控制台中捕获按键 下一篇:Sublime Text 2中的Java控制台输入?

相关文章

最新文章