diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java index 78c3c2924dbe..f9d9f7cbe23e 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java @@ -17,9 +17,6 @@ package org.intellij.plugins.relaxNG.model.descriptors; import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.text.DelimitedListProcessor; -import com.intellij.psi.ElementManipulators; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; @@ -30,8 +27,8 @@ import com.intellij.psi.xml.XmlTag; import com.intellij.util.ArrayUtil; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; -import com.intellij.xml.util.XmlEnumeratedValueReference; import com.intellij.xml.impl.BasicXmlAttributeDescriptor; +import com.intellij.xml.util.XmlEnumeratedValueReference; import gnu.trove.THashSet; import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NonNls; @@ -212,19 +209,15 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { public PsiReference[] getValueReferences(final XmlAttributeValue value) { String text = value.getValue(); if (text == null) return PsiReference.EMPTY_ARRAY; - final int offset = ElementManipulators.getValueTextRange(value).getStartOffset(); - final List list = new ArrayList(); - new DelimitedListProcessor("") { + return new PsiReference[] { new XmlEnumeratedValueReference(value, this) { + @Nullable @Override - protected boolean isDelimiter(char ch) { - return Character.isWhitespace(ch); + public PsiElement resolve() { + if (isTokenDatatype(getValue())) { + return getElement(); + } + return super.resolve(); } - - @Override - protected void processToken(int start, int end, boolean delimitersOnly) { - list.add(new XmlEnumeratedValueReference(value, TextRange.create(offset + start, offset + end), RngXmlAttributeDescriptor.this)); - } - }.processText(text); - return list.toArray(new PsiReference[list.size()]); + }}; } } \ No newline at end of file diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java index d813d2bcbf48..261ca4e2e98e 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java @@ -17,7 +17,7 @@ package org.intellij.plugins.relaxNG; import com.intellij.javaee.ExternalResourceManagerEx; -import com.intellij.javaee.ExternalResourceManagerImpl; +import com.intellij.javaee.ExternalResourceManagerExImpl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.fileTypes.StdFileTypes; @@ -41,13 +41,19 @@ public class RngXmlHighlightingTest extends HighlightingTestBase { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx(); - ExternalResourceManagerImpl.addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable); - ExternalResourceManagerImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"), myTestRootDisposable); + ExternalResourceManagerExImpl + .addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable); + ExternalResourceManagerExImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"), + myTestRootDisposable); //m.addResource("http://www.w3.org/1999/XSL/Transform", toAbsolutePath("highlighting/relaxng.rng")); - ExternalResourceManagerImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"), myTestRootDisposable); - ExternalResourceManagerImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"), myTestRootDisposable); - ExternalResourceManagerImpl.addTestResource("urn:intelliForm:AttachmentFilter", toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable); - ExternalResourceManagerImpl.addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable); + ExternalResourceManagerExImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"), + myTestRootDisposable); + ExternalResourceManagerExImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"), + myTestRootDisposable); + ExternalResourceManagerExImpl.addTestResource("urn:intelliForm:AttachmentFilter", + toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable); + ExternalResourceManagerExImpl + .addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable); m.addIgnoredResource("urn:intelliForm:Spaces"); m.addIgnoredResource("http://www.w3.org/1999/xlink"); diff --git a/xml/relaxng/testData/highlighting/token-datatype.xml b/xml/relaxng/testData/highlighting/token-datatype.xml index d6e508e77ec6..edd9b0063062 100644 --- a/xml/relaxng/testData/highlighting/token-datatype.xml +++ b/xml/relaxng/testData/highlighting/token-datatype.xml @@ -1,4 +1,4 @@ " v " /> \ No newline at end of file + s3=" v " /> \ No newline at end of file