Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

The patterns is like this:

<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.

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?

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.

like image 225
Simon Groenewolt Avatar asked May 25 '09 10:05

Simon Groenewolt


4 Answers

@zvikico made me research the Grep Console more - it can be set up to make clickable links!

Current Link: http://marian.schedenig.name/projects/grep-console/ - you can install it with Eclipse-Marketplace

To get clickable Links, one has to do this:

  1. Install Grep Console (I'm using 3.7.0)
  2. Add a new Expression (the (?) Icon in the Console View) for your File/URL, make sure, that your regex capture only the File/Link or you have a capturing group () to match only the File/Link

    FFDC-Vorfall an (.*\.txt)

    will match Console-Outputs like this one:

    FfdcProvider logIncident FFDC1003I: FFDC-Vorfall an C:\server1_e2f9557d_16.01.20_12.54.37.4484801293756887191925.txt erstellt.

  3. In the Styles & Links Tab of this Expression, double click on the "Link" cells of either your Whole Line or Capturing Group.

  4. Choose File or URL

  5. In the Input field for File/URL use either {line} or {1} for the first Group. Grep Console will then use that value.

  6. (Optional) Make a style like blue underlined, so the Links are highlighted

  7. To open a file/link, you have to hold the CTRL key (can be changed in options), and click it

see: Styles & Links and Pattern Strings of the Documentation

like image 64
hinneLinks Avatar answered Oct 28 '22 06:10

hinneLinks


I've come to this question several years later, wanting to do this sort of thing with Eclipse CDT. Sunshade Errorlink did not seem to work in my version of Eclipse (which is 4.4.0). Thus I have thrown together a simple and unprofessional plugin that seems to be solving the problem adequately for me. I've put it on GitHub in case anybody else might want to save themselves a similar hassle, or to use my code as a reference: https://github.com/mjwach/ErrorLinkyThing

like image 42
mjwach Avatar answered Oct 28 '22 05:10

mjwach


EDIT: 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!) :)

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.

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>

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

like image 26
Kothar Avatar answered Oct 28 '22 06:10

Kothar


Grep Console plugin will do exactly that.

like image 25
zvikico Avatar answered Oct 28 '22 04:10

zvikico