From 4fc28da03087073178cd111def4f5b735e411ec1 Mon Sep 17 00:00:00 2001 From: Maxim Mossienko Date: Mon, 24 Jul 2006 21:12:17 +0400 Subject: [PATCH] [#2230] : ExternalDocumentValidator.addProblemToTagName (IDEADEV-7441) --- .../codeInsight/daemon/AntHighlightingTest.java | 14 ++++++++++++++ .../xml/impl/ExternalDocumentValidator.java | 8 ++++++++ .../daemonCodeAnalyzer/ant/ExternalValidator.xml | 7 +++++++ .../daemonCodeAnalyzer/ant/Properties.properties | 3 +++ .../daemonCodeAnalyzer/ant/Properties.xml | 12 ++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 testData/codeInsight/daemonCodeAnalyzer/ant/ExternalValidator.xml create mode 100644 testData/codeInsight/daemonCodeAnalyzer/ant/Properties.properties create mode 100644 testData/codeInsight/daemonCodeAnalyzer/ant/Properties.xml diff --git a/codeInsight/tests/com/intellij/codeInsight/daemon/AntHighlightingTest.java b/codeInsight/tests/com/intellij/codeInsight/daemon/AntHighlightingTest.java index b0fbac750bff..bbedaec1c301 100644 --- a/codeInsight/tests/com/intellij/codeInsight/daemon/AntHighlightingTest.java +++ b/codeInsight/tests/com/intellij/codeInsight/daemon/AntHighlightingTest.java @@ -46,4 +46,18 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase { public void testSanity2() throws Exception { doTest(); } public void testRefid() throws Exception { doTest(); } + + public void testExternalValidator() throws Exception { doTest(); } + + @Bombed(year = 2006, month = Calendar.AUGUST, day = 29, user = "lvo", time = 12, description = "Using property files") + public void testProperties() throws Exception { + configureByFiles( + new VirtualFile[] { + getVirtualFile(BASE_PATH + "/" + getTestName(false) + ".xml"), + getVirtualFile(BASE_PATH + "/" + getTestName(false) + ".properties") + }, + null + ); + doDoTest(true, false); + } } \ No newline at end of file diff --git a/source/com/intellij/xml/impl/ExternalDocumentValidator.java b/source/com/intellij/xml/impl/ExternalDocumentValidator.java index aae4c19b36fc..a96939dcb85f 100644 --- a/source/com/intellij/xml/impl/ExternalDocumentValidator.java +++ b/source/com/intellij/xml/impl/ExternalDocumentValidator.java @@ -12,6 +12,7 @@ import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.source.SourceTreeToPsiMap; +import com.intellij.psi.impl.source.resolve.reference.impl.providers.XmlUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; import com.intellij.reference.SoftReference; @@ -306,6 +307,13 @@ public class ExternalDocumentValidator { ) { return; } + + final XmlDocument document = ((XmlFile)containingFile).getDocument(); + final XmlTag rootTag = document != null ? document.getRootTag() : null; + if (rootTag == null) return; + + if (com.intellij.xml.util.XmlUtil.ANT_URI.equals(rootTag.getNamespace())) return; + final Project project = context.getProject(); SoftReference validatorReference = project.getUserData(validatorInstanceKey); diff --git a/testData/codeInsight/daemonCodeAnalyzer/ant/ExternalValidator.xml b/testData/codeInsight/daemonCodeAnalyzer/ant/ExternalValidator.xml new file mode 100644 index 000000000000..aa42401723d8 --- /dev/null +++ b/testData/codeInsight/daemonCodeAnalyzer/ant/ExternalValidator.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.properties b/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.properties new file mode 100644 index 000000000000..8bbaf97eadde --- /dev/null +++ b/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.properties @@ -0,0 +1,3 @@ +A=foo +B=goo +C=boo \ No newline at end of file diff --git a/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.xml b/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.xml new file mode 100644 index 000000000000..6d41fcd920a4 --- /dev/null +++ b/testData/codeInsight/daemonCodeAnalyzer/ant/Properties.xml @@ -0,0 +1,12 @@ + + + + ANT build script + + + + + + + + \ No newline at end of file