Declaring language elements for Java interop

Hi all,

I'd like to declare elements in my plugin that interact with Java in mixed projects. In particular, I'd like to know how to:

1. Declare an element as the implementation of an interface, or the implementation of an interface method.
2. Declare an element as the extension of a concrete class, or an override for an instance method.
3. Declare an element as the declaration of a new class or interface.

In each of these cases my PSI elements are not derived from e.g. PsiMethod or PsiClass, which a lot of the built-in infrastructure seems to assume.

Thanks,
Colin

1 comment

For those who are interested, the solution for the first two options seems to be to implement QueryExecutor and publish the implementations at the definitionsSearch and classInheritorsSearch extension points.

The solution for providing class instantiations seems to require a combination of a PsiElementFinder implementation published at java.elementFinder, a ChooseByNameContributor implementation published at gotoClassContributor, and a PsiShortNamesCache implementation at java.shortNamesCache.

I haven't actually done any of this yet but that seems to be the solution. If I've missed anything I'd appreciate some clarification.

0

Please sign in to leave a comment.