Home » Language IDEs » C / C++ IDE (CDT) » Error parser for external tool
Error parser for external tool [message #204076] |
Mon, 05 November 2007 10:35 |
Eclipse User |
|
|
|
Originally posted by: ups_genius.gmx.net
Hi everyone!
I created an error parser using the existing CDT stuff by basically
copying some of the GNU / make / ... error parsers' code. I also added the
extension point for the new error parser, and by debugging I see, that
when activated, the new error parser is actually used to parse the regular
build output.
The reason for writing this error parser though was to parse the output
produced by a batch file, run as "external tool". And this is what does
not work. The batch output is written to what seems to be another
"instance" of the console than the regular make/build output. And the
output to this console is not parsed by any of the error parsers.
Can anyone tell me how to run the error parser on this output? It does not
necessarily have to be in the way I tried it so far, any solution would be
helpful.
By the way: Is there maybe already a plugin that provides a configurable
output/error parser (e.g. like in textpad: regex for error output is
configurable per "external tool")
Thanks in advance,
Christian
|
|
|
Re: Error parser for external tool [message #204153 is a reply to message #204076] |
Tue, 06 November 2007 02:00 |
Eclipse User |
|
|
|
Originally posted by: ronbermejo.yahoo.com
Hello Christian!
Christian Opitz wrote:
> Hi everyone!
> I created an error parser using the existing CDT stuff by basically
> copying some of the GNU / make / ... error parsers' code. I also added the
> extension point for the new error parser, and by debugging I see, that
> when activated, the new error parser is actually used to parse the regular
> build output.
> The reason for writing this error parser though was to parse the output
> produced by a batch file, run as "external tool". And this is what does
> not work. The batch output is written to what seems to be another
> "instance" of the console than the regular make/build output. And the
> output to this console is not parsed by any of the error parsers.
> Can anyone tell me how to run the error parser on this output? It does not
> necessarily have to be in the way I tried it so far, any solution would be
> helpful.
Yup, the "External Tool" function is contributed by the org.eclipse.debug
plug-ins. You can try which extension points below are suitable for your
needs:
org.eclipse.debug.ui.consoleLineTrackers
org.eclipse.ui.console.consolePatternMatchListeners
Hth!
Ron
|
|
|
Re: Error parser for external tool [message #204166 is a reply to message #204153] |
Tue, 06 November 2007 09:08 |
Eclipse User |
|
|
|
Originally posted by: ups_genius.gmx.net
Ron Bermejo wrote:
> Hello Christian!
> Christian Opitz wrote:
>> Hi everyone!
>> I created an error parser using the existing CDT stuff by basically
>> copying some of the GNU / make / ... error parsers' code. I also added the
>> extension point for the new error parser, and by debugging I see, that
>> when activated, the new error parser is actually used to parse the regular
>> build output.
>> The reason for writing this error parser though was to parse the output
>> produced by a batch file, run as "external tool". And this is what does
>> not work. The batch output is written to what seems to be another
>> "instance" of the console than the regular make/build output. And the
>> output to this console is not parsed by any of the error parsers.
>> Can anyone tell me how to run the error parser on this output? It does not
>> necessarily have to be in the way I tried it so far, any solution would be
>> helpful.
> Yup, the "External Tool" function is contributed by the org.eclipse.debug
> plug-ins. You can try which extension points below are suitable for your
> needs:
> org.eclipse.debug.ui.consoleLineTrackers
> org.eclipse.ui.console.consolePatternMatchListeners
> Hth!
> Ron
This helps a lot! Thank you very much!
I am not quite sure how to use the existing functionality and what to add
myself yet, but at least now I have a point to start.
Have you done something similar before?
Thanks again!
Christian
|
|
|
Re: Error parser for external tool [message #204180 is a reply to message #204166] |
Tue, 06 November 2007 10:34 |
Eclipse User |
|
|
|
Originally posted by: ronbermejo.yahoo.com
Hello Christian!
Christian Opitz wrote:
> Ron Bermejo wrote:
>> Yup, the "External Tool" function is contributed by the org.eclipse.debug
>> plug-ins. You can try which extension points below are suitable for your
>> needs:
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners
>> Hth!
>> Ron
> This helps a lot! Thank you very much!
> I am not quite sure how to use the existing functionality and what to add
> myself yet, but at least now I have a point to start.
> Have you done something similar before?
Not really :-) I have only used the cdt errorparser extension point before.
BTW, are you sure you can't just use a CDT build console for this? e.g.,
create a custom make target to run the batch file (for makefile projects).
The reason I'm asking is that you will "lose" some features (such as
problem marker generation) if you use the generic console extension
points, and will have to reimplement them in your plug-in. You can take a
look at ErrorParserManager#generateMarker() and ACBuilder#addMarker() on
how this is done.
Hth!
Ron
|
|
|
Re: Error parser for external tool [message #204187 is a reply to message #204180] |
Tue, 06 November 2007 12:12 |
Eclipse User |
|
|
|
Originally posted by: ups_genius.gmx.net
Hi Ron!
Ron Bermejo wrote:
> Hello Christian!
> Christian Opitz wrote:
>> Ron Bermejo wrote:
>>> Yup, the "External Tool" function is contributed by the org.eclipse.debug
>>> plug-ins. You can try which extension points below are suitable for your
>>> needs:
>>> org.eclipse.debug.ui.consoleLineTrackers
>>> org.eclipse.ui.console.consolePatternMatchListeners
>>> Hth!
>>> Ron
>> This helps a lot! Thank you very much!
>> I am not quite sure how to use the existing functionality and what to add
>> myself yet, but at least now I have a point to start.
>> Have you done something similar before?
> Not really :-) I have only used the cdt errorparser extension point before.
> BTW, are you sure you can't just use a CDT build console for this? e.g.,
> create a custom make target to run the batch file (for makefile projects).
> The reason I'm asking is that you will "lose" some features (such as
> problem marker generation) if you use the generic console extension
> points, and will have to reimplement them in your plug-in. You can take a
> look at ErrorParserManager#generateMarker() and ACBuilder#addMarker() on
> how this is done.
> Hth!
> Ron
Thanks again!
I am not sure if this works, since I have at least 2 different batch
files, that I would like to run, both needing the selected directory/file
as parameter. One of the batch files is for a special build, the other one
is for a kind of code evaluation - so both do not really have the actual
project build functionality...
I am not so familiar with target configurations, but I will try it - it
seems to be the easier way compared to doing everything by myself in a new
plugin. I don't know where to start yet, but we will see...
Christian
|
|
|
Re: Error parser for external tool [message #204249 is a reply to message #204166] |
Wed, 07 November 2007 09:01 |
Eclipse User |
|
|
|
Originally posted by: mba.cosmigo.ru
Hi Christian,
I've got some experience with
org.eclipse.ui.console.consolePatternMatchListeners extension point. I
was able to parse output of our project to find lines with
__FILE__:__LINE__ output and even make links from console to code. But
as Ron had written in next post, I haven't yet found a way to add a
marker to Problems view. If you find a solution - please share your
experience.
Christian Opitz wrote:
> Ron Bermejo wrote:
>
>> Hello Christian!
>
>> Christian Opitz wrote:
>
>>> Hi everyone!
>
>>> I created an error parser using the existing CDT stuff by basically
>>> copying some of the GNU / make / ... error parsers' code. I also
>>> added the extension point for the new error parser, and by debugging
>>> I see, that when activated, the new error parser is actually used to
>>> parse the regular build output.
>
>>> The reason for writing this error parser though was to parse the
>>> output produced by a batch file, run as "external tool". And this is
>>> what does not work. The batch output is written to what seems to be
>>> another "instance" of the console than the regular make/build output.
>>> And the output to this console is not parsed by any of the error
>>> parsers.
>
>>> Can anyone tell me how to run the error parser on this output? It
>>> does not necessarily have to be in the way I tried it so far, any
>>> solution would be helpful.
>
>> Yup, the "External Tool" function is contributed by the
>> org.eclipse.debug plug-ins. You can try which extension points below
>> are suitable for your needs:
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners
>
>> Hth!
>> Ron
>
>
> This helps a lot! Thank you very much!
> I am not quite sure how to use the existing functionality and what to
> add myself yet, but at least now I have a point to start.
>
> Have you done something similar before?
>
> Thanks again!
> Christian
>
>
--
Best regards
Mikhail Barg
ICQ: 132560784
|
|
|
Re: Error parser for external tool [message #204266 is a reply to message #204249] |
Wed, 07 November 2007 13:16 |
Eclipse User |
|
|
|
Originally posted by: ups_genius.gmx.net
Hi Mikhail,
I certainly will let you know whenever it works. Right now, I don't even
get my plugin using the
org.eclipse.ui.console.consolePatternMatchListeners extension point to
work, it just does not get called.
Did you release the work you have done somewhere? Is there a possibility
to have a look at it? Could you maybe have a look at the following things?
1. Created a simple new plugin project
2. Used the mentioned extension:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.console.consolePatternMatchListeners" >
<consolePatternMatchListener
class="de.mystuff.console.parser.QacConsoleTracker"
id="de.mystuff.console.parser.QacConsoleTracker"
regex=".*?">
</consolePatternMatchListener>
</extension>
</plugin>
3. Created Class to process the console activity:
package de.mystuff.console.parser;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.ui.console.*;
/**
* Implementation of the
org.eclipse.ui.console.consolePatternMatchListeners
* extension point.
*/
public class QacConsoleTracker implements IPatternMatchListenerDelegate
{
private final Pattern FILE_LINE_PATTERN =
Pattern.compile(".*?");
private TextConsole console;
public void connect(TextConsole console)
{
this.console = console;
}
public void disconnect()
{
this.console = null;
}
public void matchFound(PatternMatchEvent event)
{
...
}
}
Mikhail Barg wrote:
> Hi Christian,
> I've got some experience with
> org.eclipse.ui.console.consolePatternMatchListeners extension point. I
> was able to parse output of our project to find lines with
> __FILE__:__LINE__ output and even make links from console to code. But
> as Ron had written in next post, I haven't yet found a way to add a
> marker to Problems view. If you find a solution - please share your
> experience.
|
|
|
Re: Error parser for external tool [message #204306 is a reply to message #204266] |
Wed, 07 November 2007 17:12 |
Eclipse User |
|
|
|
Originally posted by: ups_genius.gmx.net
Christian Opitz wrote:
> Right now, I don't even
> get my plugin using the
> org.eclipse.ui.console.consolePatternMatchListeners extension point to
> work, it just does not get called.
Ok, stupid mistake. Plugin works. I'll update you on any news
|
|
|
Re: Error parser for external tool [message #204337 is a reply to message #204306] |
Thu, 08 November 2007 08:38 |
Eclipse User |
|
|
|
Originally posted by: mba.cosmigo.ru
Hi Christian,
Christian Opitz wrote:
> Christian Opitz wrote:
>
>> Right now, I don't even get my plugin using the
>> org.eclipse.ui.console.consolePatternMatchListeners extension point to
>> work, it just does not get called.
>
>
> Ok, stupid mistake. Plugin works. I'll update you on any news
>
Much appreciated.
Regarding your previous letter - I'll send you my code if you need it,
but as you managed to make it work yourself, there would be nothing
really interesting in my code for you then.
--
Best regards
Mikhail Barg
ICQ: 132560784
|
|
|
Re: Error parser for external tool [message #204472 is a reply to message #204249] |
Fri, 09 November 2007 07:03 |
Eclipse User |
|
|
|
Originally posted by: ronbermejo.yahoo.com
Mikhail Barg wrote:
> Hi Christian,
> I've got some experience with
> org.eclipse.ui.console.consolePatternMatchListeners extension point. I
> was able to parse output of our project to find lines with
> __FILE__:__LINE__ output and even make links from console to code. But
> as Ron had written in next post, I haven't yet found a way to add a
> marker to Problems view. If you find a solution - please share your
> experience.
Hello Mikhail!
Regarding adding markers to the Problems view, you can do this using
IResource#addMarker(). So, the real problem is converting the (String)
filename that you would get from the regexp, to the correct IResource
object.
You can have a look at how ErrorParserManager does this. Or, maybe you
could even just create an instance of ErrorParserManager somewhere (e.g.
during connect(IConsole)) and write() all matching lines to it.
Hth!
Ron
|
|
|
Re: Error parser for external tool [message #204479 is a reply to message #204472] |
Fri, 09 November 2007 09:04 |
Eclipse User |
|
|
|
Originally posted by: mba.cosmigo.ru
Hi Ron,
Ron Bermejo wrote:
> Regarding adding markers to the Problems view, you can do this using
> IResource#addMarker().
Wow, it works! Thanks a lot! Now it'll have to think of when I want to
remove the markers... But it's a my design problems..
> So, the real problem is converting the (String)
> filename that you would get from the regexp, to the correct IResource
> object.
> You can have a look at how ErrorParserManager does this. Or, maybe you
> could even just create an instance of ErrorParserManager somewhere (e.g.
> during connect(IConsole)) and write() all matching lines to it.
I've already managed to do this with ISourceLookupDirector, but it works
only for files which actually exist in the project, not in /includes, as
I wrote in "ISourceLookupDirector and included files" thread.. I'll try
checking ErrorParserManager a bit deeper. Thanks again.
--
Best regards
Mikhail Barg
ICQ: 132560784
|
|
| | | |
Goto Forum:
Current Time: Tue Apr 23 17:52:39 GMT 2024
Powered by FUDForum. Page generated in 0.03851 seconds
|