Initializing LocalInspectionTool

What's the best practice for the mentioned subjects?

I'm developing a few inspections tools to enforce some weird project
standards. Currently, the checkClass() or checkMethod() methods contains
code that look up some PsiClasses by name (using the PsiManager) -- I
wonder if this kind of code can be moved to somewhere else so I don't need
to lookup these classes on every inspection?

On a related subject, now that InheritanceUtil.isInheritor(PsiClass,
PsiClass) is deprecated, what are we supposed to use in it's place?

--
Marcus Brito <pazu@animegaiden.com.br>


2 comments
Comment actions Permalink

Hi Marcus,

It sounds like these classes that you look up arent specific to the current inspected class/method/field?

If thats the case and you really do not want to keep the collection of PsiClasses in the inspection tool itself, you could create a seperate ProjectComponent that does the lookup and keeps the cache. The lookup could be done for instance in the projectOpened() method.
In your inspection you would then have to lookup this project component and get the cached PsiClasses.

Hope this helps,

Raymond Brandon

0
Comment actions Permalink

Em Tue, 18 May 2004 12:31:11 +0400, Raymond Brandon escreveu:

Hi Marcus,

It sounds like these classes that you look up arent specific to the
current inspected class/method/field?


Yes, not specific to the current inspected element -- it's something about
the Inspection per se.

If thats the case and you really do not want to keep the collection of
PsiClasses in the inspection tool itself, you could create a seperate
ProjectComponent that does the lookup and keeps the cache. The lookup
could be done for instance in the projectOpened() method. In your
inspection you would then have to lookup this project component and get
the cached PsiClasses.


Thanks for the tip, Raymond, I'll do this.

--
Marcus Brito <pazu@animegaiden.com.br>


0

Please sign in to leave a comment.