looking for sample add feature to dialog

Answered

I want to create my first plugin for IntelliJ, but I don't know where to get the right documentation.  I want to add feature to current dialog, like "Find in Path".  Suppose that I want to add a tab after (preview).

 

Where can I find example or documentation to bind my code to a particuliar dialog.  Maybe it's not possible and I have to create a new dialog and use the current API to recrete the "find in text" functionnality.  

 

Can someone help me ?

 

thanks

8 comments
Avatar
Vassiliy Kudryashov
Comment actions Permalink

Unfortunately "Find in Path" dialog is not designed to any 3rd-party extensions. Despite the fact that all these dialogs and components are just are Java swing, the best way to add your new features is API (and corresponding documentation).

0
Comment actions Permalink

Oh boy.  I wasn't expecting that from IntelliJ.  There is no way to extends these panels ?  

0
Avatar
Vassiliy Kudryashov
Comment actions Permalink

Theoretically it's doable but not implemented yet. Could you explain your 'extension' case?

0
Comment actions Permalink

basicaly, I wanted to reuse the "Find in path" panel and extends it.  My usecase is this  :

- Find in Path a text  with multiple criterias.  like this : 

 

Find in path :  "system.getErrors().addMessage(123)"      that could return me 50 classes that contains that line

but I would like to add another critera  like this  : and contains  "Rule123"   and the find will return only 8 classes.   

 

With that, I would be able to find all the classes that will be impacted by my new requirements.  Right now, I have to look into all the 50 classes to check which one apply to the rule 123.

 

so I was thinking of reusing the panel and add another tab or something like that and the able to add criterias to the search.  Could do the same thing for "Replace in path"

 

 

 

 

0
Avatar
Vassiliy Kudryashov
Comment actions Permalink

Why don't you use "Regular expression" search? It works with pattern like this.

(system.getErrors\(\).addMessage\(123\)).*Rule123
0
Comment actions Permalink

it's just that isn't intuitive.  It's not as easy to select part of code  + CTRL+SHIFT+F.    The goal is to avoid manual manipulation.. just click next next next pattern :)

 

something I have to do a refactoring that is more complex than the line that I give you.

0
Comment actions Permalink

Would converting the selection into a regex programmatically and then copying the regex into the clipboard be a reasonable workaround?

Or you can find the source code for Find In Path action, set a bunch of breakpoints there (sources should be available) and see if you can extend it, create your custom action and then register your extended action under the same hot key. 

Another way to debug it is by setting breakpoints on all JDialog constructors. I am almost positive that Find in Path is a JDialog, so that should bring you into the code in question pretty fast. 

Disclaimer: I am a fellow plugin developer, I don't work for JetBrains, so take with a grain of salt. But yeah, that's how I do things. I just did a custom DebugSettingsEditor by extending one of the standard DebugSettingsEditors, so it's almost always doable. Of course there is no expectation of backward compatibility when you do this, so JetBrains might recommend against it.

 

 

 

0
Comment actions Permalink

thanks Irina,  that's something that I'll check.  

0

Please sign in to leave a comment.