Is it possible using "Find usages" functionality of IDEA in my plugin?

Hello guys!

I'm gonna write my own plugin for IDEA and have a lot of questions because I'm completely newbie in plugin development.

I read documentation by Alexey Efimov and FAQ on your site, but still have a lot of questions.

The first one is about using some IDEA functionality in plugins. For instance, if I want to know what classes use class my.package.MyClass I would like to use the Find usages feature embedded in IDEA. but I don't know is this functionality accessible through idea open api.

2. In many of your answers in FAQ you operate w/ PsiClass objects (question about how to find all subclasses of a class). Actually, I didn't find any convenient way to access all classes at a module. How to get all full qualified names of all classes in a module?

3. Can I compile a module sources in action handler? How to do it?

4. I want to place menu item in popup menu (this menu appears when you right-click on code) but I don't know what group-id should I use in add-to-group. So, I set it to RunMenu =(

]]>

0

Hello Taras,

The first one is about using some IDEA functionality in plugins. For
instance, if I want to know what classes use class my.package.MyClass
I would like to use the Find usages feature embedded in IDEA. but I
don't know is this functionality accessible through idea open api.


It certainly is: if you want to perform a search from code (with no user
interface), you can use com.intellij.psi.search.searches.ReferencesSearch.
Or perhaps you want to lauch the "Find Usages" user interface through code?


2. In many of your answers in FAQ you operate w/ PsiClass objects
(question about how to find all subclasses of a class). Actually, I
didn't find any convenient way to access all classes at a module. How
to get all full qualified names of all classes in a module?


For searching subclasses, you can use com.intellij.psi.search.searches.ClassInheritorsSearch.
For getting a list of all classes (what for?) I think PsiManager.getShortNamesCache().getAllClassNames()
will work.

Taras


0

Thank you a lot, Taras. Is there a way in IDEA to run a compilation of a project and get a result of the compilation?

0

请先登录再写评论。