Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-core-dev] Adding new reconciling strategy with Document Model

Hi,
 
as you need the AST for your purpose, I would suggest to register an ICReconilingListener with the CEditor.
That way you are called with the computed AST by the C reconciler (in the reconciler background thread).
Note, though, that most of this is internal stuff and no public API. Ie. your code may break in future releases.
 
When you add annotations to the document's annotation model, you should make sure to synchronize against the lock object of the annotation model (see ISynchronizable).
And you are also responsible for removing the annotations, when they are no longer valid. 
 
HTH,
Toni

--
Anton Leherbauer
Wind River CDT Team, Austria



From: cdt-core-dev-bounces@xxxxxxxxxxx [mailto:cdt-core-dev-bounces@xxxxxxxxxxx] On Behalf Of chinmay narayan
Sent: Saturday, June 14, 2008 3:10 PM
To: CDT General developers list.; CDT Core developers list.
Subject: [cdt-core-dev] Adding new reconciling strategy with Document Model

Hi All,

I am trying to see the possibility of adding new annotation on th CDT editor. I was going through the code to see how C++ indexer type problem was added to the source code. What I understood from the source code is as follows:

There are 2 reconcilation strategies added a) CReconcilingStrategy ( I think it takes care of finding the CPPASTProblem types in the code ) and b) CSpellingReconcilerStrategy ( That takes care of finding spelling related problems in the code)

Once these two strategies reconcile any change in the documnet model, and generate a list of problems ( of IProblem types), document model (CDocumentModel.java) is responsible for putting the markers at appropriate place.

please correct me if my understanding is wrong. Now according to my requirement , I want to have a mechanism, where any change in document model allows me to call my reconciler strategy, where I will go through the AST and prepare a list of violations problems ( Violations are not syntax problems, but represent breaking of those rules that must be followed, for example, if a memory resource is present in a class , say pointer, it should have assignment operator and copy constructor overloaded, etc ). For finding such problem, I need to go through AST and find the instances of such violations. 
   Will reconcilining strategy be a good point to look into this problem, and first of all, is above explained way of handing is suitable for this problem.

thanks a lot in advance.
regards
chinmay


--
That, detective, is the right question. Program terminated.

Back to the top