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?

6 comments

IMHO this should work:

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

0

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

0

My DTD cannot be removed but still can be edited.

0

Path to DTD which I get when running IDEA in sandbox:
/home/marat/.IntelliJIdea60/sandbox/plugins/my_plugin/classes/dtd/my.dtd

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?

0

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.

0

Please sign in to leave a comment.