mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-64561 Provide navigation for XSD enum values: fix RNG
This commit is contained in:
+9
-16
@@ -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<PsiReference> list = new ArrayList<PsiReference>();
|
||||
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()]);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<token-datatype xmlns="urn:test:simple.rng"
|
||||
a=" v " b="v" c=" x y "
|
||||
s1="v" s2=" v "
|
||||
s3=<error>" v "</error> />
|
||||
s3="<error descr="Attribute should have fixed value v"> v </error>" />
|
||||
Reference in New Issue
Block a user