How to create PsiElements for insertion into JSP page?

I am writing an inspection/quick fix that works in JSP pages. I've got the inspection working, but I can't figure out how to create PsiStatements for insertion into the page. It seems like I need to create instances of JSPCodeBlock, JSPTemplateStatement and JSPText but it doesn't look like I can do that with the PsiElementFactory.

I have a reference to the following JspCodeBlock from my inspection:

        
                     
]]>


and I need to add the following after the <dsp:form ...> tag:

     "/>
]]>


Thanks!

Todd

Edited by: Todd Breiholz on Jun 4, 2008 10:33 PM - Changed title to indicate question

0
2 comments
Avatar
Permanently deleted user

Todd Breiholz wrote:

I am writing an inspection/quick fix that works in JSP pages. I've got the inspection working, but I can't figure out how to create PsiStatements for insertion into the page. It seems like I need to create instances of JSPCodeBlock, JSPTemplateStatement and JSPText but it doesn't look like I can do that with the PsiElementFactory.

I have a reference to the following JspCodeBlock from my inspection:

     
>         
>                      
> ]]>


and I need to add the following after the <dsp:form ...> tag:

     
>      "/>
> ]]>


Thanks!

Todd


Create a light jsp file (createFileFromText) with the tag you need, then
find it in file's PSI and add this tag to <dsp:form> via PsiElement.add*.

0
Avatar
Permanently deleted user

Works perfect!

Thanks, Peter

0

Please sign in to leave a comment.