Home » Eclipse Projects » Eclipse Platform » How do i read from a console???
| How do i read from a console??? [message #324908] |
Mon, 04 February 2008 08:09  |
Eclipse User |
|
|
|
How do i read from a console???
Let me describe you the sitiuation.....
I have a plugin, which has to read the console messages.
(Its not something like using System.in to read console inputs).
ie.,
During the compilation of the C file,
the compiler used to generate compilation messages and these messages got
printed in the console.
Is there any way to read that console messages...???
Any suggestions please....!!!
Thanks for your time....
Regards,
Ravi.
|
|
| |
| Re: How do i read from a console??? [message #324974 is a reply to message #324912] |
Tue, 05 February 2008 01:31   |
Eclipse User |
|
|
|
Christian wrote:
> ravi schrieb:
>> How do i read from a console???
>>
>> Let me describe you the sitiuation.....
>>
>> I have a plugin, which has to read the console messages.
>> (Its not something like using System.in to read console inputs).
>>
>> ie.,
>> During the compilation of the C file, the compiler used to generate
>> compilation messages and these messages got printed in the console.
>>
>> Is there any way to read that console messages...???
>>
>> Any suggestions please....!!!
>>
>> Thanks for your time....
>>
>>
>> Regards,
>> Ravi.
>>
>>
>>
>>
>>
>>
> Isn't that exactly what System.out is for.
> The program you are using to compile some c or any other program .. you
> need to redirect its System.out to your application.
> The easiest way is to start this program as a subprocess see
> ProcessBuilder , Process.
> Christian
Thanks Christian for the comments......
i have Plugin X which has a c/c++ compiler in it, which gives the
compilation messages on Build.
I dont have any control on it.(so i cannt redirect it to my application)
Also, i dont have any knowledge on how those messages are streamed to the
console.
Now i want to create a plugin Y which should listen for the console
messages given by the other plugin(Say Plugin X) and capture it.
Is there an option to add a listener to the console, so that when ever the
console gets the data, can we read it from there....
or is there any other option to do it....???
Any ideas ...???
Thanks and Regards,
Ravi.
|
|
|
| Re: How do i read from a console??? [message #324975 is a reply to message #324974] |
Tue, 05 February 2008 02:39   |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
Are you using CDT? If so, there are extensions to write error parsers (parse
output generated by the compiler).
--
Derek
ravi wrote:
> Christian wrote:
>
>> ravi schrieb:
>>> How do i read from a console???
>>>
>>> Let me describe you the sitiuation.....
>>>
>>> I have a plugin, which has to read the console messages.
>>> (Its not something like using System.in to read console inputs).
>>>
>>> ie.,
>>> During the compilation of the C file, the compiler used to generate
>>> compilation messages and these messages got printed in the console.
>>>
>>> Is there any way to read that console messages...???
>>>
>>> Any suggestions please....!!!
>>>
>>> Thanks for your time....
>>>
>>>
>>> Regards,
>>> Ravi.
>>>
>>>
>>>
>>>
>>>
>>>
>> Isn't that exactly what System.out is for.
>> The program you are using to compile some c or any other program ..
>> you need to redirect its System.out to your application.
>
>> The easiest way is to start this program as a subprocess see
>> ProcessBuilder , Process.
>
>> Christian
>
>
>
> Thanks Christian for the comments......
>
> i have Plugin X which has a c/c++ compiler in it, which gives the
> compilation messages on Build.
> I dont have any control on it.(so i cannt redirect it to my application)
> Also, i dont have any knowledge on how those messages are streamed to
> the console.
>
> Now i want to create a plugin Y which should listen for the console
> messages given by the other plugin(Say Plugin X) and capture it.
>
> Is there an option to add a listener to the console, so that when ever
> the console gets the data, can we read it from there....
>
> or is there any other option to do it....???
>
>
> Any ideas ...???
>
>
> Thanks and Regards,
> Ravi.
>
>
|
|
| |
| Re: How do i read from a console??? [message #325002 is a reply to message #324977] |
Tue, 05 February 2008 10:16   |
Eclipse User |
|
|
|
Originally posted by: mark_melvin.amis.com
On Tue, 05 Feb 2008 03:44:19 -0500, ravi <ravikumars@tataelxsi.co.in>
wrote:
> Derek Morris wrote:
>
>> Are you using CDT? If so, there are extensions to write error parsers
>> (parse output generated by the compiler).
>
>
> Sorry Morris... I cann't understand, can u please explain....
>
> i want to capture the build messages on eclipse. On clicking build the
> gcc compiler gives the build messages of the selected project on the
> console.
>
> In command line i can pipe the build message to a file.
>
> But i want my plugin to do the same, ie.,
> to capture the build messages from the console...???
>
> How can i make use of CDT here..??
>
> Thanks in advance....
>
>
> Regards,
> Ravi.
Are you using the CDT or aren't you? If you are - there is an extension
point that allows you to hook error parsers up to the console output
(which is exactly what Derek said).
If you are not using the CDT, and you currently have the build output
going to an Eclipse process console, have a look at the following
extension points in the online help:
org.eclipse.debug.ui.consoleLineTrackers
org.eclipse.ui.console.consolePatternMatchListeners
I guess to help any further, if you are still confused, we need to know
more about how your compiler is launched. Is it launched from the CDT
automatically, or are you running an external tool, or have you done
something entirely custom in your own plugin?
M.
|
|
|
| Re: How do i read from a console??? [message #325094 is a reply to message #325002] |
Fri, 08 February 2008 04:04   |
Eclipse User |
|
|
|
Hi Mark....
Thanks for the helpful...
It was really useful....
I created a parser using cdt Errorparser extension point.
Through that parser am pipeing my console output to a file.
Is there a way to enable my error parser by default???
Because at first this error parser should be enabled in preference
settings,
otherwise, the parser wont be active.
Is there a way to do it???
Thanks in advance,
Regards,
Ravi.
Mark Melvin wrote:
> On Tue, 05 Feb 2008 03:44:19 -0500, ravi <ravikumars@tataelxsi.co.in>
> wrote:
>> Derek Morris wrote:
>>
>>> Are you using CDT? If so, there are extensions to write error parsers
>>> (parse output generated by the compiler).
>>
>>
>> Sorry Morris... I cann't understand, can u please explain....
>>
>> i want to capture the build messages on eclipse. On clicking build the
>> gcc compiler gives the build messages of the selected project on the
>> console.
>>
>> In command line i can pipe the build message to a file.
>>
>> But i want my plugin to do the same, ie.,
>> to capture the build messages from the console...???
>>
>> How can i make use of CDT here..??
>>
>> Thanks in advance....
>>
>>
>> Regards,
>> Ravi.
> Are you using the CDT or aren't you? If you are - there is an extension
> point that allows you to hook error parsers up to the console output
> (which is exactly what Derek said).
> If you are not using the CDT, and you currently have the build output
> going to an Eclipse process console, have a look at the following
> extension points in the online help:
> org.eclipse.debug.ui.consoleLineTrackers
> org.eclipse.ui.console.consolePatternMatchListeners
> I guess to help any further, if you are still confused, we need to know
> more about how your compiler is launched. Is it launched from the CDT
> automatically, or are you running an external tool, or have you done
> something entirely custom in your own plugin?
> M.
|
|
|
| Re: How do i read from a console??? [message #325097 is a reply to message #325094] |
Fri, 08 February 2008 04:50   |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
See the Managed Build System Extensibility Document, which is in the help
supplied with the CDT SDK.
The explains how to add a complete toolchain to CDT (including doing what you
require).
--
Derek
ravi wrote:
> Hi Mark....
>
> Thanks for the helpful...
> It was really useful....
>
> I created a parser using cdt Errorparser extension point.
> Through that parser am pipeing my console output to a file.
>
> Is there a way to enable my error parser by default???
>
> Because at first this error parser should be enabled in preference
> settings,
> otherwise, the parser wont be active.
>
> Is there a way to do it???
>
> Thanks in advance,
>
> Regards,
> Ravi.
>
>
> Mark Melvin wrote:
>
>> On Tue, 05 Feb 2008 03:44:19 -0500, ravi <ravikumars@tataelxsi.co.in>
>> wrote:
>
>>> Derek Morris wrote:
>>>
>>>> Are you using CDT? If so, there are extensions to write error
>>>> parsers (parse output generated by the compiler).
>>>
>>>
>>> Sorry Morris... I cann't understand, can u please explain....
>>>
>>> i want to capture the build messages on eclipse. On clicking build
>>> the gcc compiler gives the build messages of the selected project on
>>> the console.
>>>
>>> In command line i can pipe the build message to a file.
>>>
>>> But i want my plugin to do the same, ie.,
>>> to capture the build messages from the console...???
>>>
>>> How can i make use of CDT here..??
>>>
>>> Thanks in advance....
>>>
>>>
>>> Regards,
>>> Ravi.
>
>> Are you using the CDT or aren't you? If you are - there is an
>> extension point that allows you to hook error parsers up to the
>> console output (which is exactly what Derek said).
>
>> If you are not using the CDT, and you currently have the build output
>> going to an Eclipse process console, have a look at the following
>> extension points in the online help:
>
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners
>
>> I guess to help any further, if you are still confused, we need to
>> know more about how your compiler is launched. Is it launched from
>> the CDT automatically, or are you running an external tool, or have
>> you done something entirely custom in your own plugin?
>
>> M.
>
>
|
|
|
| Re: How do i read from a console??? [message #325572 is a reply to message #325002] |
Fri, 22 February 2008 07:04   |
Eclipse User |
|
|
|
Mark Melvin wrote:
> On Tue, 05 Feb 2008 03:44:19 -0500, ravi <ravikumars@tataelxsi.co.in>
> wrote:
>> Derek Morris wrote:
>>
>>> Are you using CDT? If so, there are extensions to write error parsers
>>> (parse output generated by the compiler).
>>
>>
>> Sorry Morris... I cann't understand, can u please explain....
>>
>> i want to capture the build messages on eclipse. On clicking build the
>> gcc compiler gives the build messages of the selected project on the
>> console.
>>
>> In command line i can pipe the build message to a file.
>>
>> But i want my plugin to do the same, ie.,
>> to capture the build messages from the console...???
>>
>> How can i make use of CDT here..??
>>
>> Thanks in advance....
>>
>>
>> Regards,
>> Ravi.
> Are you using the CDT or aren't you? If you are - there is an extension
> point that allows you to hook error parsers up to the console output
> (which is exactly what Derek said).
> If you are not using the CDT, and you currently have the build output
> going to an Eclipse process console, have a look at the following
> extension points in the online help:
> org.eclipse.debug.ui.consoleLineTrackers
> org.eclipse.ui.console.consolePatternMatchListeners
> I guess to help any further, if you are still confused, we need to know
> more about how your compiler is launched. Is it launched from the CDT
> automatically, or are you running an external tool, or have you done
> something entirely custom in your own plugin?
> M.
Hi,
Thanks for the help,
I created a parser using cdt Errorparser extension point.
i am getting the build messages with the help of it.
public boolean processLine(String LINE, ErrorParserManager arg1)
{
==> LINE gives the Build messages line by line.
}
But, i want to know the end of the build message.
ie.,
when we give "Build project" the build process takes place and we are
getting build messages for that project. Is there any function which will
indicate that this is the end of the build message???
Because, at the end of the build message i want to parse the Build
messages,
Since i dont know when i will get the last line of Build message, i dont
know when i should start other activity(Parsing the final output).
Is there a function, which will indicate the END of the Build messages???
Thanks in advance...
Regards,
Ravi.
|
|
|
| Re: How do i read from a console??? [message #325573 is a reply to message #325572] |
Fri, 22 February 2008 08:11   |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
ravi wrote:
> Mark Melvin wrote:
>
>> On Tue, 05 Feb 2008 03:44:19 -0500, ravi <ravikumars@tataelxsi.co.in>
>> wrote:
>
>>> Derek Morris wrote:
>>>
>>>> Are you using CDT? If so, there are extensions to write error
>>>> parsers (parse output generated by the compiler).
>>>
>>>
>>> Sorry Morris... I cann't understand, can u please explain....
>>>
>>> i want to capture the build messages on eclipse. On clicking build
>>> the gcc compiler gives the build messages of the selected project on
>>> the console.
>>>
>>> In command line i can pipe the build message to a file.
>>>
>>> But i want my plugin to do the same, ie.,
>>> to capture the build messages from the console...???
>>>
>>> How can i make use of CDT here..??
>>>
>>> Thanks in advance....
>>>
>>>
>>> Regards,
>>> Ravi.
>
>> Are you using the CDT or aren't you? If you are - there is an
>> extension point that allows you to hook error parsers up to the
>> console output (which is exactly what Derek said).
>
>> If you are not using the CDT, and you currently have the build output
>> going to an Eclipse process console, have a look at the following
>> extension points in the online help:
>
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners
>
>> I guess to help any further, if you are still confused, we need to
>> know more about how your compiler is launched. Is it launched from
>> the CDT automatically, or are you running an external tool, or have
>> you done something entirely custom in your own plugin?
>
>> M.
>
>
> Hi,
>
> Thanks for the help,
>
> I created a parser using cdt Errorparser extension point.
>
> i am getting the build messages with the help of it.
>
> public boolean processLine(String LINE, ErrorParserManager arg1) {
> ==> LINE gives the Build messages line by line.
> }
>
> But, i want to know the end of the build message.
> ie.,
>
> when we give "Build project" the build process takes place and we are
> getting build messages for that project. Is there any function which
> will indicate that this is the end of the build message???
> Because, at the end of the build message i want to parse the Build
> messages,
> Since i dont know when i will get the last line of Build message, i dont
> know when i should start other activity(Parsing the final output).
>
> Is there a function, which will indicate the END of the Build messages???
>
> Thanks in advance...
>
>
> Regards,
> Ravi.
>
>
>
Why wait until the end? Just process the data as it arrives. You' get EOF when
it finishes.
--
Derek
|
|
|
| Re: How do i read from a console??? [message #325645 is a reply to message #325573] |
Mon, 25 February 2008 04:07  |
Eclipse User |
|
|
|
Hi,
This is my code for getting console messages...
public class myParser implements IErrorParser {
ArrayList<String> consoleDatas = new ArrayList<String>();
public boolean processLine(String line, ErrorParserManager arg1)
{
consoleDatas.add(line);
return false;
}
}
In the array list am storing the datas,
The processLine(String line, ErrorParserManager arg1) function gives the
console messages line by line.
SO, i can start processing the data once i get form the function. That i
agree.
But, is there a way to check the End of build messages.
Because,
"String line" doesn't carry EOF or null to indicate the End of the
Build messages.
"ErrorParserManager arg1" does this arg1 helpful in this case???
The problem would be, when am selecting more then one project and giving
build command, at that time i will get build meaasges for the project one
after the other. I will get every thing in one string, i just thought of
seperating it per project if there is any way to do it over here.
Thanks and Regards,
Ravi.
|
|
|
Goto Forum:
Current Time: Mon Oct 27 03:37:13 EDT 2025
Powered by FUDForum. Page generated in 0.08791 seconds
|