ExternalResourceManager, addResource vs addStdResource

I want to add DTD to external resources, so it could be specified in XML files.

Attempt 1 (use addResource):
1) Link to my DTD can be deleted.
2) My DTD can be edited.

Attempt 2 (use addStdResource):
My DTD is not found. Link in XML shows in red, IDEA says that URI is not registered and suggests fetching it.

In both cases i use the same parameters:
URL: http://mysite.com/dtd/my.dtd
PATH: this.getClass ().getClassLoader ().getResource ("dtd/my.dtd").getFile ()

What should I change to make addStdResouce work?


IMHO this should work:

addStdResource("http://mysite.com/dtd/my.dtd", "/dtd/my.dtd", getClass());


Wow, that worked. Great thanks. Hope IDEA guys will write Javadocs so questions like this one won't appear.


My DTD cannot be removed but still can be edited.


Path to DTD which I get when running IDEA in sandbox:

As I understand, IDEA's own external resources cannot be edited because they are in JAR-file and marked as read-only. How can I mark my DTD as read-only too?


Well, I assume that your plugin will also be distributed as a jar in the end, so you shouldn't care too much about it. I even wasn't aware that my DTDs are editable during plugin development.


Please sign in to leave a comment.