Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to listen to a compilation error as soon as it happens
How to listen to a compilation error as soon as it happens [message #825644] Wed, 21 March 2012 00:20 Go to next message
Eclipse UserFriend
Hi, I would like to ask whether there is an event that I can listen to so that I know that a compilation occur. I'd tried listening to the marker change event but I will get the notification only after a user save the file. I saw that in Java editor, it can show quickfix and do the underlying as soon as the error occur. So this must be possible. I'd appreciate any suggestions.

Thanks a lot.
Re: How to listen to a compilation error as soon as it happens [message #825791 is a reply to message #825644] Wed, 21 March 2012 05:08 Go to previous messageGo to next message
Eclipse UserFriend
There is a reconcile operation that happens while somebody works on the editor without saving. One can add themselves as a CompilationParticipant and override reconcile to get called during the reconcile. In this function you could get hold to the AST of the program which will have the problems set.
Re: How to listen to a compilation error as soon as it happens [message #826667 is a reply to message #825791] Thu, 22 March 2012 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Satyam,

Thank you very much for your reply. I have tried extending the compilationParticipant extension point. I created a listener that extends the CompilationParticipant class and override reconcile method as you suggested. However, the reconcile method in my listener has never been called. Do you have any idea what might be the problem? My extension point is as below. In my reconcile method, I just do the System.out.println so that I know that it is called.

<extension
id="testlistener"
name="CompilerListener"
point="org.eclipse.jdt.core.compilationParticipant">
<compilationParticipant
class="test.views.CompileListener"
id="testlistener"
modifiesEnvironment="true">
</compilationParticipant>
</extension>
Re: How to listen to a compilation error as soon as it happens [message #826709 is a reply to message #826667] Thu, 22 March 2012 08:07 Go to previous message
Eclipse UserFriend
Never mind my last post. I did not know that I have to override isActive to return true for the project that I want to listen. Now it works fine.

Thank you very much.
Previous Topic:Upgrading from JAVA 6 to 7
Next Topic:Deleted.
Goto Forum:
  


Current Time: Fri May 16 02:13:14 EDT 2025

Powered by FUDForum. Page generated in 0.04279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top