Unregistering ReferenceProvider

Hi, I've got problem with unregistering CssInHtmlLinkReferenceProvider.
I want to unregister this, because it does not provide correct path to CSS according to the root of web app (run on Struts) and highlights href attribute value as warning

I have my own path reference provider and when it's invoked on ]]> for the first time, it gets registered CssInHtmlLinkReferenceProvider instance and calls
ReferenceProvidersRegistry.unregisterReferenceProvider(XmlAttributeValue.class, cssLinkReferenceProvider);

The problem is that I always get ClassCastException. I spent some time in debugger and found out that even if XmlAttributeValue.class is assigned to SimpleProviderBinding in Map ReferenceProvidersRegistry.b when get() is called on this map, it returns incompatible XmlAttributeValueProviderBinding.

Am I doing something wrong or is it impossible to unregister built-in providers from custom plugins?

Thanks, Josef Pavlas

7 comments
Comment actions Permalink

It seems to me that initial bug (incorrect path to Css) should be fixed
in IDEA, please, file JIRA request.
As to unregisterReferenceProvider method, it was added for testing purposes.

Josef Pavlas wrote:

Hi, I've got problem with unregistering CssInHtmlLinkReferenceProvider.
I want to unregister this, because it does not provide correct path to CSS according to the root of web app (run on Struts) and highlights href attribute value as warning

I have my own path reference provider and when it's invoked on <link> for the first time, it gets registered CssInHtmlLinkReferenceProvider instance and calls
ReferenceProvidersRegistry.unregisterReferenceProvider(XmlAttributeValue.class, cssLinkReferenceProvider);

The problem is that I always get ClassCastException. I spent some time in debugger and found out that even if XmlAttributeValue.class is assigned to SimpleProviderBinding in Map ReferenceProvidersRegistry.b when get() is called on this map, it returns incompatible XmlAttributeValueProviderBinding.

Am I doing something wrong or is it impossible to unregister built-in providers from custom plugins?

Thanks, Josef Pavlas



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

0
Comment actions Permalink

Ok, bug is filed.

I suppose I shall not even try to use unregisterReferenceProvider() method, so I have another question. Is it somehow possible to suppress IDEA's native providers
or to define order/priority of providers registered for some PsiElement?

Thanks, Josef

0
Comment actions Permalink

Ok, bug is filed.

I suppose I shall not even try to use unregisterReferenceProvider() method, so I have another question. Is it somehow possible to suppress IDEA's native providers
or to define order/priority of providers registered for some PsiElement?

Thanks, Josef


This will be possible in Diana. Do you mean any particular provider
(then there may be ad hoc solution)?

0
Comment actions Permalink

Right know I've on my mind the CssInHtmlLinkReferenceProvider, CssInHtmlClassOrIdReferenceProvider (sometimes it seems not to work correctly, but I'm not sure, need to pay more attention to it) and builtin reference provider working with keys from properties files (currently provides all keys from all the properties files in project, which is not sometimes what we need).

I hope it makes sense to you and thank you for your reply, Josef.

0
Comment actions Permalink

Josef Pavlas ?????:

Right know I've on my mind the CssInHtmlLinkReferenceProvider, CssInHtmlClassOrIdReferenceProvider (sometimes it seems not to work correctly, but I'm not sure, need to pay more attention to it) and builtin reference provider working with keys from properties files (currently provides all keys from all the properties files in project, which is not sometimes what we need).

I hope it makes sense to you and thank you for your reply, Josef.


Generally non-soft references override soft ones. So you can just put
your own non-soft reference in the place of preferined IntelliJ IDEA
soft reference. Unfortunately, CssInHtmlLinkReferenceProvider provides
non-soft references, while ClassOrId and property key references are
soft, so you can try to override them.

0
Comment actions Permalink

Ok, thanks for your answer.
Josef

0

Please sign in to leave a comment.