Custom navigation in XML files

Hi all,

I have a couple of projects which contain a lot of XML in a non-standard format (one is an in-house web framework that a friend is working on, and one is a project at work). The XML contains references to other elements in the project, but IDEA doesn't enable navigation for them since it has no idea what the elements represent. How would I go about adding extra navigation for XML files (i.e. allowing the user to Cmd-click on elements/attributes if they refer to other project elements)?

Also, if I wanted to embed a custom language in an existing file format (in this case XML, but I'm also interested in Java for another project) how would I do that? Obviously I can't touch the Java or XML lexers or parsers, would I parse the files as my custom type and provide chameleon tokens for the existing language (i.e. chameleon tokens would cover the whole file except the bits with my custom language, instead of the other way around)?

Thanks,
Colin

3 comments
Comment actions Permalink

Hi Colin,

I have a couple of projects which contain a lot of XML in a non-standard format (one is an in-house web framework that a friend is working on, and one is a project at work). The XML contains references to other elements in the project, but IDEA doesn't enable navigation for them since it has no idea what the elements represent. How would I go about adding extra navigation for XML files (i.e. allowing the user to Cmd-click on elements/attributes if they refer to other project elements)?


Using IDEA DOM API would most likely be the easiest approach:
http://www.jetbrains.com/idea/documentation/dom-rp.html

Also, if I wanted to embed a custom language in an existing file format (in this case XML, but I'm also interested in Java for another project) how would I do that? Obviously I can't touch the Java or XML lexers or parsers, would I parse the files as my custom type and provide chameleon tokens for the existing language (i.e. chameleon tokens would cover the whole file except the bits with my custom language, instead of the other way around)?


Language injection API is likely the way to go, but I've never used it
myself.

-tt

0
Comment actions Permalink

Hi Taras,

Using IDEA DOM API would most likely be the easiest approach:

http://www.jetbrains.com/idea/documentation/dom-rp.htm


Great, thanks - I hadn't seen that document, I'll take a look.

Language injection API is likely the way to go, but I've never used it

myself.


That's what I figured, I just wasn't sure how to got about injecting a language into core one like XML or Java.

Thanks,
Colin

0
Comment actions Permalink

the link is not working any more, could you please update it

1

Please sign in to leave a comment.