Processing control-click in JSP

We use a set of JSP tags from our app server vendor (ATG). One of the tags we use (everywhere) is used instead of the include directive (e.g. <dsp:include page="/other/page.jsp"/>).

I'd like to write a plugin that would allow me to control-click on the page attribute and jump to the page.

Any pointers?

Thanks

Todd

5 comments
Comment actions Permalink

The simplest (but probably not the best) way to do this is registering com.intellij.psi.impl.source.resolve.reference.impl.providers.WebPathReferenceProvider for your tags.

for example:

registerTags("page", DTDS, new WebPathReferenceProvider(), "include");

where DTDS is String array of all namespaces of custom tags, you want provide with references (ctrl+mouseclick,...) and method registerTags() looks like following one (it's the same as in StrutsAssistant plugin)

protected void registerTags(String attrib, String[] dtds, PsiReferenceProvider provider, String... tags) {
NamespaceFilter nf = new NamespaceFilter(dtds);
TextFilter tf = new TextFilter(tags);
AndFilter af = new AndFilter(nf, new ClassFilter(XmlTag.class), tf);
ParentElementFilter pef = new ParentElementFilter(af, 2);
registry.registerXmlAttributeValueReferenceProvider(new String[]{attrib}, new ScopeFilter(pef), provider);
}

Or have a look at com.intellij.struts.dom.converters.StrutsPagesReferenceProvider in StrutsAssistant plugin (latest versions).

Josef

0
Comment actions Permalink

Thanks Josef, that gives me something to work with. I'll explore that later today.

0
Comment actions Permalink

The simplest (but probably not the best) way to do this is registering com.intellij.psi.impl.source.resolve.reference.impl.providers.WebPathReferenceProvider for your tags.

for example:

registerTags("page", DTDS, new WebPathReferenceProvider(), "include");
...

Is WebPathReferenceProvider available in the OpenAPI? I cannot locate it.

Thanks!!

Todd

0
Comment actions Permalink

never mind. Found it in idea.jar

Plugin is now working!

Thanks!

Todd

0
Comment actions Permalink

I'm really sorry for not responding, I didn't have much time to watch this forum.
And I'm glad it helped you. Josef

0

Please sign in to leave a comment.