Best place to modify the XmlEntitiesInspection settings

I need to add additional the custom tag for the "HTML tags and attributes convention" inspection.
The code below do this:


I have a problem: the InspectionProjectProfileManager.getInspectionProfile(PsiElement) method needs the PsiElement argument, so I can't execute this code in the ProjectComponent.projectOpened() method (convenient, called once).

Should I call the code on document open event, or simple add the custom attribute for all profiles in the ProjectComponent.projectOpened() method?

2 comments
Comment actions Permalink

Hello Alex,

Sorry for late response

Yes, you need to modify all profiles but what this code will do if your entries
was already added on the previous project opened? I think that we need additional
extension point to be able to extend these inspections. If so could you please
file JIRA request?

Thank you

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

I need to add additional the custom tag for the "HTML tags and
attributes convention" inspection. The code below do this:

 InspectionProfile profile =
> InspectionProjectProfileManager.getInstance(project).getInspectionProf
> ile(xmlTag);
> ModifiableModel model = profile.getModifiableModel();
> XmlEntitiesInspection entitiesInspection =
> (XmlEntitiesInspection) ((LocalInspectionToolWrapper)
> model.getInspectionTool("HTML")).getTool();
> entitiesInspection.setAdditionalEntries(0, "jwcid");
> 
> model.commit(InspectionProjectProfileManager.getInstance(project));
> ]]>

I have a problem: the
InspectionProjectProfileManager.getInspectionProfile(PsiElement)
method needs the PsiElement argument, so I can't execute this code in
the ProjectComponent.projectOpened() method (convenient, called once).

Should I call the code on document open event, or simple add the
custom attribute for all profiles in the
ProjectComponent.projectOpened() method?



0
Comment actions Permalink

http://jetbrains.net/jira/browse/IDEA-12032

It will be good if this functionality appears in Idea 6.0.5 :)

0

Please sign in to leave a comment.