Programatically add an external resource

Is there any way to programatically perform the task of going to IDE Settings | Resources | Configure External Resources | Add, and adding a new resource? I tried using ExternalResourceManager in the J2EE package of the open api, but this did not seem to do it.

0
5 comments

Hi,

It should really do it with call like
ExternalResourceManager.getInstance().addResource(url,idea url);

Kirk Woll wrote:

Is there any way to programatically perform the task of going to IDE Settings | Resources | Configure External Resources | Add, and adding a new resource? I tried using ExternalResourceManager in the J2EE package of the open api, but this did not seem to do it.



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Huh, it must have been throwing an exception that I missed earlier because it's working for me now. Sorry about that, but thanks for your help.

0

I figured out what was confusing me earlier. I had put in code to check if the resource had already been added and to only add the resource if it hadn't. However, the method

ExternalResourceManager.getInstance().getResourceLocation

always returns whatever string I pass into the method. I was expecting it to return null if the resource didn't exist. Is there any way to check or should I always try to add it when the plugin initializes?

0

Hi,

If the method does not find anything then just passed url is returned.

Kirk Woll wrote:

I figured out what was confusing me earlier. I had put in code to check if the resource had already been added and to only add the resource if it hadn't. However, the method

ExternalResourceManager.getInstance().getResourceLocation

always returns whatever string I pass into the method. I was expecting it to return null if the resource didn't exist. Is there any way to check or should I always try to add it when the plugin initializes?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Oh, right, I should have thought of that. Thanks, Maxim.

0

Please sign in to leave a comment.