Using the existing panels

Is it possible to use the existing, docked panels provided by IDEA through open api? What I'm talking about is e.g. the Messages panel (for showing custom compilation errors) and Find panel for showing custom find results. I would like to add some own data there but I can't figure out how.

If it isn't possible to use the panel directly, is it possible to use some of the existing functionality in my own panel? I would like to have the same look and feel as in IDEA, so I would like to use same kind of tree view e.g. for find usages with occurrences grouped by packages and files, and the "Collapse all", "Rerun search", etc. buttons on the left side of the panel. Is there a way to do it? Best thing would be to be able to simply provide a model containing my custom data for the same GUI component that currently already renders those panels.

Any help is appreciated. Thanks!

8 comments
Comment actions Permalink

Markus Halttunen wrote:

Is it possible to use the existing, docked panels provided by IDEA through open api? What I'm talking about is e.g. the Messages panel (for showing custom compilation errors) and Find panel for showing custom find results. I would like to add some own data there but I can't figure out how.

If it isn't possible to use the panel directly, is it possible to use some of the existing functionality in my own panel? I would like to have the same look and feel as in IDEA, so I would like to use same kind of tree view e.g. for find usages with occurrences grouped by packages and files, and the "Collapse all", "Rerun search", etc. buttons on the left side of the panel. Is there a way to do it? Best thing would be to be able to simply provide a model containing my custom data for the same GUI component that currently already renders those panels.

Any help is appreciated. Thanks!


I don't know about using the existing panels, but I do know that some
functionality is provided. For instance, if your panel creates a toolbar
(near the messages tree) and you want expandall/collapseAll, you can use:

myActionGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(expander));

myActionGroup.add(CommonActionsManager.getInstance().createExpandAllAction(expander));

See the OpenAPI API for details...

If you find more existing functionality that is availbale - it would be
nice if you posted it here too, so others might enjoy as well (javadocs
are not too useful)

0
Comment actions Permalink

Thanks, Arik, for your reply. However, it would be very nice to get a comment on this from Maxim, to really know wether such functionality already exists.

Looking e.g. at the "Find - Occurrences of" dialog, it would seem so nice to be able simply provide it with a model containing the target of search and the matching files and PsiElements. Then it would automatically format them for me in a standard tree structure, i.e folders --> files --> occurrences within file.

Also it would provide me e.g. the functionality to move to next or previous occurrence, etc.

I would be interested to know if there are any classes in the Open API that would provide at least part of that kind of functionality for me.

0
Comment actions Permalink

It depends on which particular toolwindow you're going to reuse. I mean you're
not able to create your own toolwindow that behaives exactly like messages
or find at least by means of OpenAPI but you should be to embed your data
into existing find results for instance. Would you please shed some light
into what particular functionality you're going to implement?

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Thanks, Arik, for your reply. However, it would be very nice to get a
comment on this from Maxim, to really know wether such functionality
already exists.

Looking e.g. at the "Find - Occurrences of" dialog, it would seem so
nice to be able simply provide it with a model containing the target
of search and the matching files and PsiElements. Then it would
automatically format them for me in a standard tree structure, i.e
folders --> files --> occurrences within file.

Also it would provide me e.g. the functionality to move to next or
previous occurrence, etc.

I would be interested to know if there are any classes in the Open API
that would provide at least part of that kind of functionality for me.



0
Comment actions Permalink

That's exactly what I would want to do - embed my data into existing find results panel / tree. Or to be more exact, I would want the existing find results to be empty and add all the results myself.

For a simplistic example, I have an XML file that has references to other XML elements in the same file. I'm implementing "find references" functionality. So for example:

  
  
    
  

]]>


Now the user could go to elementId1 and select "Find Usages" and I would find out that in the case of the example, elementId2 references to it. That part I think I can implement myself.

Now, I would like to show the results to the user just like he would have used the actual "Find Usages" functionality provided by IDEA, e.g. to find usages of a Java method. There I could use some help because just as you said, it would be very difficult to implement the gui part so that the toolwindow would look identical to IDEA's find usages functionality.

I hope I explained this well enough. If not, please feel free to ask more questions. :)

0
Comment actions Permalink

Maxim, it would be great if you could answer this based on the information I provided. I have tried to search for the functionality myself but have not been able to find any trace of it.

0
Comment actions Permalink

Markus,

There's indeed an API to acheive what you're asking for. I'm just not sure
I could come up with really short sample quickly.
Try exploring com.intellij.usages package and primarily com.intellij.usages.UsageViewManager
whoes instance can be acquired via project.getComponent(UsageViewManager.class).
You'll have to implement UsageTarget and Usage classes for your reference/referent
relations and bunch of UsageInFile etc. interfaces for usage view to lay
them out properly.


-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Maxim, it would be great if you could answer this based on the
information I provided. I have tried to search for the functionality
myself but have not been able to find any trace of it.



0
Comment actions Permalink

Maxim,

Thank you for your answer!

However, I have not been able to find information about that class in the Open API documentation or the libraries that I currently have. Is this functionality only available in the EAP version of IDEA?

If not, where should I look for the latest version of Open API jars and documentation? Thank you!

0
Comment actions Permalink

It's indeed in EAP only. Hooking into usage view was impossible in 4.5.x
-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Maxim,

Thank you for your answer!

However, I have not been able to find information about that class in
the Open API documentation or the libraries that I currently have. Is
this functionality only available in the EAP version of IDEA?

If not, where should I look for the latest version of Open API jars
and documentation? Thank you!



0

Please sign in to leave a comment.